Skip to content
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

Invert condition used to exempt network tests #1251

Closed
rfratto opened this issue Jan 11, 2022 · 1 comment · Fixed by #1268
Closed

Invert condition used to exempt network tests #1251

rfratto opened this issue Jan 11, 2022 · 1 comment · Fixed by #1268
Labels
frozen-due-to-age Locked due to a period of inactivity. Please open new issues or PRs if more discussion is needed.

Comments

@rfratto
Copy link
Member

rfratto commented Jan 11, 2022

Today, we have tests which only execute when -tags has_network is provided:

//go:build !windows && has_network

This is useful for running tests in a sandbox environment where things like the network aren't available. We initially started doing this after @flokli's #333, which needs to skip over tests for NixOS.

However, adding the extra tag makes it more difficult to write the tests, as it is excluded from build by default, and therefore excluded from gopls by default.

I'd suggest that we invert the condition instead:

//go:build !nonetwork
//go:build !nodocker 

(etc)

This makes it easier to add to the tests, and ensures that the default testing behavior is to run everything.

@flokli
Copy link
Contributor

flokli commented Jan 11, 2022

Both works - whenever I bump to a version containing these changes, I should realize the tests start failing ;-)

Thanks for the heads-up!

@github-actions github-actions bot added the frozen-due-to-age Locked due to a period of inactivity. Please open new issues or PRs if more discussion is needed. label Feb 22, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
frozen-due-to-age Locked due to a period of inactivity. Please open new issues or PRs if more discussion is needed.
Projects
None yet
2 participants