-
Notifications
You must be signed in to change notification settings - Fork 634
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tests: only provide template values when used #3592
Conversation
ed5cc8a
to
66cd09e
Compare
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>
66cd09e
to
b263e14
Compare
@@ -171,8 +171,7 @@ spec: | |||
if err != nil { | |||
t.Fatal(err) | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is more here that could be done, as using ./testdata/
for something temporary seems wrong.
I think we should instead use t.TempDir()
as a target for the file that is been written. Which would prevent having to think about garbage collecting it later on.
This is however beyond the time I have available now, as I was merely trying to fix things I ran into while working on #3587.
Signed-off-by: Hidde Beydals <hello@hidde.co>
98da40a
to
1f5961d
Compare
As the other version has a different signature, but exists for a different build tag. Resulting in my IDE becoming absolutely confused when I tried to enable both at the same time. Opted for "exec" because this one shells out. Signed-off-by: Hidde Beydals <hello@hidde.co>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
As otherwise the
.golden
values can not be automatically updated using-update
as documented inCONTRIBUTING.md
.Also ensure we do not use
defer
but rathert.Cleanup
in tests, asthis will always be called even if e.g.
t.Fatal
abruptly stops thetest.
Also fixed some other minor things I ran into, and filled issues for the
things that are beyond reach of time I have available.