tests: define tests via flake

Advantages:
- Pure test evaluations
- The test framework can now be used by flakes that extend nix-bitcoin
- Most features of `run-tests.sh` are now accessible via `nix build`/`nix run`.
  We keep `run-tests.sh` for advanced features like `scenarioOverridesFile` and adhoc scenarios.

Other changes:
- `run-tests.sh` now builds aggregate VM tests like `basic` or
  `buildable` by creating all VMs in a single evaluation.
  This speeds up the tests and eases debugging by separating the eval and build steps.
- Use the new `nix` CLI which has improved build output logging
  by prefixing output lines with the origin drv name.
This commit is contained in:
Erik Arvstedt 2022-10-22 19:37:58 +02:00
parent 90e942e5ae
commit edbaeb9813
No known key found for this signature in database
GPG key ID: 33312B944DD97846
12 changed files with 451 additions and 277 deletions

View file

@ -1,12 +1,9 @@
# You can run this test via `run-tests.sh -s clightningReplication`
let
nixpkgs = (import ../pkgs/nixpkgs-pinned.nix).nixpkgs;
in
import "${nixpkgs}/nixos/tests/make-test-python.nix" ({ pkgs, ... }:
makeTestVM: pkgs:
with pkgs.lib;
let
keyDir = nixpkgs + "/nixos/tests/initrd-network-ssh";
keyDir = pkgs.path + "/nixos/tests/initrd-network-ssh";
keys = {
server = keyDir + "/ssh_host_ed25519_key";
client = keyDir + "/id_ed25519";
@ -29,7 +26,7 @@ let
};
};
in
{
makeTestVM {
name = "clightning-replication";
nodes = let nodes = {
@ -150,4 +147,4 @@ in
# A gocryptfs has been created on the server
server.succeed("ls /var/backup/nb-replication/writable/lightningd-db/gocryptfs.conf")
'';
})
}