Skip to content

Commit

Permalink
fix(ci): increase retries on failing healthcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
coreyar committed Oct 23, 2023
1 parent c830420 commit 1fa4eb4
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 12 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ jobs:
- name: Run Governance integration integration tests
run: |
docker exec -i subgraph-hardhat-node yarn workspace venus-governance-subgraph run test:integration --bail
- name: Debug
if: always()
run: |
docker inspect --format "{{json .State.Health }}" $(docker-compose ps -q hardhat)
- name: Stop containers
if: always()
Expand Down
16 changes: 8 additions & 8 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ services:
condition: service_started
postgres:
condition: service_started
healthcheck:
test: ["CMD", "curl", "-f", "http://graph-node:8000"]
interval: 30s
timeout: 12s
retries: 10
# healthcheck:
# test: ["CMD", "curl", "-f", "http://graph-node:8000"]
# interval: 30s
# timeout: 12s
# retries: 10
environment:
postgres_host: postgres
postgres_user: graph-node
Expand All @@ -38,7 +38,7 @@ services:
- sh
- -c
- |
yarn &&PACKAGE=isolated-pools yarn workspace isolated-pools-subgraph run hardhat node --hostname 0.0.0.0
yarn && PACKAGE=isolated-pools yarn run node:integration
# Installing again to link workspaces
ports:
- 8545:8545
Expand All @@ -49,8 +49,8 @@ services:
healthcheck:
test: ["CMD", "node", "./hardhat-healthcheck.js"]
interval: 30s
timeout: 12s
retries: 10
timeout: 20s
retries: 20
ipfs:
image: ipfs/go-ipfs:v0.4.23
ports:
Expand Down
12 changes: 9 additions & 3 deletions hardhat-healthcheck.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@
* If node is up this function will silently succeed. If the node is down it will throw an error.
*/
async function healthCheck() {
const ethers = require('ethers');
const localProvider = new ethers.providers.JsonRpcProvider(`http://hardhat:8545`)
localBlockNum = await localProvider.getBlockNumber();
try {
const ethers = require('ethers');
const localProvider = new ethers.providers.JsonRpcProvider(`https://hardhat:8545`)
localBlockNum = await localProvider.getBlockNumber();
console.log(localBlockNum)
} catch (e) {
console.log(e)
throw e
}
}

module.export = healthCheck();
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"lint:fix": "yarn lint --fix",
"pretty": "prettier '**/*.ts' --write",
"test": "yarn workspaces foreach run test",
"node:integration": "PACKAGE=isolated-pools hardhat node --hostname 0.0.0.0",
"test:integration": "yarn workspaces foreach run test:integration",
"postinstall": "patch-package && ./copy_contracts.sh"
},
Expand Down
1 change: 0 additions & 1 deletion subgraphs/isolated-pools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
"generate-subgraph-types": "rm -rf /subgraph-client/.graphclient && yarn graphclient build --dir ./subgraph-client",
"pretty": "prettier —-write '**/*.ts'",
"test": "yarn prepare:local && graph test",
"node:integration": "PACKAGE=isolated-pools hardhat node --hostname 0.0.0.0",
"test:integration": "PACKAGE=isolated-pools hardhat test tests/integration/index.ts --network localhost"
},
"devDependencies": {
Expand Down

0 comments on commit 1fa4eb4

Please sign in to comment.