Skip to content

Commit

Permalink
Merge pull request #1844 from camilamacedo86/config-test
Browse files Browse the repository at this point in the history
🌱 add unit tests for the config
  • Loading branch information
k8s-ci-robot committed Nov 18, 2020
2 parents 5a78c19 + e6e4108 commit e68952c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions pkg/model/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,22 @@ var _ = Describe("PluginConfig", func() {
Expect(config.DecodePluginConfig(key, &pluginConfig)).To(Succeed())
Expect(pluginConfig).To(Equal(expectedPluginConfig))
})

It("should Marshal and Unmarshal a plugin", func() {
By("Using config with extra fields as struct")
cfg := Config{
Version: Version3Alpha,
Plugins: PluginConfigs{
"plugin-x": map[string]interface{}{
"data-1": "plugin value 1",
},
},
}
b, err := cfg.Marshal()
Expect(err).NotTo(HaveOccurred())
Expect(string(b)).To(Equal("version: 3-alpha\nplugins:\n plugin-x:\n data-1: plugin value 1\n"))
Expect(cfg.Unmarshal(b)).To(Succeed())
})
})

var _ = Describe("Resource Version Compatibility", func() {
Expand Down

0 comments on commit e68952c

Please sign in to comment.