diff options
author | talyz <kim.lindberger@gmail.com> | 2021-06-04 14:48:00 +0200 |
---|---|---|
committer | talyz <kim.lindberger@gmail.com> | 2021-06-05 18:44:42 +0200 |
commit | b7749c76715ba96727f7a12bc2514ddfa6847813 (patch) | |
tree | a85f4684c53bd0ab4a35787fce95bf64edcce528 /nixos/tests/wiki-js.nix | |
parent | f36a65f6e2e9f3641f12c7d6e48a5ec4b5c5394b (diff) |
nixos/test-driver: Run commands with error handling
Bash's standard behavior of not propagating non-zero exit codes through a pipeline is unexpected and almost universally unwanted. Default to setting `pipefail` for the command being run; it can still be turned off by prefixing the pipeline with `set +o pipefail` if needed. Also, set `errexit` and `nonunset` options to make the first command of consecutive commands separated by `;` fail, and disallow dereferencing unset variables respectively.
Diffstat (limited to 'nixos/tests/wiki-js.nix')
-rw-r--r-- | nixos/tests/wiki-js.nix | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/nixos/tests/wiki-js.nix b/nixos/tests/wiki-js.nix index 9aa87d15366b1..783887d2dcaa9 100644 --- a/nixos/tests/wiki-js.nix +++ b/nixos/tests/wiki-js.nix @@ -119,7 +119,7 @@ import ./make-test-python.nix ({ pkgs, lib, ...} : { with subtest("Setup"): result = machine.succeed( - "set -o pipefail; curl -sSf localhost:3000/finalize -X POST -d " + "curl -sSf localhost:3000/finalize -X POST -d " + "@${payloads.finalize} -H 'Content-Type: application/json' " + "| jq .ok | xargs echo" ) @@ -132,7 +132,7 @@ import ./make-test-python.nix ({ pkgs, lib, ...} : { with subtest("Base functionality"): auth = machine.succeed( - "set -o pipefail; curl -sSf localhost:3000/graphql -X POST " + "curl -sSf localhost:3000/graphql -X POST " + "-d @${payloads.login} -H 'Content-Type: application/json' " + "| jq '.[0].data.authentication.login.jwt' | xargs echo" ).strip() @@ -140,7 +140,7 @@ import ./make-test-python.nix ({ pkgs, lib, ...} : { assert auth create = machine.succeed( - "set -o pipefail; curl -sSf localhost:3000/graphql -X POST " + "curl -sSf localhost:3000/graphql -X POST " + "-d @${payloads.content} -H 'Content-Type: application/json' " + f"-H 'Authorization: Bearer {auth}' " + "| jq '.[0].data.pages.create.responseResult.succeeded'|xargs echo" |