Skip to content

Commit 1bc1de3

Browse files
committed
feat(test): add interop test harness for CLN, LND, Eclair
- ExternalNode trait + implementations for CLN, LND, Eclair - Shared scenario suite: channel lifecycle, payments (BOLT11/keysend), disconnect/reconnect, force close, fee changes - 32 combo permutations (phase × disconnect × close × pay type) - Panic recovery per scenario: failures collected, not blocking - Move docker-compose.yml to tests/docker/ - Un-ignore CLN splice and keysend tests for CI verification
1 parent ee6c997 commit 1bc1de3

24 files changed

+2802
-359
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/kotlin.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
run: ./scripts/uniffi_bindgen_generate_kotlin_android.sh
4848

4949
- name: Start bitcoind and electrs
50-
run: docker compose up -d
50+
run: docker compose -p ldk-node -f tests/docker/docker-compose.yml up -d
5151

5252
- name: Run ldk-node-jvm tests
5353
run: |

.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 }}

.github/workflows/python.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
run: ./scripts/uniffi_bindgen_generate_python.sh
2525

2626
- name: Start bitcoind and electrs
27-
run: docker compose up -d
27+
run: docker compose -p ldk-node -f tests/docker/docker-compose.yml up -d
2828

2929
- name: Run Python unit tests
3030
env:

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ winapi = { version = "0.3", features = ["winbase"] }
8787
[dev-dependencies]
8888
lightning = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "dcf0c203e166da2348bef12b2e5eff4a250cdec7", features = ["std", "_test_utils"] }
8989
rand = { version = "0.9.2", default-features = false, features = ["std", "thread_rng", "os_rng"] }
90+
futures = "0.3"
9091
proptest = "1.0.0"
9192
regex = "1.5.6"
9293
criterion = { version = "0.7.0", features = ["async_tokio"] }
@@ -125,6 +126,7 @@ check-cfg = [
125126
"cfg(tokio_unstable)",
126127
"cfg(cln_test)",
127128
"cfg(lnd_test)",
129+
"cfg(eclair_test)",
128130
"cfg(cycle_tests)",
129131
]
130132

0 commit comments

Comments
 (0)