Skip to content
This repository was archived by the owner on Feb 8, 2026. It is now read-only.

Commit 9790748

Browse files
committed
test: e2e lightning
1 parent 0afb116 commit 9790748

18 files changed

Lines changed: 594 additions & 25 deletions

.github/workflows/e2e-ios.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on: pull_request
44

55
env:
66
NO_FLIPPER: 1
7+
E2E_TESTS: 1 # build without transform-remove-console babel plugin
78

89
jobs:
910
e2e:
@@ -38,7 +39,7 @@ jobs:
3839
run: HOMEBREW_NO_AUTO_UPDATE=1 brew tap wix/brew && brew install applesimutils
3940

4041
- name: Run regtest setup
41-
run: cd __tests__ && docker-compose up -d
42+
run: cd __tests__ && mkdir lnd && chmod 777 lnd && docker-compose up -d
4243

4344
- name: Wait for bitcoind
4445
timeout-minutes: 2

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ android/app/pepk.jar
9090
# tests
9191
coverage/
9292
__tests__/bitcoin_datadir/
93+
__tests__/lnd/
94+
artifacts/
9395

9496
#Build
9597
android/app/release/

__tests__/btc-fee-estimates.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"fee_by_block_target": {
3+
"1": 300,
4+
"2": 200,
5+
"3": 100
6+
}
7+
}

__tests__/docker-compose.yml

Lines changed: 77 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
version: '3'
22
services:
33
bitcoind:
4-
image: btcpayserver/bitcoin:24.0.1
4+
image: btcpayserver/bitcoin:25.0
55
restart: unless-stopped
66
expose:
77
- '43782'
88
- '39388'
99
ports:
1010
- '43782:43782'
1111
- '39388:39388'
12+
volumes:
13+
- 'bitcoin_home:/home/bitcoin/.bitcoin'
1214
environment:
1315
BITCOIN_NETWORK: ${NBITCOIN_NETWORK:-regtest}
1416
CREATE_WALLET: 'true'
@@ -20,9 +22,28 @@ services:
2022
port=39388
2123
whitelist=0.0.0.0/0
2224
maxmempool=500
23-
rpcauth=electrumx:7d8ee47c089e6072635f82b34796e878$$13649d99453ccdf78e85007286422599c00e6953289f41bf8e92961076ba14db
25+
rpcauth=polaruser:5e5e98c21f5c814568f8b55d83b23c1c$$066b03f92df30b11de8e4b1b1cd5b1b4281aa25205bd57df9be82caf97a05526
2426
txindex=1
2527
fallbackfee=0.00001
28+
zmqpubrawblock=tcp://0.0.0.0:28334
29+
zmqpubrawtx=tcp://0.0.0.0:28335
30+
zmqpubhashblock=tcp://0.0.0.0:28336
31+
32+
bitcoinsetup:
33+
image: btcpayserver/bitcoin:25.0
34+
depends_on:
35+
- bitcoind
36+
restart: 'no'
37+
volumes:
38+
- 'bitcoin_home:/home/bitcoin/.bitcoin'
39+
user: bitcoin
40+
# generate one block so electrs stop complaining
41+
entrypoint:
42+
[
43+
'bash',
44+
'-c',
45+
'sleep 1; while ! bitcoin-cli -rpcconnect=bitcoind -generate 1; do sleep 1; done',
46+
]
2647

2748
electrs:
2849
image: getumbrel/electrs:v0.9.10
@@ -31,21 +52,71 @@ services:
3152
- bitcoind
3253
expose:
3354
- '60001'
55+
- '28334'
56+
- '28335'
57+
- '28336'
3458
ports:
3559
- '60001:60001'
60+
# - '28334:28334'
61+
# - '28335:28335'
62+
# - '28336:28336'
3663
volumes:
3764
- './electrs.toml:/data/electrs.toml'
38-
- 'electrs_datadir:/data'
3965
environment:
4066
- ELECTRS_NETWORK=regtest
4167
- ELECTRS_ELECTRUM_RPC_ADDR=electrs:60001
4268
- ELECTRS_DAEMON_RPC_ADDR=bitcoind:43782
4369
- ELECTRS_DAEMON_P2P_ADDR=bitcoind:39388
4470
- ELECTRS_LOG_FILTERS=INFO
4571

