From f061f15192fdafa1763b673e45b7c8d730bd8354 Mon Sep 17 00:00:00 2001 From: Jose Pedro Sousa Date: Mon, 14 Feb 2022 18:57:06 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20trying=20to=20add=20healthchecks=20inste?= =?UTF-8?q?ad=20of=20waiting=20for=20gh=20actions=20=F0=9F=95=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/check-PRs.yml | 13 +++---------- nightfall-client/src/app.mjs | 1 - nightfall-client/src/index.mjs | 1 + test/e2e/protocol/challenger.test.mjs | 2 +- test/e2e/protocol/gas.test.mjs | 2 +- test/e2e/protocol/health-and-contracts.test.mjs | 2 +- test/e2e/protocol/proposer.test.mjs | 2 +- test/e2e/tokens/erc1155.test.mjs | 2 +- test/e2e/tokens/erc20.test.mjs | 2 +- test/e2e/tokens/erc721.test.mjs | 2 +- test/e2e/tokens/index.test.mjs | 2 +- test/utils.mjs | 2 +- 12 files changed, 13 insertions(+), 20 deletions(-) diff --git a/.github/workflows/check-PRs.yml b/.github/workflows/check-PRs.yml index 1d65fac669..3ce1c94633 100644 --- a/.github/workflows/check-PRs.yml +++ b/.github/workflows/check-PRs.yml @@ -32,20 +32,13 @@ jobs: docker-compose build ./start-nightfall -g &> ganache-test.log &disown - # waiting for client healthcheck - - uses: cygnetdigital/wait_for_response@v2.0.0 + - name: Waiting for client healthcheck + uses: cygnetdigital/wait_for_response@v2.0.0 with: - url: 'http://localhost:8080/' + url: 'http://localhost:8080/healthcheck' timeout: 2000000 # 2000s that's hopefully enough... interval: 10000 - # waiting for optimist healthcheck - - uses: cygnetdigital/wait_for_response@v2.0.0 - with: - url: 'http://localhost:8081/' - timeout: 2000000 - interval: 10000 - - name: debug logs - after container startup if: always() run: cat ganache-test.log diff --git a/nightfall-client/src/app.mjs b/nightfall-client/src/app.mjs index 15fbf64604..080c115c4a 100644 --- a/nightfall-client/src/app.mjs +++ b/nightfall-client/src/app.mjs @@ -25,7 +25,6 @@ app.use(cors()); app.use(bodyParser.json({ limit: '2mb' })); app.use(bodyParser.urlencoded({ limit: '2mb', extended: true })); -app.get('/healthcheck', (req, res) => res.sendStatus(200)); app.use('/deposit', deposit); app.use('/contract-address', getContractAddress); app.use('/transfer', transfer); diff --git a/nightfall-client/src/index.mjs b/nightfall-client/src/index.mjs index 757e8b8bd1..ada06f8d6e 100644 --- a/nightfall-client/src/index.mjs +++ b/nightfall-client/src/index.mjs @@ -16,6 +16,7 @@ const main = async () => { } initialClientSync().then(async () => { await startEventQueue(queueManager, eventHandlers); + app.get('/healthcheck', (req, res) => res.sendStatus(200)); }); await mongo.connection(config.MONGO_URL); // get a db connection app.listen(80); diff --git a/test/e2e/protocol/challenger.test.mjs b/test/e2e/protocol/challenger.test.mjs index b01fa2a129..4353a5d58e 100644 --- a/test/e2e/protocol/challenger.test.mjs +++ b/test/e2e/protocol/challenger.test.mjs @@ -13,7 +13,7 @@ chai.use(chaiHttp); chai.use(chaiAsPromised); // we need require here to import jsons -const environment = config.ENVIRONMENTS[process.env.ENVIRONMENT]; +const environment = config.ENVIRONMENTS[process.env.ENVIRONMENT] || config.ENVIRONMENTS.localhost; const signingKeys = require('../signingKeys.json'); const mnemonics = require('../mnemonics.json'); diff --git a/test/e2e/protocol/gas.test.mjs b/test/e2e/protocol/gas.test.mjs index b105fed242..e2370a9d15 100644 --- a/test/e2e/protocol/gas.test.mjs +++ b/test/e2e/protocol/gas.test.mjs @@ -14,7 +14,7 @@ chai.use(chaiHttp); chai.use(chaiAsPromised); // we need require here to import jsons -const environment = config.ENVIRONMENTS[process.env.ENVIRONMENT]; +const environment = config.ENVIRONMENTS[process.env.ENVIRONMENT] || config.ENVIRONMENTS.localhost; const mnemonics = require('../mnemonics.json'); const signingKeys = require('../signingKeys.json'); const { fee, transferValue } = require('../configs.json'); diff --git a/test/e2e/protocol/health-and-contracts.test.mjs b/test/e2e/protocol/health-and-contracts.test.mjs index 8e72147581..2245ee9637 100644 --- a/test/e2e/protocol/health-and-contracts.test.mjs +++ b/test/e2e/protocol/health-and-contracts.test.mjs @@ -13,7 +13,7 @@ chai.use(chaiHttp); chai.use(chaiAsPromised); // we need require here to import jsons -const environment = config.ENVIRONMENTS[process.env.ENVIRONMENT]; +const environment = config.ENVIRONMENTS[process.env.ENVIRONMENT] || config.ENVIRONMENTS.localhost; const mnemonics = require('../mnemonics.json'); const signingKeys = require('../signingKeys.json'); diff --git a/test/e2e/protocol/proposer.test.mjs b/test/e2e/protocol/proposer.test.mjs index 4c1a512cd3..2aeff9e5b2 100644 --- a/test/e2e/protocol/proposer.test.mjs +++ b/test/e2e/protocol/proposer.test.mjs @@ -14,7 +14,7 @@ chai.use(chaiHttp); chai.use(chaiAsPromised); // we need require here to import jsons -const environment = config.ENVIRONMENTS[process.env.ENVIRONMENT]; +const environment = config.ENVIRONMENTS[process.env.ENVIRONMENT] || config.ENVIRONMENTS.localhost; const mnemonics = require('../mnemonics.json'); const signingKeys = require('../signingKeys.json'); diff --git a/test/e2e/tokens/erc1155.test.mjs b/test/e2e/tokens/erc1155.test.mjs index 27227525c3..66ba43d605 100644 --- a/test/e2e/tokens/erc1155.test.mjs +++ b/test/e2e/tokens/erc1155.test.mjs @@ -15,7 +15,7 @@ const { expect } = chai; chai.use(chaiHttp); chai.use(chaiAsPromised); -const environment = config.ENVIRONMENTS[process.env.ENVIRONMENT]; +const environment = config.ENVIRONMENTS[process.env.ENVIRONMENT] || config.ENVIRONMENTS.localhost; // we need require here to import jsons const mnemonics = require('../mnemonics.json'); diff --git a/test/e2e/tokens/erc20.test.mjs b/test/e2e/tokens/erc20.test.mjs index 3408668757..40940f5946 100644 --- a/test/e2e/tokens/erc20.test.mjs +++ b/test/e2e/tokens/erc20.test.mjs @@ -15,7 +15,7 @@ const { expect } = chai; chai.use(chaiHttp); chai.use(chaiAsPromised); -const environment = config.ENVIRONMENTS[process.env.ENVIRONMENT]; +const environment = config.ENVIRONMENTS[process.env.ENVIRONMENT] || config.ENVIRONMENTS.localhost; // we need require here to import jsons const mnemonics = require('../mnemonics.json'); diff --git a/test/e2e/tokens/erc721.test.mjs b/test/e2e/tokens/erc721.test.mjs index f29482b6ae..c6fd1326b7 100644 --- a/test/e2e/tokens/erc721.test.mjs +++ b/test/e2e/tokens/erc721.test.mjs @@ -14,7 +14,7 @@ const require = createRequire(import.meta.url); const { expect } = chai; chai.use(chaiHttp); chai.use(chaiAsPromised); -const environment = config.ENVIRONMENTS[process.env.ENVIRONMENT]; +const environment = config.ENVIRONMENTS[process.env.ENVIRONMENT] || config.ENVIRONMENTS.localhost; // we need require here to import jsons const mnemonics = require('../mnemonics.json'); diff --git a/test/e2e/tokens/index.test.mjs b/test/e2e/tokens/index.test.mjs index bb85dcbb28..243d315233 100644 --- a/test/e2e/tokens/index.test.mjs +++ b/test/e2e/tokens/index.test.mjs @@ -1,4 +1,4 @@ /* eslint-disable no-unused-vars */ -// import * as erc20 from './erc20.test.mjs'; +import * as erc20 from './erc20.test.mjs'; import * as erc721 from './erc721.test.mjs'; import * as erc1155 from './erc1155.test.mjs'; diff --git a/test/utils.mjs b/test/utils.mjs index 462d7ef11a..9362caba53 100644 --- a/test/utils.mjs +++ b/test/utils.mjs @@ -6,7 +6,7 @@ import rand from '../common-files/utils/crypto/crypto-random.mjs'; const { expect } = chai; const { WEB3_PROVIDER_OPTIONS } = config; -const ENVIRONMENT = config.ENVIRONMENTS[process.env.ENVIRONMENT]; +const ENVIRONMENT = config.ENVIRONMENTS[process.env.ENVIRONMENT] || config.ENVIRONMENTS.localhost; const USE_INFURA = config.USE_INFURA === 'true'; const USE_ROPSTEN_NODE = config.USE_ROPSTEN_NODE === 'true';