diff options
author | Jacek Galowicz <jacek.galowicz@cyberus-technology.de> | 2019-11-25 21:58:02 +0100 |
---|---|---|
committer | Jacek Galowicz <jacek.galowicz@cyberus-technology.de> | 2019-11-25 22:20:14 +0100 |
commit | da39d2be5a9b34f140bc7bcc48d9d41bde42c54b (patch) | |
tree | 18c2b1a5dfd76ffe573cef5902977fe880feceed /nixos/tests | |
parent | e4abed35be788f7c77e67209c3a68c4b6ce70e71 (diff) |
nixos/containers-reloadable: Port test to python
Diffstat (limited to 'nixos/tests')
-rw-r--r-- | nixos/tests/containers-reloadable.nix | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/nixos/tests/containers-reloadable.nix b/nixos/tests/containers-reloadable.nix index f41dea91b1e4..35aff91e85b5 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") ''; }) |