1
0
mirror of synced 2026-02-13 13:06:56 +00:00

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:
Hidde Beydals
2023-02-15 13:11:37 +01:00
parent 1e67d75848
commit b263e14fa8
9 changed files with 167 additions and 125 deletions

View File

@@ -171,8 +171,7 @@ spec:
if err != nil {
t.Fatal(err)
}
defer os.Remove("./testdata/build-kustomization/podinfo.yaml")
t.Cleanup(func() { _ = os.Remove("./testdata/build-kustomization/podinfo.yaml") })
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {