From ffdc96ca594c20de7c2a6089394014f71d2fee8b Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Sat, 29 Jun 2024 18:10:31 +0300 Subject: feat(tvix/boot/tests): add closure-nixos-s3 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 Reviewed-by: Connor Brewster --- tvix/boot/tests/default.nix | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'tvix/boot') 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; -- cgit 1.4.1