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

Use curl --fail in NixOS tests #98119

Open
wants to merge 41 commits into
base: master
from
Open

Use curl --fail in NixOS tests #98119

wants to merge 41 commits into from

Conversation

@chkno
Copy link
Member

chkno commented Sep 16, 2020

Motivation for this change

Many tests use machine.succeed("curl ...") to poke the software under test. This does not do what it reads like. Without the --fail flag, curl exits successfully even if the request returned a failure status (404, 500, etc.).

Tests should pretty much always use curl --fail.

This PR adds --fail to all the tests that still pass after doing so. (Tests that are broken at HEAD and tests for which adding --fail introduces breakage are omitted.)

This makes the tests work as the test authors probably intended.

This provides many more examples of correct usage in the NixOS tests, so folks adding tests in the future have good examples to borrow from.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.
@Ma27
Ma27 approved these changes Sep 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.