Skip to content

Commit

Permalink
Added test cases for labels
Browse files Browse the repository at this point in the history
  • Loading branch information
Anshul Sharma committed Dec 7, 2023
1 parent a394d0e commit cb6bb39
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/kn/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ plugins:
directory: /tmp
profiles:
istio:
labels:
environment: test
annotations:
sidecar.istio.io/inject: "true"
sidecar.istio.io/rewriteAppHTTPProbers: "true"
Expand Down Expand Up @@ -57,7 +59,10 @@ eventing:
assert.Equal(t, GlobalConfig.PluginsDir(), "/tmp")
assert.Equal(t, GlobalConfig.LookupPluginsInPath(), true)
assert.Equal(t, len(GlobalConfig.SinkMappings()), 1)
assert.Equal(t, len(GlobalConfig.Profile("istio").Annotations), 3)
assert.Equal(t, GlobalConfig.Profile("istio").Annotations["sidecar.istio.io/inject"], "true")
assert.Equal(t, len(GlobalConfig.Profile("istio").Labels), 1)
assert.Equal(t, GlobalConfig.Profile("istio").Labels["environment"], "test")
assert.DeepEqual(t, (GlobalConfig.SinkMappings())[0], SinkMapping{
Prefix: "service",
Resource: "services",
Expand Down
1 change: 1 addition & 0 deletions pkg/kn/config/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ type ChannelTypeMapping struct {

type Profile struct {
Annotations map[string]string `yaml:"annotations"`
Labels map[string]string `yaml:"labels"`
}

// config Keys for looking up in viper
Expand Down

0 comments on commit cb6bb39

Please sign in to comment.