-
Notifications
You must be signed in to change notification settings - Fork 11
292 lines (282 loc) · 11.4 KB
/
tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
name: Integration Tests
on:
push:
branches:
- dev
pull_request:
branches:
- dev
jobs:
test:
runs-on: ubuntu-latest
services:
docker:
<<<<<<< HEAD
image: docker:24.0.5
=======
image: docker:19.03.12
>>>>>>> 1386b8b (Release 0.1.0 (#79))
options: --privileged
ports:
- 5432:5432
- 18443:18443
- 50002:50002
- 50001:50001
- 8000:8000
- 18080:18080
volumes:
- /var/run/docker.sock:/var/run/docker.sock
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Docker Compose
run: |
<<<<<<< HEAD
sudo curl -L "https://github.com/docker/compose/releases/download/v2.5.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
=======
>>>>>>> 1386b8b (Release 0.1.0 (#79))
docker-compose -f docker-compose-test.yml up --build -d
<<<<<<< HEAD
- name: Wait for services to be ready
run: |
sleep 80 # Adjust time as necessary for services to initialize
<<<<<<< HEAD
<<<<<<< HEAD
=======
=======
>>>>>>> 5259db8 (fix: order for running script for web client)
- name: Run start-test-components.sh for web client tests
run: |
cd clients/tests/web
chmod +x start-test-components.sh
./start-test-components.sh
<<<<<<< HEAD
>>>>>>> 10a2767 (fix: step for script execution for web client)
=======
- name: Wait for services to be ready
run: |
sleep 80 # Adjust time as necessary for services to initialize
>>>>>>> 5259db8 (fix: order for running script for web client)
- name: Verify Bitcoin daemon Service and create wallet
run: |
container_id=$(docker ps -qf "name=mercurylayer-bitcoind-1")
=======
- name: Verify Bitcoin daemon Service with Curl
run: |
container_id=$(docker ps -qf "name=mercurylayer_bitcoind_1")
>>>>>>> 1386b8b (Release 0.1.0 (#79))
echo "Container ID: $container_id"
docker logs $container_id
wallet_name="new_wallet"
docker exec $container_id bitcoin-cli -regtest -rpcuser=user -rpcpassword=pass createwallet $wallet_name
address=$(docker exec $container_id bitcoin-cli -regtest -rpcuser=user -rpcpassword=pass getnewaddress $wallet_name)
echo "New Wallet Address: $address"
docker exec $container_id bitcoin-cli -regtest -rpcuser=user -rpcpassword=pass generatetoaddress 101 "$address"
docker exec $container_id bitcoin-cli -regtest -rpcuser=user -rpcpassword=pass sendtoaddress bcrt1pcngfxjdkf4r2h26k52dh5nunxg8m68uf4lkfhmfjvjj6agfkm5jqmftw4e 0.0001
<<<<<<< HEAD
<<<<<<< HEAD
=======
- name: Create wallet for esplora
run: |
container_id=$(docker ps -qf "name=esplora-container")
echo "Container ID: $container_id"
docker logs $container_id
wallet_name="esplora_wallet"
docker exec $container_id cli createwallet $wallet_name
<<<<<<< HEAD
>>>>>>> 296e370 (feat: add wallet creation for esplora)
=======
address=$(docker exec $container_id cli getnewaddress $wallet_name)
echo "New Wallet Address: $address"
docker exec $container_id cli generatetoaddress 101 "$address"
docker exec $container_id cli sendtoaddress bcrt1pcngfxjdkf4r2h26k52dh5nunxg8m68uf4lkfhmfjvjj6agfkm5jqmftw4e 0.0001
>>>>>>> a40f257 (fix: add step to generate block on esplora)
- name: Wait for services to be ready
run: |
sleep 60 # Wait for lnd to sync with latest block
- name: Verify LND nodes and create a channel between them
run: |
container_id_alice=$(docker ps -qf "name=mercurylayer-alice-1")
echo "Container ID: $container_id_alice"
container_id_bob=$(docker ps -qf "name=mercurylayer-bob-1")
echo "Container ID: $container_id_bob"
docker logs $container_id_alice
docker logs $container_id_bob
identity_pubkey_bob=$(docker exec $container_id_bob lncli -n regtest getinfo | jq -r '.identity_pubkey')
echo "Pubkey: $identity_pubkey_bob"
docker exec $container_id_alice lncli -n regtest connect $identity_pubkey_bob@bob:9735
docker exec $container_id_alice lncli -n regtest listpeers
address=$(docker exec $container_id_bob lncli -n regtest newaddress p2wkh | jq -r '.address')
container_id_bitcoind=$(docker ps -qf "name=mercurylayer-bitcoind-1")
docker exec $container_id_bitcoind bitcoin-cli -regtest -rpcuser=user -rpcpassword=pass sendtoaddress $address 0.5
docker exec $(docker ps -qf "name=mercurylayer-bitcoind-1") bitcoin-cli -regtest -rpcuser=user -rpcpassword=pass -generate 6
identity_pubkey_alice=$(docker exec $container_id_alice lncli -n regtest getinfo | jq -r '.identity_pubkey')
docker exec $container_id_bob lncli -n regtest openchannel $identity_pubkey_alice 100000
docker exec $(docker ps -qf "name=mercurylayer-bitcoind-1") bitcoin-cli -regtest -rpcuser=user -rpcpassword=pass -generate 5
docker logs $container_id_alice
docker logs $container_id_bob
- name: Verify ElectrumX Service with Curl
run: |
container_id=$(docker ps -qf "name=mercurylayer-electrs-1")
=======
- name: Verify ElectrumX Service with Curl
run: |
container_id=$(docker ps -qf "name=mercurylayer_electrs_1")
>>>>>>> 1386b8b (Release 0.1.0 (#79))
echo "Container ID: $container_id"
docker logs $container_id
- name: Verify Enclave Service with Curl
run: |
<<<<<<< HEAD
container_id=$(docker ps -qf "name=mercurylayer-enclave-sgx-1")
=======
container_id=$(docker ps -qf "name=mercurylayer_enclave-sgx_1")
>>>>>>> 1386b8b (Release 0.1.0 (#79))
echo "Container ID: $container_id"
docker logs $container_id
- name: Verify Mercury Service with Curl
run: |
<<<<<<< HEAD
container_id=$(docker ps -qf "name=mercurylayer-mercury-1")
=======
container_id=$(docker ps -qf "name=mercurylayer_mercury_1")
>>>>>>> 1386b8b (Release 0.1.0 (#79))
echo "Container ID: $container_id"
docker logs $container_id
docker exec $container_id \
curl http://0.0.0.0:8000/info/config
- name: Get Public Key
run: |
docker exec $(docker ps -qf "name=enclave") \
curl -X POST http://0.0.0.0:18080/get_public_key \
-H "Content-Type: application/json" \
-d '{"statechain_id":"550e8400e29b41d4a716446655440000"}'
docker logs $(docker ps -qf "name=enclave")
- name: Verify Node Service with Curl
run: |
curl -X POST http://0.0.0.0:3000/deposit_amount \
-H 'Content-Type: application/json' \
-d '{"address":"bcrt1pkygl356c6fvk6ptx72c64hrjkhcxecj4hjzfzc430svzczuv6m0s42lvwx","amount":1000}'
- name: Verify Esplora Service with Curl
run: |
curl http://0.0.0.0:8094/regtest/api/blocks/tip/height
docker logs $(docker ps -qf "name=esplora-container")
- name: Check connectivity between containers
run: |
# Get container IDs
<<<<<<< HEAD
enclave_container=$(docker ps -qf "name=mercurylayer-enclave-sgx-1")
mercury_container=$(docker ps -qf "name=mercurylayer-mercury-1")
# Check if mercurylayer-mercury-1 can reach mercurylayer-enclave-sgx-1
docker exec $mercury_container curl -v http://mercurylayer-enclave-sgx-1:18080/get_public_key \
=======
enclave_container=$(docker ps -qf "name=mercurylayer_enclave-sgx_1")
mercury_container=$(docker ps -qf "name=mercurylayer_mercury_1")
# Check if mercurylayer_mercury_1 can reach mercurylayer_enclave-sgx_1
docker exec $mercury_container curl -v http://mercurylayer_enclave-sgx_1:18080/get_public_key \
>>>>>>> 1386b8b (Release 0.1.0 (#79))
-H "Content-Type: application/json" \
-d '{"statechain_id":"550e8400e29b41d4a716446655440000"}'
# Alternatively, using IP address if service name resolution fails
enclave_ip=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $enclave_container)
docker exec $mercury_container curl -v http://$enclave_ip:18080/get_public_key \
-H "Content-Type: application/json" \
-d '{"statechain_id":"550e8400e29b41d4a716446655440000"}'
<<<<<<< HEAD
docker inspect mercurylayer-mercury-1
=======
docker inspect mercurylayer_mercury_1
>>>>>>> 1386b8b (Release 0.1.0 (#79))
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '20.12.2'
- name: Install Node.js dependencies for client
run: |
cd clients/apps/nodejs
npm install
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
npm install mocha -g
=======
>>>>>>> 1386b8b (Release 0.1.0 (#79))
=======
=======
npm install mocha -g
>>>>>>> 51a9a0e (feat: setup esplora for actions)
- name: Install Node.js dependencies for web client
run: |
cd clients/tests/web
npm install
npx playwright install
npx playwright install-deps
>>>>>>> 90efed7 (feat: setup web client tests on actions)
- name: Install Node.js dependencies for lib
run: |
cd clients/libs/nodejs
npm install
- name: Install Node.js dependencies for web
run: |
cd clients/libs/web
npm install
- name: Run web client Tests
run: |
cd clients/tests/web
sudo chmod -R 755 ./data_bitcoin_regtest
npx vitest --browser.name=chromium --browser.headless
- name: Run Client-Side Tests
run: |
cd clients/apps/nodejs
node test_basic_workflow2.js
node test_atomic_swap.js
<<<<<<< HEAD
<<<<<<< HEAD
mocha ./test/tb04-simple-lightning-latch.mjs --exit
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
=======
>>>>>>> 1386b8b (Release 0.1.0 (#79))
=======
=======
=======
>>>>>>> 272dda7 (fix: setup script for web client tests)
- name: Run start-test-components.sh for web client tests
run: |
cd clients/tests/web
chmod +x start-test-components.sh
./start-test-components.sh
<<<<<<< HEAD
>>>>>>> 51a9a0e (feat: setup esplora for actions)
=======
>>>>>>> 84930c6 (fix: esplora and node server for web client)
=======
>>>>>>> 272dda7 (fix: setup script for web client tests)
=======
>>>>>>> 10a2767 (fix: step for script execution for web client)
=======
>>>>>>> 8ccf218 (fix: payment hash in invoice generation)
- name: Run web client Tests
run: |
cd clients/tests/web
sudo chmod -R 755 ./data_bitcoin_regtest
<<<<<<< HEAD
npx vitest --browser.name=chromium --browser.headless
>>>>>>> 90efed7 (feat: setup web client tests on actions)
=======
>>>>>>> df3af2e (fix: web client tests order)
=======
npx vitest --browser.name=chromium --browser.headless
>>>>>>> 8ccf218 (fix: payment hash in invoice generation)
=======
mocha ./test/tb04-simple-lightning-latch.mjs --exit
>>>>>>> 2b82e6b (fix: web client tests running order)
- name: Tear Down
run: |
docker-compose -f docker-compose-test.yml down