diff options
author | Bruno Bzeznik <Bruno.Bzeznik@imag.fr> | 2020-08-25 09:44:27 +0200 |
---|---|---|
committer | Daniƫl de Kok <me@danieldk.eu> | 2020-08-28 14:39:21 +0200 |
commit | 1601ff7dd4941e8cd5b4b5429820daa4d32f36f2 (patch) | |
tree | 27722753f19b0ebfa5370dd26d825d414e8fdde7 /nixos/tests/charliecloud.nix | |
parent | 46f277b3f2b2410368f9f9000932d9af8ddf37ce (diff) |
charliecloud: 0.12 -> 0.18 (docker + ch-grow support)
Diffstat (limited to 'nixos/tests/charliecloud.nix')
-rw-r--r-- | nixos/tests/charliecloud.nix | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/nixos/tests/charliecloud.nix b/nixos/tests/charliecloud.nix new file mode 100644 index 000000000000..acba41e228a6 --- /dev/null +++ b/nixos/tests/charliecloud.nix @@ -0,0 +1,43 @@ +# This test checks charliecloud image construction and run + +import ./make-test-python.nix ({ pkgs, ...} : let + + dockerfile = pkgs.writeText "Dockerfile" '' + FROM nix + RUN mkdir /home /tmp + RUN touch /etc/passwd /etc/group + CMD ["true"] + ''; + +in { + name = "charliecloud"; + meta = with pkgs.stdenv.lib.maintainers; { + maintainers = [ bzizou ]; + }; + + nodes = { + host = { ... }: { + environment.systemPackages = [ pkgs.charliecloud ]; + virtualisation.docker.enable = true; + users.users.alice = { + isNormalUser = true; + extraGroups = [ "docker" ]; + }; + }; + }; + + testScript = '' + host.start() + host.wait_for_unit("docker.service") + host.succeed( + 'su - alice -c "docker load --input=${pkgs.dockerTools.examples.nix}"' + ) + host.succeed( + "cp ${dockerfile} /home/alice/Dockerfile" + ) + host.succeed('su - alice -c "ch-build -t hello ."') + host.succeed('su - alice -c "ch-builder2tar hello /var/tmp"') + host.succeed('su - alice -c "ch-tar2dir /var/tmp/hello.tar.gz /var/tmp"') + host.succeed('su - alice -c "ch-run /var/tmp/hello -- echo Running_From_Container_OK"') + ''; +}) |