aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQyriad <qyriad@qyriad.me>2024-04-22 16:13:36 -0600
committerQyriad <qyriad@qyriad.me>2024-04-22 16:13:36 -0600
commit7063170d5fd7220c30186ba9eaaa7e2627b30c9a (patch)
tree4cc078a8423566fcacc152ace9015aa5d5fe5998
parentff9a4fc336bca88fff4bee119c032905a5bab61f (diff)
tests: add error messages to the asserts in tarball flakes test
In hopes of avoiding opaque error messages like the one in https://buildbot.lix.systems/#/builders/49/builds/1054/steps/1/logs/stdio Traceback (most recent call last): File "/nix/store/wj6wh89jhd2492r781qsr09r9wydfs6m-nixos-test-driver-1.1/bin/.nixos-test-driver-wrapped", line 9, in <module> sys.exit(main()) ^^^^^^ File "/nix/store/wj6wh89jhd2492r781qsr09r9wydfs6m-nixos-test-driver-1.1/lib/python3.11/site-packages/test_driver/__init__.py", line 126, in main driver.run_tests() File "/nix/store/wj6wh89jhd2492r781qsr09r9wydfs6m-nixos-test-driver-1.1/lib/python3.11/site-packages/test_driver/driver.py", line 159, in run_tests self.test_script() File "/nix/store/wj6wh89jhd2492r781qsr09r9wydfs6m-nixos-test-driver-1.1/lib/python3.11/site-packages/test_driver/driver.py", line 151, in test_script exec(self.tests, symbols, None) File "<string>", line 13, in <module> AssertionError Change-Id: Idd2212a1c3714ce58c7c3a9f34c2ca4313eb6d55
-rw-r--r--tests/nixos/tarball-flakes.nix13
1 files changed, 8 insertions, 5 deletions
diff --git a/tests/nixos/tarball-flakes.nix b/tests/nixos/tarball-flakes.nix
index e30d15739..2c0df60ee 100644
--- a/tests/nixos/tarball-flakes.nix
+++ b/tests/nixos/tarball-flakes.nix
@@ -64,15 +64,18 @@ in
info = json.loads(out)
# Check that we got redirected to the immutable URL.
- assert info["locked"]["url"] == "http://localhost/stable/${nixpkgs.rev}.tar.gz"
+ locked_url = info["locked"]["url"]
+ assert locked_url == "http://localhost/stable/${nixpkgs.rev}.tar.gz", f"{locked_url=} != http://localhost/stable/${nixpkgs.rev}.tar.gz"
# Check that we got the rev and revCount attributes.
- assert info["revision"] == "${nixpkgs.rev}"
- assert info["revCount"] == 1234
+ revision = info["revision"]
+ rev_count = info["revCount"]
+ assert revision == "${nixpkgs.rev}", f"{revision=} != ${nixpkgs.rev}"
+ assert rev_count == 1234, f"{rev_count=} != 1234"
# Check that fetching with rev/revCount/narHash succeeds.
- machine.succeed("nix flake metadata --json http://localhost/latest.tar.gz?rev=" + info["revision"])
- machine.succeed("nix flake metadata --json http://localhost/latest.tar.gz?revCount=" + str(info["revCount"]))
+ machine.succeed("nix flake metadata --json http://localhost/latest.tar.gz?rev=" + revision)
+ machine.succeed("nix flake metadata --json http://localhost/latest.tar.gz?revCount=" + str(rev_count))
machine.succeed("nix flake metadata --json http://localhost/latest.tar.gz?narHash=" + info["locked"]["narHash"])
# Check that fetching fails if we provide incorrect attributes.