tests: only provide template values when used
As otherwise the `.golden` values can not be automatically updated using `-update` as documented in `CONTRIBUTING.md`. Also ensure we do not use `defer` but rather `t.Cleanup` in tests, as this will always be called even if e.g. `t.Fatal` absruptly stops the test. Signed-off-by: Hidde Beydals <hello@hidde.co>
This commit is contained in:
@@ -25,9 +25,7 @@ func TestInstall(t *testing.T) {
|
||||
// Given that this test uses an invalid namespace, it ensures
|
||||
// to restore whatever value it had previously.
|
||||
currentNamespace := *kubeconfigArgs.Namespace
|
||||
defer func() {
|
||||
*kubeconfigArgs.Namespace = currentNamespace
|
||||
}()
|
||||
t.Cleanup(func() { *kubeconfigArgs.Namespace = currentNamespace })
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
|
||||
Reference in New Issue
Block a user