about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPicnoir <picnoir@alternativebit.fr>2024-03-19T13·35+0100
committerpicnoir picnoir <picnoir@alternativebit.fr>2024-03-19T16·51+0000
commit498beb54da3dabf06d215b2db76ce0ddef332b69 (patch)
treeeb57845035908731ad09ece289193fcf8f40a7a0
parent29b5ffbda042650640ac6d8b23b20fb44897ed62 (diff)
feat(users/picnoir/tvix-daemon) add small VM integration test r/7743
Adding a VM integration test setup for tvix-daemon. This test acts as
our first milestone: implementing enough daemon operations to be able
to add a new store path to tvix-store.

The test is expected to fail for now. We don't want to run it on CI
yet.

Change-Id: I2bd8eb9a07c5de2ef91099e10fcac23c087b880b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11199
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
-rw-r--r--users/picnoir/tvix-daemon/vm-test/README.md5
-rw-r--r--users/picnoir/tvix-daemon/vm-test/default.nix28
2 files changed, 33 insertions, 0 deletions
diff --git a/users/picnoir/tvix-daemon/vm-test/README.md b/users/picnoir/tvix-daemon/vm-test/README.md
new file mode 100644
index 000000000000..bd7f14f7ef25
--- /dev/null
+++ b/users/picnoir/tvix-daemon/vm-test/README.md
@@ -0,0 +1,5 @@
+# Integration VM Test
+
+This VM test fails for now. We use it to conveniently test our implementation on a real world Nix setup.
+
+For now, it only adds a new path to the store. It'll likely do more in the future.
diff --git a/users/picnoir/tvix-daemon/vm-test/default.nix b/users/picnoir/tvix-daemon/vm-test/default.nix
new file mode 100644
index 000000000000..e70690ee02c5
--- /dev/null
+++ b/users/picnoir/tvix-daemon/vm-test/default.nix
@@ -0,0 +1,28 @@
+{ depot, pkgs, lib, ... }:
+
+let
+  nixosTestDrv = pkgs.nixosTest {
+    name = "tvix-daemon-vm-test";
+    nodes.machine = { config, pkgs, ... }: {
+      environment.systemPackages = [
+        (pkgs.writers.writeBashBin "poke-daemon" ''
+          NIX_REMOTE=unix:///nix/var/nix/daemon-socket/socket nix-instantiate -E '"''${/etc/nscd.conf}"'
+        '')
+      ];
+      systemd.services.nix-daemon.serviceConfig.ExecStart = [
+        ""
+        "${depot.users.picnoir.tvix-daemon.tvix-daemon}/bin/tvix-daemon"
+      ];
+
+    };
+    testScript = ''
+      machine.wait_for_unit("multi-user.target")
+      machine.succeed("poke-daemon")
+    '';
+  };
+in
+nixosTestDrv // {
+  # The test fails for now. TOREMOVE when we reach the stage where we
+  # can add stuff to the store.
+  meta.ci.skip = true;
+}