-
Notifications
You must be signed in to change notification settings - Fork 11
84 lines (82 loc) · 3.15 KB
/
run-e2e.yaml
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
name: E2E Tests
on:
push:
branches:
- main
pull_request:
concurrency: e2e
jobs:
e2e:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
name: Setup GO Env
with:
go-version: '1.20'
- name: Cache Go E2E Test modules
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-e2e-test-${{ secrets.CACHE_VERSION }}-${{ hashFiles('./go.sum') }}
restore-keys: |
${{ runner.os }}-go-e2e-test-
- name: Export bridge configuration
shell: bash
run: |
echo "${{ secrets.E2E_BRIDGE_CONFIG }}" > ./examples/three-validators/bridge.yml
- name: Export alice application config
shell: bash
run: |
echo "${{ secrets.E2E_ALICE_CONFIG }}" > ./examples/three-validators/alice/config/node.yml
- name: Export bob application config
shell: bash
run: |
echo "${{ secrets.E2E_BOB_CONFIG }}" > ./examples/three-validators/bob/config/node.yml
- name: Export carol application config
shell: bash
run: |
echo "${{ secrets.E2E_CAROL_CONFIG }}" > ./examples/three-validators/carol/config/node.yml
- name: Export dave application configuration
shell: bash
run: |
echo "${{ secrets.E2E_DAVE_CONFIG }}" > ./examples/three-validators/dave/config/node.yml
- name: Build the stack
run: cd examples/three-validators; docker-compose up -d
- name: Perform health check on nodes
shell: bash
run: >
start=`date +%s` ;
ports=("6200" "7200" "8200" "9200") ;
for port in "${ports[@]}" ; do
MAX_TIMEOUT=60;
while [[ "$(curl -s 127.0.0.1:"$port"/api/v1/health)" != "{\"status\":\"OK\"}" ]]; do
sleep 5; ((MAX_TIMEOUT-=5));
if [ "$MAX_TIMEOUT" -eq "0" ]; then break; fi ;
done ;
if [ "$MAX_TIMEOUT" -eq "0" ]; then echo "Unconfirmed health check for 127.0.0.1:$port" ;
else echo "Confirmed health check for 127.0.0.1:$port"; fi ;
done ;
end=`date +%s` ;
echo "Total: $((end-start)) seconds"
- name: Create e2e run test config
shell: bash
run: |
echo "${{ secrets.E2E_TEST_CONFIG }}" > ./e2e/setup/application.yml
echo "${{ secrets.E2E_BRIDGE_CONFIG }}" > ./e2e/setup/bridge.yml
- name: Run E2E Tests
run: go test ./e2e/ -timeout 0
- name: Prepare container logs
if: ${{ always() }}
run: |
cd examples/three-validators/ && mkdir logs &&
touch ./logs/alice.log && docker-compose logs alice > ./logs/alice.log &&
touch ./logs/bob.log && docker-compose logs bob > ./logs/bob.log &&
touch ./logs/carol.log && docker-compose logs carol > ./logs/carol.log &&
touch ./logs/dave.log && docker-compose logs dave_read_only > ./logs/dave.log
- name: Upload Logs
if: ${{ always() }}
uses: actions/upload-artifact@v2
with:
name: validator-logs
path: ./examples/three-validators/logs