about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2024-06-29T14·52+0300
committerflokli <flokli@flokli.de>2024-06-29T16·56+0000
commit86ab052fe037715828e2856e6c700b97d7de20ca (patch)
tree56ab10849e5b3f5595b8aa8aaa076658dc76b712
parent6cf8003fa17a0c9e9322faa9b050df97b588eb90 (diff)
feat(tvix/boot/tests): closure-nixos-bigtable r/8326
This uses the `preStart` mechanism to boot up a bigtable emulator, which
we point directory/pathinfoservice to.

Change-Id: Icb383403cb2d1f7e19c71b6298e82b391f9c8d22
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11895
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: Connor Brewster <cbrewster@hey.com>
Tested-by: BuildkiteCI
-rw-r--r--tvix/boot/tests/default.nix21
1 files changed, 21 insertions, 0 deletions
diff --git a/tvix/boot/tests/default.nix b/tvix/boot/tests/default.nix
index 785ff96570ab..fb7d14f8b5cd 100644
--- a/tvix/boot/tests/default.nix
+++ b/tvix/boot/tests/default.nix
@@ -178,6 +178,27 @@ depot.nix.readTree.drvTargets
     assertVMOutput = "Onwards and upwards.";
   });
 
+  closure-nixos-bigtable = (mkBootTest {
+    blobServiceAddr = "objectstore+file:///build/blobs";
+    directoryServiceAddr = "bigtable://instance-1?project_id=project-1&table_name=directories&family_name=cf1";
+    pathInfoServiceAddr = "bigtable://instance-1?project_id=project-1&table_name=pathinfos&family_name=cf1";
+    path = testSystem;
+    useNarBridge = true;
+    preStart = ''
+      ${pkgs.cbtemulator}/bin/cbtemulator -address $PWD/cbtemulator.sock &
+      timeout 22 sh -c 'until [ -e $PWD/cbtemulator.sock ]; do sleep 1; done'
+
+      export BIGTABLE_EMULATOR_HOST=unix://$PWD/cbtemulator.sock
+      ${pkgs.google-cloud-bigtable-tool}/bin/cbt -instance instance-1 -project project-1 createtable directories
+      ${pkgs.google-cloud-bigtable-tool}/bin/cbt -instance instance-1 -project project-1 createfamily directories cf1
+      ${pkgs.google-cloud-bigtable-tool}/bin/cbt -instance instance-1 -project project-1 createtable pathinfos
+      ${pkgs.google-cloud-bigtable-tool}/bin/cbt -instance instance-1 -project project-1 createfamily pathinfos cf1
+    '';
+    isClosure = true;
+    vmCmdline = "init=${testSystem}/init panic=-1"; # reboot immediately on panic
+    assertVMOutput = "Onwards and upwards.";
+  });
+
   closure-nixos-nar-bridge = (mkBootTest {
     blobServiceAddr = "objectstore+file:///build/blobs";
     path = testSystem;