Skip to content

Commit 96517d1

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 96517d1

21 files changed

+2696
-337
lines changed

.github/workflows/cln-integration.yml

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,41 @@ jobs:
1313
- name: Checkout repository
1414
uses: actions/checkout@v4
1515

16-
- name: Install dependencies
17-
run: |
18-
sudo apt-get update -y
19-
sudo apt-get install -y socat
16+
- name: Create temporary directory for CLN data
17+
run: echo "CLN_DATA_DIR=$(mktemp -d)" >> $GITHUB_ENV
2018

2119
- name: Start bitcoind, electrs, and lightningd
2220
run: docker compose -p ldk-node -f tests/docker/docker-compose-cln.yml up -d
21+
env:
22+
CLN_DATA_DIR: ${{ env.CLN_DATA_DIR }}
23+
24+
- name: Wait for CLN to be ready
25+
run: |
26+
for i in $(seq 1 30); do
27+
if docker exec ldk-node-cln-1 lightning-cli --regtest getinfo 2>/dev/null | grep -q '"id"'; then
28+
echo "CLN is ready"
29+
break
30+
fi
31+
echo "Waiting for CLN... ($i/30)"
32+
sleep 2
33+
done
34+
docker exec ldk-node-cln-1 lightning-cli --regtest getinfo || {
35+
echo "ERROR: CLN not responding"
36+
docker compose -p ldk-node -f tests/docker/docker-compose-cln.yml logs cln
37+
exit 1
38+
}
2339
24-
- name: Forward lightningd RPC socket
40+
- name: Set permissions for CLN data directory
2541
run: |
26-
docker exec ldk-node-cln-1 sh -c "socat -d -d TCP-LISTEN:9937,fork,reuseaddr UNIX-CONNECT:/root/.lightning/regtest/lightning-rpc&"
27-
socat -d -d UNIX-LISTEN:/tmp/lightning-rpc,reuseaddr,fork TCP:127.0.0.1:9937&
42+
sudo chown -R $(id -u):$(id -g) $CLN_DATA_DIR
43+
sudo chmod 755 $CLN_DATA_DIR
44+
sudo find $CLN_DATA_DIR -type d -exec chmod 755 {} +
45+
sudo find $CLN_DATA_DIR -type f -exec chmod 644 {} +
46+
env:
47+
CLN_DATA_DIR: ${{ env.CLN_DATA_DIR }}
2848

2949
- name: Run CLN integration tests
30-
run: RUSTFLAGS="--cfg cln_test" cargo test --test integration_tests_cln
50+
run: CLN_SOCKET_PATH=$CLN_DATA_DIR/regtest/lightning-rpc
51+
RUSTFLAGS="--cfg cln_test" cargo test --test integration_tests_cln -- --show-output --test-threads=1
52+
env:
53+
CLN_DATA_DIR: ${{ env.CLN_DATA_DIR }}
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: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,24 +33,31 @@ jobs:
3333
fi
3434
3535
- name: Create temporary directory for LND data
36-
id: create-temp-dir
3736
run: echo "LND_DATA_DIR=$(mktemp -d)" >> $GITHUB_ENV
3837

3938
- name: Start bitcoind, electrs, and LND
4039
run: docker compose -p ldk-node -f tests/docker/docker-compose-lnd.yml up -d
4140
env:
4241
LND_DATA_DIR: ${{ env.LND_DATA_DIR }}
4342

44-
- name: Set permissions for LND data directory
45-
# In PR 4622 (https://github.com/lightningnetwork/lnd/pull/4622),
46-
# LND sets file permissions to 0700, preventing test code from accessing them.
47-
# This step ensures the test suite has the necessary permissions.
48-
run: sudo chmod -R 755 $LND_DATA_DIR
43+
- name: Wait for LND macaroon and set permissions
44+
run: |
45+
for i in $(seq 1 30); do
46+
if docker exec ldk-node-lnd test -f /root/.lnd/data/chain/bitcoin/regtest/admin.macaroon 2>/dev/null; then
47+
echo "LND macaroon found"
48+
break
49+
fi
50+
echo "Waiting for LND macaroon... ($i/30)"
51+
sleep 2
52+
done
53+
sudo chmod 755 $LND_DATA_DIR
54+
sudo find $LND_DATA_DIR -type d -exec chmod 755 {} +
55+
sudo find $LND_DATA_DIR -type f -exec chmod 644 {} +
4956
env:
5057
LND_DATA_DIR: ${{ env.LND_DATA_DIR }}
5158

5259
- name: Run LND integration tests
5360
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
61+
RUSTFLAGS="--cfg lnd_test" cargo test --test integration_tests_lnd -- --show-output --test-threads=1
5562
env:
5663
LND_DATA_DIR: ${{ env.LND_DATA_DIR }}

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

0 commit comments

Comments
 (0)