Commit Graph

275 Commits

Author SHA1 Message Date
Erik Arvstedt addfa8ec6b
test: support `run`, `debug` commands in basic NixOS tests
Currently, this only affects the basic NixOS test `clightning-replication`.
2023-02-02 10:51:41 +01:00
Erik Arvstedt ae733d887e
tests/clightning-replication: reuse `pkgs` instance
This reduces eval time by 30%.
2023-02-02 10:51:41 +01:00
Erik Arvstedt 6cbd0d93ae
tests: rename `clightningReplication` -> `clightning-replication`
The test name now matches the file name.
2023-02-02 10:51:41 +01:00
Jonas Nick 84fc4d48d3
Merge fort-nix/nix-bitcoin#574: Add dev helper and docs
b4d7e1aa8f add dev helper and docs (Erik Arvstedt)
b35d08d3f2 docs: move test docs from `examples/README` to `test/README` (Erik Arvstedt)
4d76eb9183 docs/configuration: fix typo (Erik Arvstedt)
dc0710f3f4 tests: add example scenario `customTest` (Erik Arvstedt)
9e30d2728b tests: formatting (Erik Arvstedt)
c6d85c6fe3 tests: fix broken unit file when clightning is disabled (Erik Arvstedt)
a51f7b419e run-tests: use arg instead of env var for scenario overrides (Erik Arvstedt)

Pull request description:

ACKs for top commit:
  jonasnick:
    ACK b4d7e1aa8f

Tree-SHA512: f0ed8f8fe326c64eac3b7e9f48597dd00eedb9244333e199d18d1c2c06f369cd015f77aefd48e87235a68aee0b352057249525bf015e0a564fda380bdf7bb9d1
2023-01-18 20:53:24 +00:00
Erik Arvstedt b4d7e1aa8f
add dev helper and docs 2023-01-15 20:28:49 +01:00
Erik Arvstedt b35d08d3f2
docs: move test docs from `examples/README` to `test/README` 2023-01-15 20:28:48 +01:00
Erik Arvstedt dc0710f3f4
tests: add example scenario `customTest` 2023-01-15 20:28:48 +01:00
Jonas Nick aae4b6bfc5
update nixpkgs
btcpayserver: 1.7.1 -> 1.7.2
fulcrum: 1.8.2 -> 1.9.0
nbxplorer: 2.3.49 -> 2.3.54
2023-01-06 22:53:47 +00:00
Erik Arvstedt 9e30d2728b
tests: formatting
Move line next to `services.lnd` config for clarity.
2023-01-06 23:46:43 +01:00
Erik Arvstedt c6d85c6fe3
tests: fix broken unit file when clightning is disabled
Previously, an incomplete clightning unit was always created because
attr `clightning` was always defined in option attrset `systemd.services`.
2023-01-06 23:46:43 +01:00
Erik Arvstedt a51f7b419e
run-tests: use arg instead of env var for scenario overrides
This removes a source of implicit state and guarantees that regular
calls to `run-tests.sh` always run the builtin tests.
2023-01-06 23:46:43 +01:00
Erik Arvstedt 109dccca27
treewide: use `mdDoc` for descriptions
Enable markdown syntax (instead of docbook) for descriptions.
This only affects external doc tooling that renders the descriptions.
2022-12-18 20:01:52 +01:00
Erik Arvstedt 9e456ea3a9
shellcheck-services.nix: update to NixOS 22.11 2022-12-18 20:01:52 +01:00
Erik Arvstedt 77d58162e7
test: update to NixOS 22.11 2022-12-18 20:01:52 +01:00
Jonas Nick 875fac6862
update nixpkgs
btcpayserver: 1.6.12 -> 1.7.1
bitcoind: 24.0 -> 24.0.1
clightning: 0.12.1 -> 22.11.1
lnd: 0.15.4-beta -> 0.15.5-beta
nbxplorer: 2.3.41 -> 2.3.49
2022-12-14 14:48:54 +00:00
Jonas Nick d9fdc49e9a
update nixpkgs
bitcoin: 23.0 -> 24.0
bitcoind: 23.0 -> 24.0
charge-lnd: 0.2.12 -> 0.2.13
2022-11-28 12:54:11 +00:00
Jonas Nick 81350a03c9
Merge fort-nix/nix-bitcoin#570: Update nixpkgs
a333989ca8 update nixpkgs (Jonas Nick)
313e374774 Revert "pkgs: add lnd 0.15.4 (hotfix)" (Jonas Nick)

Pull request description:

ACKs for top commit:
  erikarvstedt:
    ACK a333989ca8

