Skip to content

Commit 82fdfd7

Browse files
committed
🌱 (chore): prevent variable shadowing in DecodePluginConfig test to ensure accurate assertion
1 parent d177b65 commit 82fdfd7

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

‎pkg/config/v3/config_test.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -405,24 +405,24 @@ var _ = Describe("Cfg", func() {
405405
})
406406

407407
It("DecodePluginConfig should fail for no plugin config object", func() {
408-
var pluginCfg PluginConfig
409-
err := c0.DecodePluginConfig(key, &pluginCfg)
408+
var decodedPluginCfg PluginConfig
409+
err := c0.DecodePluginConfig(key, &decodedPluginCfg)
410410
Expect(err).To(HaveOccurred())
411411
Expect(errors.As(err, &config.PluginKeyNotFoundError{})).To(BeTrue())
412412
})
413413

414414
It("DecodePluginConfig should fail to retrieve data from a non-existent plugin", func() {
415-
var pluginCfg PluginConfig
416-
err := c1.DecodePluginConfig("plugin-y", &pluginCfg)
415+
var decodedPluginCfg PluginConfig
416+
err := c1.DecodePluginConfig("plugin-y", &decodedPluginCfg)
417417
Expect(err).To(HaveOccurred())
418418
Expect(errors.As(err, &config.PluginKeyNotFoundError{})).To(BeTrue())
419419
})
420420

421421
DescribeTable("DecodePluginConfig should retrieve the plugin data correctly",
422422
func(getCfg func() Cfg, expected func() PluginConfig) {
423-
var pluginCfg PluginConfig
424-
Expect(getCfg().DecodePluginConfig(key, &pluginCfg)).To(Succeed())
425-
Expect(pluginCfg).To(Equal(expected()))
423+
var decodedPluginCfg PluginConfig
424+
Expect(getCfg().DecodePluginConfig(key, &decodedPluginCfg)).To(Succeed())
425+
Expect(decodedPluginCfg).To(Equal(expected()))
426426
},
427427
Entry("for an empty plugin config object", func() Cfg { return c1 }, func() PluginConfig { return PluginConfig{} }),
428428
Entry("for a full plugin config object", func() Cfg { return c2 }, func() PluginConfig { return pluginCfg }),

0 commit comments

Comments
 (0)