Skip to content

Commit c05e3f9

Browse files
committed
rework localflare test
1 parent 9d98314 commit c05e3f9

File tree

20 files changed

+895
-101
lines changed

20 files changed

+895
-101
lines changed

.github/workflows/ci.yml

Lines changed: 16 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -67,126 +67,41 @@ jobs:
6767
export IMAGE_SHA256_0_FULL=$(docker image inspect --format='{{json .RepoDigests}}' ${{ needs.define-env.outputs.IMAGE_PATH_0 }}:${{ needs.define-env.outputs.IMAGE_TAG }} | jq --raw-output '.[0]')
6868
echo "IMAGE_SHA256_0=${IMAGE_SHA256_0_FULL#*@}" >> $GITHUB_OUTPUT
6969
70-
71-
test-container-localflare-online:
70+
test-localflare:
7271
runs-on: ubuntu-latest
7372
needs:
7473
- build-container
7574
- define-env
7675
strategy:
77-
fail-fast: false
76+
fail-fast: true
7877
matrix:
7978
START_ROSETTA_SERVER_AFTER_BOOTSTRAP: [true, false]
80-
services:
81-
flare_node:
82-
image: ${{ needs.define-env.outputs.IMAGE_PATH_0 }}@${{ needs.build-container.outputs.IMAGE_SHA256_0 }}
83-
ports:
84-
- 9650:9650
85-
- 9651:9651
86-
- 8080:8080
87-
env:
88-
DEBUG: false
89-
NETWORK_ID: localflare
90-
FLARE_LOCAL_TXS_ENABLED: true
91-
START_ROSETTA_SERVER_AFTER_BOOTSTRAP: ${{ matrix.START_ROSETTA_SERVER_AFTER_BOOTSTRAP }}
92-
EXTRA_ARGUMENTS: --staking-tls-cert-file=/app/flare/staking/local/staker1.crt --staking-tls-key-file=/app/flare/staking/local/staker1.key --staking-signer-key-file=/app/flare/staking/local/signer1.key
93-
options: >-
94-
--health-interval 15s
95-
--health-timeout 15s
96-
--health-retries 10
97-
--health-start-period 30s
9879
steps:
9980
- uses: actions/checkout@v3
81+
10082
- uses: actions/setup-go@v3
10183
with:
10284
go-version: ${{ env.go_version }}
103-
- run: sudo apt update -y && sudo apt install curl -y
104-
105-
- name: Wait for go-flare to bind to port
106-
shell: bash
107-
run: curl -s --retry 6 --retry-delay 10 --retry-connrefused http://localhost:9650 || exit 1
108-
109-
- name: Import testnet
110-
shell: bash
111-
run: |
112-
curl -s -o /tmp/test_pchain_import.sh https://raw.githubusercontent.com/flare-foundation/go-flare/114017731f4f8f6192a4df2748da914c0257e16b/avalanchego/scripts/test_pchain_import.sh
113-
sed -i 's/localhost/127.0.0.1/g' /tmp/test_pchain_import.sh
114-
sed -i 's/ | jq .//g' /tmp/test_pchain_import.sh
115-
bash /tmp/test_pchain_import.sh
116-
while [[ "$(curl -X POST --data '{ "jsonrpc": "2.0", "method": "platform.getHeight", "params": {}, "id": 1 }' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P | jq -r .result.height)" != "2" ]]
117-
do
118-
echo "Block height not reached.. Block Height:" $(curl -X POST --data '{ "jsonrpc": "2.0", "method": "platform.getHeight", "params": {}, "id": 1 }' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P | jq -r .result.height)
119-
sleep 1
120-
done
121-
- name: Wait for rosetta to bind to port
122-
shell: bash
123-
run: curl -s --retry 6 --retry-delay 10 --retry-connrefused http://localhost:8080 || exit 1
124-
125-
- name: List networks Rosetta API lists
126-
shell: bash
127-
run: |
128-
curl -s --location --request POST 'http://127.0.0.1:8080/network/list' \
129-
--header 'Content-Type: application/json' \
130-
--data-raw '{ "metadata" : {} }' \
131-
--fail || exit 1
132-
- name: Install rosetta cli
133-
shell: bash
134-
run: |
135-
mkdir -p /tmp/rosetta
136-
curl -o /tmp/rosetta/install.sh -sSfL https://raw.githubusercontent.com/coinbase/mesh-cli/refs/tags/v0.10.4/scripts/install.sh
137-
sed -i 's/REPO="rosetta-cli"/REPO="mesh-cli"/g' /tmp/rosetta/install.sh
138-
bash /tmp/rosetta/install.sh -b /tmp/rosetta/ v0.10.4
139-
- name: Run rosetta-cli check:construction
140-
timeout-minutes: 5
141-
shell: bash
142-
run: |
143-
pushd server/rosetta-cli-conf/localflare
144-
/tmp/rosetta/rosetta-cli --configuration-file=./config.json check:construction
145-
popd
14685

86+
- name: Set up Docker Compose
87+
uses: docker/setup-compose-action@v1
14788

148-
149-
test-container-localflare-offline:
150-
runs-on: ubuntu-latest
151-
needs:
152-
- build-container
153-
- define-env
154-
services:
155-
flare_node:
156-
image: ${{ needs.define-env.outputs.IMAGE_PATH_0 }}@${{ needs.build-container.outputs.IMAGE_SHA256_0 }}
157-
ports:
158-
- 9650:9650
159-
- 9651:9651
160-
- 8080:8080
161-
env:
162-
DEBUG: true
163-
NETWORK_ID: localflare
164-
FLARE_LOCAL_TXS_ENABLED: true
165-
MODE: offline
166-
EXTRA_ARGUMENTS: --staking-tls-cert-file=/app/flare/staking/local/staker1.crt --staking-tls-key-file=/app/flare/staking/local/staker1.key
167-
options: >-
168-
--health-interval 15s
169-
--health-timeout 15s
170-
--health-retries 10
171-
--health-start-period 30s
172-
steps:
173-
- uses: actions/checkout@v3
174-
- uses: actions/setup-go@v3
89+
- uses: actions/setup-node@v6
17590
with:
176-
go-version: ${{ env.go_version }}
177-
- run: sudo apt update -y && sudo apt install curl -y
91+
node-version: 20
17892

179-
- name: Wait for rosetta to bind to port
180-
shell: bash
181-
run: curl -s --retry 6 --retry-delay 10 --retry-connrefused http://localhost:8080 || exit 1
93+
- run: sudo apt update -y && sudo apt install curl jq -y
94+
95+
- name: Install yarn
96+
run: npm install -g yarn
18297

183-
- name: List networks Rosetta API lists
98+
- name: Run localflare test script
99+
env:
100+
ROSETTA_IMAGE: ${{ needs.define-env.outputs.IMAGE_PATH_0 }}@${{ needs.build-container.outputs.IMAGE_SHA256_0 }}
101+
START_ROSETTA_SERVER_AFTER_BOOTSTRAP: ${{ matrix.START_ROSETTA_SERVER_AFTER_BOOTSTRAP }}
184102
shell: bash
185103
run: |
186-
curl -s --location --request POST 'http://127.0.0.1:8080/network/list' \
187-
--header 'Content-Type: application/json' \
188-
--data-raw '{ "metadata" : {} }' \
189-
--fail || exit 1
104+
./test-localflare.sh
190105
191106
test-make_build:
192107
runs-on: ubuntu-latest

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ data
2121
__debug_bin*
2222
build_docker.sh
2323
.idea
24+
tmp/

0 commit comments

Comments
 (0)