Tree-SHA512: cf9a0c42002f00eadcb6e97211358210c6ab214f467b25af23c70477c40134b3d9a26c7ff00ec15d5a06f2a4bfe9832b11e6ae0faa136249c1180f5ae2e59734
2022-11-10 12:56:47 +00:00
Jonas Nick a333989ca8
update nixpkgs
electrs: 0.9.9 -> 0.9.10
elementsd: 22.0 -> 22.0.2
extra-container: 0.10 -> 0.11
lnd: 0.15.2-beta -> 0.15.4-beta
2022-11-10 11:03:23 +00:00
Erik Arvstedt 0de16095e1
clightning-replication: switch system before waiting for server sshd
This is primarily a cosmetic change.
- Increases code clarity because all system test blocks now start with `switch_to_system`
- Optimizes dependency ordering because `switch_to_system` has no
  dependency on the server sshd
2022-11-04 11:51:44 +01:00
Erik Arvstedt edbaeb9813
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.
2022-11-03 23:08:06 +01:00
Erik Arvstedt 8eaa4cce30
tests: move `mkIfTest` to `nix-bitcoin.lib` 2022-11-03 23:08:06 +01:00
Erik Arvstedt b0dfa69e84
nixos-search/flake: formatting 2022-11-03 23:08:05 +01:00
Erik Arvstedt a12b701e75
tests/container: don't require `services.clightning` to be defined 2022-11-03 23:08:05 +01:00
Erik Arvstedt 450de19803
tests/run-tests.sh: print examples before running
This eases debugging example failures.
2022-11-03 23:08:05 +01:00
Erik Arvstedt 5f1bb2a8fc
tests/copy-src: always copy .git dir
This is required by a later commit that introduces flakes-based test
evaluation. Evaluating local flakes needs a repo dir.
2022-11-03 23:08:05 +01:00
Erik Arvstedt a87a59a86b
make-container.sh: improve root handling
Don't auto-switch to root when executing make-container.sh, because
auto root switching is also implemented in extra-container.

Besides simplifying the code, this is useful for a later commit that
introduces flakes-based container building.
With this change, the container is built under the regular user
instead of root, thereby utilizing the user's regular fetcher and
evaluation caches.
2022-11-03 23:08:05 +01:00
Erik Arvstedt 73d2fbb448
add compatibility with Nix PR #6530 (`Source tree abstraction`)
Avoid adding flake resource paths to the store (via string
interpolation).
This reduces performance and can lead to modules getting imported
twice, once through a local path and once through a store path.

This might not be needed in a future Nix release, in which case we can
revert this.
2022-11-03 23:08:05 +01:00
Erik Arvstedt 3c816b862c
tests/vmWithoutTests: poweroff on shell exit
This allows quitting the VM with Ctrl-D like in the minimal example VM.
2022-11-03 23:08:04 +01:00
Erik Arvstedt 1d3f49f8da
tests, example: avoid lengthy documentation build
This options manual rebuild takes 30-60s and is triggered by the extra
NixOS options defined by nix-bitcoin.
2022-11-03 23:08:04 +01:00
Erik Arvstedt b840548d40
test/shellcheck-services: add configurable source prefix
This allows using this module for services defined outside of nix-bitcoin.
2022-11-03 23:08:04 +01:00
Jonas Nick 7c16fc5865
Merge fort-nix/nix-bitcoin#563: lnd: fix missing RPC permissions when bitcoind is pruned
67949a002a lnd: fix missing RPC permissions when bitcoind is pruned (Erik Arvstedt)
49303be2e0 test/shellcheck-services: fix error by excluding unavailable services (Erik Arvstedt)
46f17fe313 test/shellcheck-services: simplify accessing service definitions (Erik Arvstedt)

Pull request description:

ACKs for top commit:
  jonasnick:
    ACK 67949a002a

