about summary refs log tree commit diff
path: root/tvix/boot/tests
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2024-06-29T15·10+0300
committerflokli <flokli@flokli.de>2024-06-29T19·23+0000
commitffdc96ca594c20de7c2a6089394014f71d2fee8b (patch)
tree768d0367722dc08ea76f37a0c19237c5a3761fd5 /tvix/boot/tests
parentbba64d876215e19fe588c72f168dc4b033581f6e (diff)
feat(tvix/boot/tests): add closure-nixos-s3 r/8330
This uses the `preStart` mechanism to boot up a minio instance, which
we point blob/directoryservice to.

Change-Id: I9e67b19006cb08ce82fe63c885cb0178e97389e1
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11896
Tested-by: BuildkiteCI
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: Connor Brewster <cbrewster@hey.com>
Diffstat (limited to 'tvix/boot/tests')
-rw-r--r--tvix/boot/tests/default.nix20
1 files changed, 20 insertions, 0 deletions
diff --git a/tvix/boot/tests/default.nix b/tvix/boot/tests/default.nix
index fb7d14f8b5cd..31f69d11c83a 100644
--- a/tvix/boot/tests/default.nix
+++ b/tvix/boot/tests/default.nix
@@ -199,6 +199,26 @@ depot.nix.readTree.drvTargets
     assertVMOutput = "Onwards and upwards.";
   });
 
+  closure-nixos-s3 = (mkBootTest {
+    blobServiceAddr = "objectstore+s3://mybucket/blobs?aws_access_key_id=myaccesskey&aws_secret_access_key=supersecret&aws_endpoint_url=http%3A%2F%2Flocalhost%3A9000&aws_allow_http=1";
+    # we cannot use s3 here yet without any caching layer, as we don't allow "deeper" access to directories (non-root nodes)
+    # directoryServiceAddr = "objectstore+s3://mybucket/directories?aws_access_key_id=myaccesskey&aws_secret_access_key=supersecret&endpoint=http%3A%2F%2Flocalhost%3A9000&aws_allow_http=1";
+    directoryServiceAddr = "memory://";
+    pathInfoServiceAddr = "memory://";
+    path = testSystem;
+    useNarBridge = true;
+    preStart = ''
+      MINIO_ACCESS_KEY=myaccesskey MINIO_SECRET_KEY=supersecret MINIO_ADDRESS=127.0.0.1:9000 ${pkgs.minio}/bin/minio server $(mktemp -d) &
+      timeout 22 sh -c 'until ${pkgs.netcat}/bin/nc -z $0 $1; do sleep 1; done' localhost 9000
+      mc_config_dir=$(mktemp -d)
+      ${pkgs.minio-client}/bin/mc --config-dir $mc_config_dir alias set 'myminio' 'http://127.0.0.1:9000' 'myaccesskey' 'supersecret'
+      ${pkgs.minio-client}/bin/mc --config-dir $mc_config_dir mb myminio/mybucket
+    '';
+    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;