Skip to content

Commit

Permalink
Small test improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
roberth committed Jun 2, 2019
1 parent 1308b72 commit 894cb28
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions tests/arion-test/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@ in
machine = { pkgs, lib, ... }: {
environment.systemPackages = [
pkgs.arion
pkgs.docker-compose
];
virtualisation.docker.enable = true;

# no caches, because no internet
# no caches, because the test cannot access the internet
nix.binaryCaches = lib.mkForce [];

# FIXME: Sandbox seems broken with current version of NixOS test
Expand All @@ -29,14 +28,14 @@ in

virtualisation.writableStore = true;
virtualisation.pathsInNixDB = [
# Pre-build the image because we don't want to build the world
# in the vm.
# Pre-build the image because we don't want to build the world in the vm.
(preEval [ ../../examples/minimal/arion-compose.nix ]).config.build.dockerComposeYaml
(preEval [ ../../examples/full-nixos/arion-compose.nix ]).config.build.dockerComposeYaml
(preEval [ ../../examples/nixos-unit/arion-compose.nix ]).config.build.dockerComposeYaml
(preEval [ ../testcases/secrets/arion-compose.nix ]).config.build.dockerComposeYaml
pkgs.stdenv
];
virtualisation.memorySize = 4096; #MB
};
testScript = ''
$machine->fail("curl localhost:8000");
Expand All @@ -45,7 +44,7 @@ in
subtest "minimal", sub {
$machine->succeed("cp -r ${../../examples/minimal} work && cd work && NIX_PATH=nixpkgs='${pkgs.path}' arion up -d");
$machine->waitUntilSucceeds("curl localhost:8000");
$machine->succeed("cd work && NIX_PATH=nixpkgs='${pkgs.path}' arion down && rm -rf work");
$machine->succeed("(cd work && NIX_PATH=nixpkgs='${pkgs.path}' arion down) && rm -rf work");
$machine->waitUntilFails("curl localhost:8000");
};
Expand All @@ -54,14 +53,14 @@ in
$machine->waitUntilSucceeds("curl localhost:8000");
# Also test exec with defaultExec
$machine->succeed("cd work && export NIX_PATH=nixpkgs='${pkgs.path}' && (echo 'nix run -f ~/h/arion arion -c arion exec webserver'; echo 'target=world; echo Hello \$target'; echo exit) | script /dev/null | grep 'Hello world'");
$machine->succeed("cd work && NIX_PATH=nixpkgs='${pkgs.path}' arion down && rm -rf work");
$machine->succeed("(cd work && NIX_PATH=nixpkgs='${pkgs.path}' arion down) && rm -rf work");
$machine->waitUntilFails("curl localhost:8000");
};
subtest "nixos-unit", sub {
$machine->succeed("cp -r ${../../examples/nixos-unit} work && cd work && NIX_PATH=nixpkgs='${pkgs.path}' arion up -d");
$machine->waitUntilSucceeds("curl localhost:8000");
$machine->succeed("cd work && NIX_PATH=nixpkgs='${pkgs.path}' arion down && rm -rf work");
$machine->succeed("(cd work && NIX_PATH=nixpkgs='${pkgs.path}' arion down) && rm -rf work");
$machine->waitUntilFails("curl localhost:8000");
};
Expand Down

0 comments on commit 894cb28

Please sign in to comment.