Erik Arvstedt de4bd2fb6f update nixpkgs
fulcrum: 1.9.0 -> 1.9.1
lightning-loop: 0.20.0-beta -> 0.23.0-beta
lnd: 0.15.5-beta -> 0.16.2-beta
2023-06-01 02:56:23 -07:00
ci tests: define tests via flake 2023-06-01 02:56:22 -07:00
lib test: support `run`, `debug` commands in basic NixOS tests 2023-06-01 02:56:22 -07:00
nixos-search update nixpkgs 2023-06-01 02:56:23 -07:00 docs: move test docs from `examples/README` to `test/README` 2023-06-01 02:56:22 -07:00
clightning-replication.nix tests/clightning-replication: reuse `pkgs` instance 2023-06-01 02:56:22 -07:00 add `presets/wireguard.nix` 2023-06-01 02:56:23 -07:00 tests: add `shellcheckServices` 2022-09-12 21:00:00 +02:00
tests.nix tests: add tests for trustedcoin clightning plugin 2023-06-01 02:56:23 -07:00 tests: add tests for trustedcoin clightning plugin 2023-06-01 02:56:23 -07:00
wireguard-lndconnect.nix add `presets/wireguard.nix` 2023-06-01 02:56:23 -07:00

The command is most convenient and versatile way to run tests.
It leave no traces (outside of /nix/store) on the host system. requires Nix >= 2.10.


./ [--scenario|-s <scenario>] [build|vm|debug|container]

See the top of for a complete documentation.
Test scenarios are defined in tests.nix and


Running tests

# Run the basic set of tests. These tests are also run on the GitHub CI server.

# Run the test for scenario `regtest`.
# The test is run via the Nix build system. Successful runs are cached.
./ -s regtest build
./ -s regtest # Shorthand, equivalent

# To test a single service, use its name as a scenario.
./ -s clightning

# When no scenario is specified, scenario `default` is used.
./ build


# Start a shell is inside a test VM. No tests are executed.
./ -s bitcoind vm
systemctl status bitcoind

# Run a Python NixOS test shell inside a VM.
# See for available commands.
./ debug
print(succeed("systemctl status bitcoind"))

# Start a shell in a container node. Requires systemd and root privileges.
./ container

# In the container shell: Run command in container (with prefix `c`)
c systemctl status bitcoind

# Explore a single feature
./ -s electrs container

# Run a command in a container.
# The container is deleted afterwards.
./ -s clightning container --run c lightning-cli getinfo

# Define a custom scenario
./ --scenario '{
  services.clightning.enable = true;
  nix-bitcoin.nodeinfo.enable = true;
}' container --run c nodeinfo

Running tests with Flakes

Tests can also be accessed via the nix-bitcoin flake:

# Build test
nix build --no-link ..#tests.default

# Run a node in a VM. No tests are executed.
nix run ..#tests.default.vm

# Run a Python test shell inside a VM node
nix run -- --debug

# Run a node in a container. Requires extra-container, systemd and root privileges
nix run ..#tests.default.container
nix run ..#tests.default.containerLegacy # For NixOS with `system.stateVersion` <22.05

# Run a command in a container
nix run ..#tests.default.container -- --run c nodeinfo
nix run ..#tests.default.containerLegacy -- --run c nodeinfo # For NixOS with `system.stateVersion` <22.05