summary refs log tree commit diff
diff options
context:
space:
mode:
authorJacek Galowicz <jacek.galowicz@cyberus-technology.de>2019-11-25 21:58:02 +0100
committerJacek Galowicz <jacek.galowicz@cyberus-technology.de>2019-11-25 22:20:14 +0100
commitda39d2be5a9b34f140bc7bcc48d9d41bde42c54b (patch)
tree18c2b1a5dfd76ffe573cef5902977fe880feceed
parente4abed35be788f7c77e67209c3a68c4b6ce70e71 (diff)
downloadnixpkgs-da39d2be5a9b34f140bc7bcc48d9d41bde42c54b.tar
nixpkgs-da39d2be5a9b34f140bc7bcc48d9d41bde42c54b.tar.gz
nixpkgs-da39d2be5a9b34f140bc7bcc48d9d41bde42c54b.tar.bz2
nixpkgs-da39d2be5a9b34f140bc7bcc48d9d41bde42c54b.tar.lz
nixpkgs-da39d2be5a9b34f140bc7bcc48d9d41bde42c54b.tar.xz
nixpkgs-da39d2be5a9b34f140bc7bcc48d9d41bde42c54b.tar.zst
nixpkgs-da39d2be5a9b34f140bc7bcc48d9d41bde42c54b.zip
nixos/containers-reloadable: Port test to python
-rw-r--r--nixos/tests/containers-reloadable.nix31
1 files changed, 19 insertions, 12 deletions
diff --git a/nixos/tests/containers-reloadable.nix b/nixos/tests/containers-reloadable.nix
index f41dea91b1e..35aff91e85b 100644
--- a/nixos/tests/containers-reloadable.nix
+++ b/nixos/tests/containers-reloadable.nix
@@ -1,7 +1,7 @@
-import ./make-test.nix ({ pkgs, lib, ...} :
+import ./make-test-python.nix ({ pkgs, lib, ...} :
 let
   client_base = {
-    
+
     containers.test1 = {
       autoStart = true;
       config = {
@@ -48,18 +48,25 @@ in {
     c1System = nodes.client_c1.config.system.build.toplevel;
     c2System = nodes.client_c2.config.system.build.toplevel;
   in ''
-    $client->start();
-    $client->waitForUnit("default.target");
-    $client->succeed("[[ \$(nixos-container run test1 cat /etc/check) == client_base ]] >&2");
+    client.start()
+    client.wait_for_unit("default.target")
+
+    assert "client_base" in client.succeed("nixos-container run test1 cat /etc/check")
 
-    $client->succeed("${c1System}/bin/switch-to-configuration test >&2");
-    $client->succeed("[[ \$(nixos-container run test1 cat /etc/check) == client_c1 ]] >&2");
-    $client->succeed("systemctl status httpd -M test1 >&2");
+    with subtest("httpd is available after activating config1"):
+        client.succeed(
+            "${c1System}/bin/switch-to-configuration test >&2",
+            "[[ $(nixos-container run test1 cat /etc/check) == client_c1 ]] >&2",
+            "systemctl status httpd -M test1 >&2",
+        )
 
-    $client->succeed("${c2System}/bin/switch-to-configuration test >&2");
-    $client->succeed("[[ \$(nixos-container run test1 cat /etc/check) == client_c2 ]] >&2");
-    $client->fail("systemctl status httpd -M test1 >&2");
-    $client->succeed("systemctl status nginx -M test1 >&2");
+    with subtest("httpd is not available any longer after switching to config2"):
+        client.succeed(
+            "${c2System}/bin/switch-to-configuration test >&2",
+            "[[ $(nixos-container run test1 cat /etc/check) == client_c2 ]] >&2",
+            "systemctl status nginx -M test1 >&2",
+        )
+        client.fail("systemctl status httpd -M test1 >&2")
   '';
 
 })