test: simplify scenario handling

We can switch to a more sophisticated scheme later when adding more scenarios
This commit is contained in:
Erik Arvstedt 2020-08-21 22:36:10 +02:00
parent 0f56ea6ad1
commit 9b4cd7bd1c
No known key found for this signature in database
GPG Key ID: 33312B944DD97846

View File

@ -2,11 +2,6 @@
{ scenario ? "default" }:
let
netns-isolation = builtins.getAttr scenario { default = false; withnetns = true; };
testScriptFilename = builtins.getAttr scenario { default = ./scenarios/default.py; withnetns = ./scenarios/withnetns.py; };
in
import ./make-test.nix rec {
name = "nix-bitcoin-${scenario}";
@ -23,7 +18,7 @@ import ./make-test.nix rec {
# hardened
];
nix-bitcoin.netns-isolation.enable = mkForce netns-isolation;
nix-bitcoin.netns-isolation.enable = (scenario == "withnetns");
services.bitcoind.extraConfig = mkForce "connect=0";
@ -61,5 +56,7 @@ import ./make-test.nix rec {
install -o nobody -g nogroup -m777 <(:) /secrets/dummy
'';
};
testScript = builtins.readFile ./scenarios/lib.py + "\n\n" + builtins.readFile testScriptFilename;
testScript =
builtins.readFile ./scenarios/lib.py + "\n\n" +
builtins.readFile "${./.}/scenarios/${scenario}.py";
}