diff options
author | Danylo Hlynskyi <abcz2.uprola@gmail.com> | 2020-02-22 21:26:04 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-22 21:26:04 +0200 |
commit | 9336b084ae5344555b02edac36837bda873f02cf (patch) | |
tree | e7b2ba2c9945604f057ec7d540138b98873364bc /nixos | |
parent | bd91cacadf82b517c082e2a034ca90dd7b9fcd29 (diff) | |
parent | 31bbcc21d38366489120341bb74438cd38f4bf40 (diff) | |
download | nixlib-9336b084ae5344555b02edac36837bda873f02cf.tar nixlib-9336b084ae5344555b02edac36837bda873f02cf.tar.gz nixlib-9336b084ae5344555b02edac36837bda873f02cf.tar.bz2 nixlib-9336b084ae5344555b02edac36837bda873f02cf.tar.lz nixlib-9336b084ae5344555b02edac36837bda873f02cf.tar.xz nixlib-9336b084ae5344555b02edac36837bda873f02cf.tar.zst nixlib-9336b084ae5344555b02edac36837bda873f02cf.zip |
Merge pull request #79736 from Ma27/minor-imperative-container-fixes
nixos-container: minor fixes
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/tests/containers-imperative.nix | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/nixos/tests/containers-imperative.nix b/nixos/tests/containers-imperative.nix index 61df74042cb3..c4f2002918fc 100644 --- a/nixos/tests/containers-imperative.nix +++ b/nixos/tests/containers-imperative.nix @@ -46,6 +46,15 @@ import ./make-test-python.nix ({ pkgs, ...} : { }; } ''; + brokenCfg = pkgs.writeText "broken.nix" '' + { + assertions = [ + { assertion = false; + message = "I never evaluate"; + } + ]; + } + ''; in '' with subtest("Make sure we have a NixOS tree (required by ‘nixos-container create’)"): machine.succeed("PAGER=cat nix-env -qa -A nixos.hello >&2") @@ -130,5 +139,11 @@ import ./make-test-python.nix ({ pkgs, ...} : { with subtest("Ensure that the container path is gone"): print(machine.succeed("ls -lsa /var/lib/containers")) machine.succeed(f"test ! -e /var/lib/containers/{id1}") + + with subtest("Ensure that a failed container creation doesn'leave any state"): + machine.fail( + "nixos-container create b0rk --config-file ${brokenCfg}" + ) + machine.succeed(f"test ! -e /var/lib/containers/b0rk") ''; }) |