]> git.scottworley.com Git - trustix-integration-tests/commitdiff
Go faster: Run the initial `nixos-rebuild switch`es concurrently
authorScott Worley <scottworley@scottworley.com>
Mon, 19 Jul 2021 21:37:30 +0000 (14:37 -0700)
committerScott Worley <scottworley@scottworley.com>
Tue, 20 Jul 2021 00:01:33 +0000 (17:01 -0700)
checks/one-publisher.nix

index b661624c0f476e184bd43f8b30c5d9e6d3ccf67a..8fe584e70483103ff4bd3ac3d74d16346c520602 100644 (file)
@@ -154,11 +154,27 @@ in nixosTest {
   };
   testScript = ''
     from os import getenv
+    from threading import Thread
 
     alisha.wait_for_file("/keys/trustix-pub")
     alisha.copy_from_vm("/keys/trustix-pub")
     clint.copy_from_host(getenv("out") + "/trustix-pub", "/keys/alisha-signing-pub")
 
+    clint.wait_for_file("/keys/cache-priv-key.pem")
+    clint_thread = Thread(
+        target=lambda: clint.succeed(
+            "${
+              mkConfig {
+                config = clientConfig;
+                trustixPubKeyPath = "/keys/alisha-signing-pub";
+                binaryCachePubKeyPath = "/keys/cache-priv-key.pem";
+              }
+            }",
+            "nixos-rebuild switch --show-trace",
+        )
+    )
+    clint_thread.start()
+
     alisha.succeed(
         "${
           mkConfig {
@@ -170,17 +186,7 @@ in nixosTest {
     )
     alisha.succeed("nix-build '<nixpkgs>' -A hello")
 
-    clint.wait_for_file("/keys/cache-priv-key.pem")
-    clint.succeed(
-        "${
-          mkConfig {
-            config = clientConfig;
-            trustixPubKeyPath = "/keys/alisha-signing-pub";
-            binaryCachePubKeyPath = "/keys/cache-priv-key.pem";
-          }
-        }",
-        "nixos-rebuild switch --show-trace",
-    )
+    clint_thread.join()
     clint.succeed("nix-build '<nixpkgs>' -A hello")
     clint.fail("grep hello /var/log/local-builds")
   '';