about summary refs log tree commit diff
path: root/tvix/boot
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2024-03-11T22·07+0200
committerclbot <clbot@tvl.fyi>2024-03-11T22·42+0000
commit514edc2ea52bfade7770ed35e0bf40aa1b4e9fde (patch)
tree9c1044a018558432b42fee68309c1f2145ba9a61 /tvix/boot
parentf22d5b3d114cb3c3c73b41c738342fd9b6b2d04a (diff)
feat(tvix/boot/tests): add simple objectstore test r/7686
This makes BLOB_SERVICE_ADDR configurable, and creates a flavor setting
it to objectstore+file://$PWD/blobs.

Change-Id: I68c21367f83f68b4dee701c5678f438c7d8fbe43
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11137
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: Connor Brewster <cbrewster@hey.com>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/boot')
-rw-r--r--tvix/boot/tests/default.nix55
1 files changed, 30 insertions, 25 deletions
diff --git a/tvix/boot/tests/default.nix b/tvix/boot/tests/default.nix
index d725a7ac9bb7..4a38b3f65083 100644
--- a/tvix/boot/tests/default.nix
+++ b/tvix/boot/tests/default.nix
@@ -1,35 +1,40 @@
 { depot, pkgs, ... }:
 
-depot.nix.readTree.drvTargets {
+let
   # Seed a tvix-store with the tvix docs, then start a VM, ask it to list all
   # files in /nix/store, and ensure the store path is present, which acts as a
   # nice smoketest.
-  docs = pkgs.stdenv.mkDerivation {
-    name = "run-vm";
-    nativeBuildInputs = [
-      depot.tvix.store
-      depot.tvix.boot.runVM
-    ];
-    buildCommand = ''
-      touch $out
+  mkBootTest = blobServiceAddr:
+    pkgs.stdenv.mkDerivation {
+      name = "run-vm";
+      nativeBuildInputs = [
+        depot.tvix.store
+        depot.tvix.boot.runVM
+      ];
+      buildCommand = ''
+        touch $out
 
-      # Configure tvix to put data in the local working directory
-      export BLOB_SERVICE_ADDR=sled://$PWD/blobs.sled
-      export DIRECTORY_SERVICE_ADDR=sled://$PWD/directories.sled
-      export PATH_INFO_SERVICE_ADDR=sled://$PWD/pathinfo.sled
+        # Configure tvix to put data in the local working directory
+        export BLOB_SERVICE_ADDR=${blobServiceAddr}
+        export DIRECTORY_SERVICE_ADDR=sled://$PWD/directories.sled
+        export PATH_INFO_SERVICE_ADDR=sled://$PWD/pathinfo.sled
 
-      # Seed the tvix store with some data
-      # Create a `docs` directory with the contents from ../docs
-      # Make sure it still is called "docs" when calling import, so we can
-      # predict the store path.
-      cp -R ${../../docs} docs
-      outpath=$(tvix-store import docs)
+        # Seed the tvix store with some data
+        # Create a `docs` directory with the contents from ../docs
+        # Make sure it still is called "docs" when calling import, so we can
+        # predict the store path.
+        cp -R ${../../docs} docs
+        outpath=$(tvix-store import docs)
 
-      echo "Store contents imported to $outpath"
+        echo "Store contents imported to $outpath"
 
-      CH_CMDLINE="tvix.find" run-tvix-vm 2>&1 | tee output.txt
-      grep ${../../docs} output.txt
-    '';
-    requiredSystemFeatures = [ "kvm" ];
-  };
+        CH_CMDLINE="tvix.find" run-tvix-vm 2>&1 | tee output.txt
+        grep ${../../docs} output.txt
+      '';
+      requiredSystemFeatures = [ "kvm" ];
+    };
+in
+depot.nix.readTree.drvTargets {
+  docs-sled = (mkBootTest "sled://$PWD/blobs.sled");
+  docs-objectstore-local = (mkBootTest "objectstore+file://$PWD/blobs");
 }