mirror of
https://github.com/aquasecurity/kube-bench.git
synced 2024-12-19 13:18:07 +00:00
chore: fix defer func in for-loop (#825)
* chore: call defer func for each iteration Signed-off-by: TakahiroTsuruda <isrgnoe@gmail.com> * chore: error check
This commit is contained in:
parent
baf05eca3b
commit
4d6de1e2a5
@ -195,6 +195,7 @@ func TestIsMaster(t *testing.T) {
|
|||||||
defer restore()
|
defer restore()
|
||||||
|
|
||||||
for _, tc := range testCases {
|
for _, tc := range testCases {
|
||||||
|
func() {
|
||||||
cfgFile = tc.cfgFile
|
cfgFile = tc.cfgFile
|
||||||
initConfig()
|
initConfig()
|
||||||
|
|
||||||
@ -206,6 +207,7 @@ func TestIsMaster(t *testing.T) {
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
assert.Equal(t, tc.isMaster, isMaster(), tc.name)
|
assert.Equal(t, tc.isMaster, isMaster(), tc.name)
|
||||||
|
}()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -506,6 +508,7 @@ func TestIsEtcd(t *testing.T) {
|
|||||||
defer restore()
|
defer restore()
|
||||||
|
|
||||||
for _, tc := range testCases {
|
for _, tc := range testCases {
|
||||||
|
func() {
|
||||||
cfgFile = tc.cfgFile
|
cfgFile = tc.cfgFile
|
||||||
initConfig()
|
initConfig()
|
||||||
|
|
||||||
@ -517,6 +520,7 @@ func TestIsEtcd(t *testing.T) {
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
assert.Equal(t, tc.isEtcd, isEtcd(), tc.name)
|
assert.Equal(t, tc.isEtcd, isEtcd(), tc.name)
|
||||||
|
}()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,7 +52,10 @@ var runCmd = &cobra.Command{
|
|||||||
|
|
||||||
// Merge version-specific config if any.
|
// Merge version-specific config if any.
|
||||||
path := filepath.Join(cfgDir, bv)
|
path := filepath.Join(cfgDir, bv)
|
||||||
mergeConfig(path)
|
err = mergeConfig(path)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Printf("Error in mergeConfig: %v\n", err)
|
||||||
|
}
|
||||||
|
|
||||||
err = run(targets, bv)
|
err = run(targets, bv)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user