Skip to content

Commit 54fc858

Browse files
committed
feat(test): add interop test harness for CLN, LND, Eclair
Bump test dependencies, reorganize Docker files, and add interop integration test infrastructure with shared scenario runner for CLN, LND, and Eclair.
1 parent 253dc13 commit 54fc858

27 files changed

+2818
-365
lines changed

.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-${{ runner.os }}-${{ runner.arch }}
26+
key: bitcoind-29.0-${{ 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 bin
37+
mkdir -p 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: 32 additions & 9 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
22-
run: docker compose -f docker-compose-cln.yml up -d
20+
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: 15 additions & 8 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
40-
run: docker compose -f docker-compose-lnd.yml up -d
39+
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:

.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-${{ runner.os }}-${{ runner.arch }}
56+
key: bitcoind-29.0-${{ 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 bin
67+
mkdir -p 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: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,24 +87,25 @@ 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"] }
9394
ldk-node-062 = { package = "ldk-node", version = "=0.6.2" }
9495
ldk-node-070 = { package = "ldk-node", version = "=0.7.0" }
9596

9697
[target.'cfg(not(no_download))'.dev-dependencies]
97-
electrsd = { version = "0.36.1", default-features = false, features = ["legacy", "esplora_a33e97e1", "corepc-node_27_2"] }
98+
electrsd = { version = "0.36.1", default-features = false, features = ["legacy", "esplora_a33e97e1", "corepc-node_29_0"] }
9899

99100
[target.'cfg(no_download)'.dev-dependencies]
100101
electrsd = { version = "0.36.1", default-features = false, features = ["legacy"] }
101-
corepc-node = { version = "0.10.0", default-features = false, features = ["27_2"] }
102+
corepc-node = { version = "0.10.1", default-features = false, features = ["29_0"] }
102103

103104
[target.'cfg(cln_test)'.dev-dependencies]
104105
clightningrpc = { version = "0.3.0-beta.8", default-features = false }
105106

106107
[target.'cfg(lnd_test)'.dev-dependencies]
107-
lnd_grpc_rust = { version = "2.10.0", default-features = false }
108+
lnd_grpc_rust = { version = "2.14.0", default-features = false }
108109
tokio = { version = "1.37", features = ["fs"] }
109110

110111
[build-dependencies]
@@ -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

scripts/download_bitcoind_electrs.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@ HOST_PLATFORM="$(rustc --version --verbose | grep "host:" | awk '{ print $2 }')"
1010
ELECTRS_DL_ENDPOINT="https://github.com/RCasatta/electrsd/releases/download/electrs_releases"
1111
ELECTRS_VERSION="esplora_a33e97e1a1fc63fa9c20a116bb92579bbf43b254"
1212
BITCOIND_DL_ENDPOINT="https://bitcoincore.org/bin/"
13-
BITCOIND_VERSION="27.2"
13+
BITCOIND_VERSION="29.0"
1414
if [[ "$HOST_PLATFORM" == *linux* ]]; then
1515
ELECTRS_DL_FILE_NAME=electrs_linux_"$ELECTRS_VERSION".zip
1616
ELECTRS_DL_HASH="865e26a96e8df77df01d96f2f569dcf9622fc87a8d99a9b8fe30861a4db9ddf1"
1717
BITCOIND_DL_FILE_NAME=bitcoin-"$BITCOIND_VERSION"-x86_64-linux-gnu.tar.gz
18-
BITCOIND_DL_HASH="acc223af46c178064c132b235392476f66d486453ddbd6bca6f1f8411547da78"
18+
BITCOIND_DL_HASH="a681e4f6ce524c338a105f214613605bac6c33d58c31dc5135bbc02bc458bb6c"
1919
elif [[ "$HOST_PLATFORM" == *darwin* ]]; then
2020
ELECTRS_DL_FILE_NAME=electrs_macos_"$ELECTRS_VERSION".zip
2121
ELECTRS_DL_HASH="2d5ff149e8a2482d3658e9b386830dfc40c8fbd7c175ca7cbac58240a9505bcd"
2222
BITCOIND_DL_FILE_NAME=bitcoin-"$BITCOIND_VERSION"-x86_64-apple-darwin.tar.gz
23-
BITCOIND_DL_HASH="6ebc56ca1397615d5a6df2b5cf6727b768e3dcac320c2d5c2f321dcaabc7efa2"
23+
BITCOIND_DL_HASH="5bb824fc86a15318d6a83a1b821ff4cd4b3d3d0e1ec3d162b805ccf7cae6fca8"
2424
else
2525
printf "\n\n"
2626
echo "Unsupported platform: $HOST_PLATFORM Exiting.."

0 commit comments

Comments
 (0)