Tree-SHA512: 28652d8ec67a164aef068f3df32d1ae8df4e0920cafedc6e3d568b631333b29e57f7370e54a82e7cde9710a3df0a1494ed94272af101d31dd7859a08bb363e4b
2022-10-28 08:38:28 +00:00
Erik Arvstedt 67949a002a
lnd: fix missing RPC permissions when bitcoind is pruned 2022-10-25 22:56:51 +02:00
Erik Arvstedt 49303be2e0
test/shellcheck-services: fix error by excluding unavailable services 2022-10-25 22:36:30 +02:00
Erik Arvstedt 46f17fe313
test/shellcheck-services: simplify accessing service definitions
This also improves performance by removing the extra module evaluation.
2022-10-25 22:36:30 +02:00
Erik Arvstedt 277510c7ee
tests: run flake-info in sandbox
Don't use sandboxing in Cirrus CI where namespace support is missing.
2022-10-25 22:04:17 +02:00
Erik Arvstedt d3b7e8c432
revert "tests: disable `nixosSearch`" 2022-09-23 09:04:57 +02:00
Jonas Nick 261f7a043f
update nixpkgs
electrs: 0.9.7 -> 0.9.9
elementsd: 0.21.0.2 -> 22.0
fulcrum: 1.7.0 -> 1.8.1
2022-09-22 16:57:19 +00:00
Erik Arvstedt c3b97e6728
tests: add `shellcheckServices` 2022-09-12 21:00:00 +02:00
Otto Sabart ee15837244
shellcheck: prevent globbing and word splitting in unit shell scripts 2022-09-12 21:00:00 +02:00
Jonas Nick 4e63301ac3
Merge fort-nix/nix-bitcoin#546: Update nixpkgs
63f8b74026 pyln-client: add patch that fixes plugins (Jonas Nick)
5255c7e8bc pyln-client: remove pkg patch that has become unnecessary (Jonas Nick)
c165836fd1 bitcoind: add "getdeploymentinfo" to public rpc whitelist (Jonas Nick)
623c238b16 clightning-plugins: remove commando pkg and module (Jonas Nick)
33144262ec clightning-plugins: bump ver of pyln-client required by prometheus (Jonas Nick)
9c766df16a Revert "clightning: fix build" (Jonas Nick)
b57e7466fb update nixpkgs (Jonas Nick)

Pull request description:

ACKs for top commit:
  erikarvstedt:
    ACK 63f8b74026

Tree-SHA512: 699ce5179ee202218933424ac3fe746a405700daccad78109d8118013cba6d64d40b07a87430281cbde96438250a05b03be0e44ebb69d85e2d41ec3ae57d6c7e
2022-09-07 09:42:43 +00:00
Erik Arvstedt 49e30f7172
test/lib/create-git-repo: fix empty var expansion
When `amend` is empty, expand it to nothing instead of an empty
string (which causes a git error).
2022-09-07 11:02:15 +02:00
Jonas Nick 623c238b16
clightning-plugins: remove commando pkg and module
clightning 0.12.0 ships with a reimplementation of the commando plugin that is
incompatible with the commando module that existed in nix-bitcoin.
2022-09-07 08:44:52 +00:00
Jonas Nick b57e7466fb
update nixpkgs
btcpayserver: 1.6.9 -> 1.6.10
lnd: 0.15.0-beta -> 0.15.1-beta
2022-09-07 08:44:47 +00:00
Erik Arvstedt c63da4734e
tests: disable `nixosSearch` 2022-09-05 21:11:15 +02:00
Erik Arvstedt 67a573dae8
create-git-repo.sh: fix amend error if there's no branch checked out
In this case, `git commit --amend` fails.

The state of a .git repo existing without a branch being checked out
can be reached through the following sequence of events (which I just
seem to have triggered):
1. The script calls `git init`
2. The user interrupts the script before `git commit` is finished
2022-08-29 00:12:19 +02:00
Erik Arvstedt d9eecb7d4c
nixos-search/flake: remove unused output 2022-08-29 00:12:19 +02:00
Erik Arvstedt af115d746b
internal scripts: use pinned, cached pkgs
Instead of setting up the script PATH via nix-shell, use
`nix shell` with inputs from the nix-bitcoin flake.
Advantages:
- Uses the nixpkgs version from the nix-bitcoin flake instead of
  `<nixpkgs>` from the user env (NIX_PATH), so the script runtime
  env is reproducible.
- The pkg derivations for the runtime env are cached, which greatly
  increases script startup speed.

This commit was generated by running the following script inside the
repo root dir:

def transform(path, src)
  if src =~ /#! *nix-shell +-i +bash +-p +(.*)/
    pkgs = $1
    if src =~ /^.*?(set -e.*?pipefail)\n/
      set_statement = $1
      src.sub!($&, '')
    end
    src.sub!(/\A.*?#! *nix-shell.*?\n/m, '')

    parents = ([ '..' ] * (path.split('/').count - 1)).join('/')

    [
      '#!/usr/bin/env bash',
      *set_statement,
      %(. "${BASH_SOURCE[0]%/*}/#{parents}/helper/run-in-nix-env" "#{pkgs}" "$@"),
      nil,
      src
    ].join("\n")
  end
end

Dir['**/*.sh'].each do |f|
  src = File.read(f)
  if new_src = transform(f, src)
    puts "Changed file #{f}"
    File.write(f, new_src)
  end
end
2022-08-28 23:49:12 +02:00
Otto Sabart f184bb34e6
shellcheck: fix lint of scripts in tests 2022-08-28 18:25:37 +02:00
Otto Sabart 9a92d29111
tests: add shellcheck 2022-08-28 18:25:37 +02:00
Erik Arvstedt b625325487
ci/modules_test: use flake-enabled nix 2022-08-28 18:25:37 +02:00