mirror of
https://github.com/fluxcd/flux2.git
synced 2026-05-05 17:44:44 +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:
parent
1e67d75848
commit
b263e14fa8
9 changed files with 167 additions and 125 deletions
|
|
@ -54,7 +54,7 @@ data:
|
|||
tmpFile, err := saveReaderToFile(strings.NewReader(tt.string))
|
||||
g.Expect(err).To(BeNil())
|
||||
|
||||
defer os.Remove(tmpFile)
|
||||
t.Cleanup(func() { _ = os.Remove(tmpFile) })
|
||||
|
||||
b, err := os.ReadFile(tmpFile)
|
||||
if tt.expectErr {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue