-
Notifications
You must be signed in to change notification settings - Fork 137
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
Skip tests that require network access with HERMETIC=true #587
Conversation
The config tests make outbound network calls since Load() calls prepare() which fetches the OIDC configs. Tests that call Load() will now be skipped. Tested with `HERMETIC=true go test ./...` without a network connection. I didn't use go:build !hermetic beacuse this causes the build to skip building the config package entirely. Signed-off-by: Hayden Blauzvern <hblauzvern@google.com>
cc @06kellyjac |
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.
looking forward to this addition. Thanks :)
Two nits:
|
I'd prefer to continue running all tests by default. If we forget to enable the network tests for some reason, we'll lose some coverage. If we get more reports of tests run in hermetic environments, then we can consider switching, but since GitHub Actions runners have network access, I'm not too concerned.
|
You just need to move the non-hermetic tests to a seperate file like this: nsmith5@c4703f9 Can confirm that this diff works as expected (e.g |
if default is hermetic and non-hermetic is opt in I think the tag should be |
Signed-off-by: Hayden Blauzvern <hblauzvern@google.com>
Yep, splitting it up resolved the issue. This switched it to |
The config tests make outbound network calls since Load() calls
prepare() which fetches the OIDC configs. Tests that call Load() will
now be skipped. Tested with
go test -tags=hermetic ./...
without anetwork connection.
Signed-off-by: Hayden Blauzvern hblauzvern@google.com
Summary
Ticket Link
Fixes #480
Release Note