test: improve modularization

This improves debugging and experimenting by making it easy to compose fine-grained
scenarios that have specific tests and features enabled.

The VM test output now includes the subtest name and duration.

Remove the 'raise Exception()' hack for interactive mode.

Run 'banlist-and-restart' test before 'backups'. This speeds up the test
by avoiding an extra shutdown of all bitcoin-related services.
This commit is contained in:
Erik Arvstedt 2020-09-27 12:43:20 +02:00
parent 14d2d97ba6
commit 1e18d3ea3b
No known key found for this signature in database
GPG key ID: 33312B944DD97846
8 changed files with 385 additions and 181 deletions

30
test/lib/test-lib.nix Normal file
View file

@ -0,0 +1,30 @@
{ config, lib, ... }:
with lib;
{
options = {
test = {
noConnections = mkOption {
type = types.bool;
default = true;
description = ''
Whether services should be configured to not connect to external hosts.
This can silence some warnings while running the test in an offline environment.
'';
};
data = mkOption {
type = types.attrs;
default = {};
description = ''
Attrs that are available in the Python test script under the global
dictionary variable 'test_data'. The data is exported via JSON.
'';
};
};
tests = mkOption {
type = with types; attrsOf bool;
default = {};
description = "Python tests that should be run.";
};
};
}