72+
darkhttpd:
73+
image: p3terx/darkhttpd:1.14
74+
restart: unless-stopped
75+
depends_on:
76+
- bitcoinsetup
77+
expose:
78+
- '80'
79+
ports:
80+
- '80:80'
81+
volumes:
82+
- './btc-fee-estimates.json:/www/btc-fee-estimates.json'
83+
command:
84+
- '/www'
85+
86+
lnd:
87+
image: polarlightning/lnd:0.16.2-beta
88+
restart: unless-stopped
89+
depends_on:
90+
- bitcoind
91+
expose:
92+
- '8080' # REST
93+
- '9735' # P2P
94+
- '10009' # RPC
95+
ports:
96+
- '8080:8080'
97+
- '9735:9735'
98+
- '10009:10009'
99+
volumes:
100+
- './lnd:/home/lnd/.lnd/'
101+
command:
102+
- '--noseedbackup'
103+
- '--alias=lnd'
104+
- '--externalip=lnd'
105+
- '--bitcoin.active'
106+
- '--bitcoin.regtest'
107+
- '--bitcoin.node=bitcoind'
108+
- '--bitcoind.rpchost=bitcoind:43782'
109+
- '--bitcoind.rpcuser=polaruser'
110+
- '--bitcoind.rpcpass=polarpass'
111+
- '--bitcoind.zmqpubrawblock=tcp://bitcoind:28334'
112+
- '--bitcoind.zmqpubrawtx=tcp://bitcoind:28335'
113+
- '--debuglevel=info'
114+
- '--listen=0.0.0.0:9735'
115+
- '--rpclisten=0.0.0.0:10009'
116+
- '--restlisten=0.0.0.0:8080'
117+
- '--feeurl=http://darkhttpd:80/btc-fee-estimates.json'
118+
46119
volumes:
47-
bitcoin_datadir:
48-
bitcoin_wallet_datadir:
49-
electrs_datadir:
120+
bitcoin_home:
50121

51122
networks: {}

__tests__/electrs.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
auth = "electrumx:1VmSUVGBuLNWvZl0LExRDW0tvl6196-47RfXIzS384g="
1+
auth = "polaruser:polarpass"

__tests__/wallet-restore.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ import initWaitForElectrumToSync from './utils/wait-for-electrum';
1414

1515
jest.setTimeout(60_000);
1616

17-
const bitcoinURL =
18-
'http://electrumx:1VmSUVGBuLNWvZl0LExRDW0tvl6196-47RfXIzS384g=@localhost:43782';
17+
const bitcoinURL = 'http://polaruser:polarpass@127.0.0.1:43782';
1918

2019
describe('Wallet - wallet restore and receive', () => {
2120
let waitForElectrum;

__tests__/wallet-send.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ import { runStorageCheck } from '../src/utils/wallet/checks';
2626

2727
jest.setTimeout(60_000);
2828

29-
const bitcoinURL =
30-
'http://electrumx:1VmSUVGBuLNWvZl0LExRDW0tvl6196-47RfXIzS384g=@localhost:43782';
29+
const bitcoinURL = 'http://polaruser:polarpass@127.0.0.1:43782';
3130

3231
describe('Wallet - new wallet, send and receive', () => {
3332
let waitForElectrum;

babel.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const { types } = require('@babel/core');
2+
const { E2E_TESTS } = process.env;
23

34
module.exports = {
45
presets: ['module:metro-react-native-babel-preset'],
@@ -18,7 +19,9 @@ module.exports = {
1819
],
1920
env: {
2021
production: {
21-
plugins: ['transform-remove-console'],
22+
// do not use `transform-remove-console` in e2e tests
23+
// so we can see all the logs
24+
plugins: E2E_TESTS ? [] : ['transform-remove-console'],
2225
},
2326
},
2427
};

e2e/helpers.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ import path from 'path';
33

44
const LOCK_PATH = '/tmp/';
55

6-
export const bitcoinURL =
7-
'http://electrumx:1VmSUVGBuLNWvZl0LExRDW0tvl6196-47RfXIzS384g=@0.0.0.0:43782';
6+
export const bitcoinURL = 'http://polaruser:polarpass@127.0.0.1:43782';
87

98
export const checkComplete = (name) => {
109
if (!process.env.CI) {

0 commit comments

Comments
 (0)