Skip to content

Commit 281e4fd

Browse files
committed
feat(test): add interop test harness for CLN, LND, Eclair
Add a shared interop test framework with: - ExternalNode trait abstracting CLN, LND, and Eclair - Reusable scenario functions (channel lifecycle, payments, disconnect, splice, combo orchestrator with 16 disconnect×payment×close permutations) - Docker Compose and CI workflows for all three implementations - Single-function test pattern matching the original test_cln structure
1 parent eef5142 commit 281e4fd

26 files changed

Lines changed: 2858 additions & 334 deletions

.github/workflows/benchmarks.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
uses: actions/cache@v4
2424
with:
2525
path: bin/bitcoind-${{ runner.os }}-${{ runner.arch }}
26-
key: bitcoind-29.0-${{ runner.os }}-${{ runner.arch }}
26+
key: bitcoind-${{ runner.os }}-${{ runner.arch }}
2727
- name: Enable caching for electrs
2828
id: cache-electrs
2929
uses: actions/cache@v4
@@ -34,7 +34,7 @@ jobs:
3434
if: "(steps.cache-bitcoind.outputs.cache-hit != 'true' || steps.cache-electrs.outputs.cache-hit != 'true')"
3535
run: |
3636
source ./scripts/download_bitcoind_electrs.sh
37-
mkdir -p bin
37+
mkdir bin
3838
mv "$BITCOIND_EXE" bin/bitcoind-${{ runner.os }}-${{ runner.arch }}
3939
mv "$ELECTRS_EXE" bin/electrs-${{ runner.os }}-${{ runner.arch }}
4040
- name: Set bitcoind/electrs environment variables

.github/workflows/cln-integration.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ jobs:
2727
socat -d -d UNIX-LISTEN:/tmp/lightning-rpc,reuseaddr,fork TCP:127.0.0.1:9937&
2828
2929
- name: Run CLN integration tests
30-
run: RUSTFLAGS="--cfg cln_test" cargo test --test integration_tests_cln
30+
run: RUSTFLAGS="--cfg cln_test" cargo test --test integration_tests_cln -- --show-output --test-threads=1
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: CI Checks - Eclair Integration Tests
2+
3+
on: [push, pull_request]
4+
5+
concurrency:
6+
group: ${{ github.workflow }}-${{ github.ref }}
7+
cancel-in-progress: true
8+
9+
jobs:
10+
check-eclair:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v4
15+
16+
- name: Start bitcoind and electrs
17+
run: docker compose -p ldk-node -f tests/docker/docker-compose-eclair.yml up -d bitcoin electrs
18+
19+
- name: Wait for bitcoind to be healthy
20+
run: |
21+
for i in $(seq 1 30); do
22+
if docker compose -p ldk-node -f tests/docker/docker-compose-eclair.yml exec bitcoin bitcoin-cli -regtest -rpcuser=user -rpcpassword=pass getblockchaininfo > /dev/null 2>&1; then
23+
echo "bitcoind is ready"
24+
exit 0
25+
fi
26+
echo "Waiting for bitcoind... ($i/30)"
27+
sleep 2
28+
done
29+
echo "ERROR: bitcoind not ready"
30+
exit 1
31+
32+
- name: Create wallets on bitcoind
33+
run: |
34+
docker compose -p ldk-node -f tests/docker/docker-compose-eclair.yml exec bitcoin bitcoin-cli -regtest -rpcuser=user -rpcpassword=pass createwallet eclair
35+
docker compose -p ldk-node -f tests/docker/docker-compose-eclair.yml exec bitcoin bitcoin-cli -regtest -rpcuser=user -rpcpassword=pass -rpcwallet=eclair getnewaddress
36+
docker compose -p ldk-node -f tests/docker/docker-compose-eclair.yml exec bitcoin bitcoin-cli -regtest -rpcuser=user -rpcpassword=pass createwallet ldk_node_test
37+
38+
- name: Start Eclair
39+
run: docker compose -p ldk-node -f tests/docker/docker-compose-eclair.yml up -d eclair
40+
41+
- name: Wait for Eclair to be ready
42+
run: |
43+
for i in $(seq 1 60); do
44+
if curl -sf -u :eclairpassword -X POST http://127.0.0.1:8080/getinfo > /dev/null 2>&1; then
45+
echo "Eclair is ready"
46+
exit 0
47+
fi
48+
echo "Waiting for Eclair... ($i/60)"
49+
sleep 5
50+
done
51+
echo "Eclair failed to start"
52+
docker compose -p ldk-node -f tests/docker/docker-compose-eclair.yml logs eclair
53+
exit 1
54+
55+
- name: Run Eclair integration tests
56+
run: RUSTFLAGS="--cfg eclair_test" cargo test --test integration_tests_eclair -- --show-output --test-threads=1

.github/workflows/lnd-integration.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,6 @@ jobs:
5151

5252
- name: Run LND integration tests
5353
run: LND_CERT_PATH=$LND_DATA_DIR/tls.cert LND_MACAROON_PATH=$LND_DATA_DIR/data/chain/bitcoin/regtest/admin.macaroon
54-
RUSTFLAGS="--cfg lnd_test" cargo test --test integration_tests_lnd -- --exact --show-output
54+
RUSTFLAGS="--cfg lnd_test" cargo test --test integration_tests_lnd -- --show-output --test-threads=1
5555
env:
5656
LND_DATA_DIR: ${{ env.LND_DATA_DIR }}

.github/workflows/rust.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
uses: actions/cache@v4
5454
with:
5555
path: bin/bitcoind-${{ runner.os }}-${{ runner.arch }}
56-
key: bitcoind-29.0-${{ runner.os }}-${{ runner.arch }}
56+
key: bitcoind-${{ runner.os }}-${{ runner.arch }}
5757
- name: Enable caching for electrs
5858
id: cache-electrs
5959
uses: actions/cache@v4
@@ -64,7 +64,7 @@ jobs:
6464
if: "matrix.platform != 'windows-latest' && (steps.cache-bitcoind.outputs.cache-hit != 'true' || steps.cache-electrs.outputs.cache-hit != 'true')"
6565
run: |
6666
source ./scripts/download_bitcoind_electrs.sh
67-
mkdir -p bin
67+
mkdir bin
6868
mv "$BITCOIND_EXE" bin/bitcoind-${{ runner.os }}-${{ runner.arch }}
6969
mv "$ELECTRS_EXE" bin/electrs-${{ runner.os }}-${{ runner.arch }}
7070
- name: Set bitcoind/electrs environment variables

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ check-cfg = [
125125
"cfg(tokio_unstable)",
126126
"cfg(cln_test)",
127127
"cfg(lnd_test)",
128+
"cfg(eclair_test)",
128129
"cfg(cycle_tests)",
129130
]
130131

docker-compose.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
version: '3'
2-
31
services:
42
bitcoin:
5-
image: blockstream/bitcoind:27.2
3+
image: blockstream/bitcoind:30.2
64
platform: linux/amd64
75
command:
86
[
@@ -14,11 +12,15 @@ services:
1412
"-rpcuser=user",
1513
"-rpcpassword=pass",
1614
"-fallbackfee=0.00001",
17-
"-rest"
15+
"-rest",
16+
"-zmqpubrawblock=tcp://0.0.0.0:28332",
17+
"-zmqpubrawtx=tcp://0.0.0.0:28333"
1818
]
1919
ports:
2020
- "18443:18443" # Regtest REST and RPC port
2121
- "18444:18444" # Regtest P2P port
22+
- "28332:28332" # ZMQ block port
23+
- "28333:28333" # ZMQ tx port
2224
networks:
2325
- bitcoin-electrs
2426
healthcheck:
@@ -41,10 +43,12 @@ services:
4143
"--cookie=user:pass",
4244
"--network=regtest",
4345
"--daemon-rpc-addr=bitcoin:18443",
44-
"--http-addr=0.0.0.0:3002"
46+
"--http-addr=0.0.0.0:3002",
47+
"--electrum-rpc-addr=0.0.0.0:50001"
4548
]
4649
ports:
4750
- "3002:3002"
51+
- "50001:50001"
4852
networks:
4953
- bitcoin-electrs
5054

0 commit comments

Comments
 (0)