Skip to content

Commit

Permalink
fix: trying to add healthchecks instead of waiting for gh actions 🕓
Browse files Browse the repository at this point in the history
  • Loading branch information
signorecello committed Feb 14, 2022
1 parent a43963a commit e035052
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 26 deletions.
19 changes: 15 additions & 4 deletions .github/workflows/check-PRs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,19 @@ jobs:
docker-compose build
./start-nightfall -g &> ganache-test.log &disown
- name: wait 2000s for Containers startup and setup completion
run: sleep 2000
# waiting for client healthcheck
- uses: cygnetdigital/wait_for_response@v2.0.0
with:
url: 'http://localhost:8080/'
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()
Expand All @@ -42,8 +53,8 @@ jobs:
- name: Run integration test
run: |
npm ci
VERBOSE=true npm run test-e2e-protocol
VERBOSE=true npm run test-e2e-tokens
VERBOSE=true ENVIRONMENT=localhost npm run test-e2e-protocol
VERBOSE=true ENVIRONMENT=localhost npm run test-e2e-tokens
- name: debug logs - after integration test run
if: always()
Expand Down
7 changes: 3 additions & 4 deletions test/e2e/protocol/challenger.test.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* eslint-disable no-await-in-loop */
import chai from 'chai';
import config from 'config';
import chaiHttp from 'chai-http';
import chaiAsPromised from 'chai-as-promised';
import { createRequire } from 'module';
Expand All @@ -10,15 +11,13 @@ const require = createRequire(import.meta.url);
const { expect } = chai;
chai.use(chaiHttp);
chai.use(chaiAsPromised);
const { web3WsUrl, network } = process.env;

// we need require here to import jsons
const environments = require('../environments.json');
const environment = config.ENVIRONMENTS[process.env.ENVIRONMENT];
const signingKeys = require('../signingKeys.json');
const mnemonics = require('../mnemonics.json');

const environment = environments[network] || environments.localhost;
const nf3Challenger = new Nf3(web3WsUrl, signingKeys.challenger, environment);
const nf3Challenger = new Nf3(signingKeys.challenger, environment);

describe('Basic Challenger tests', () => {
before(async () => {
Expand Down
12 changes: 4 additions & 8 deletions test/e2e/protocol/gas.test.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable no-await-in-loop */
import chai from 'chai';
import chaiHttp from 'chai-http';
import config from 'config';
import chaiAsPromised from 'chai-as-promised';
import { createRequire } from 'module';
import Nf3 from '../../../cli/lib/nf3.mjs';
Expand All @@ -11,23 +12,18 @@ const require = createRequire(import.meta.url);
const { expect } = chai;
chai.use(chaiHttp);
chai.use(chaiAsPromised);
const { web3WsUrl, network } = process.env;

// we need require here to import jsons
const environments = require('../environments.json');
const environment = config.ENVIRONMENTS[process.env.ENVIRONMENT];
const mnemonics = require('../mnemonics.json');
const signingKeys = require('../signingKeys.json');
const { fee, transferValue } = require('../configs.json');
const { tokenType, tokenId } = require('../tokenConfigs.json');

const txPerBlock = 32;
const expectedGasCostPerTx = 10000 * txPerBlock;
const environment = environments[network];
const nf3Users = [
new Nf3(web3WsUrl, signingKeys.user1, environment),
new Nf3(web3WsUrl, signingKeys.user2, environment),
];
const nf3Proposer1 = new Nf3(web3WsUrl, signingKeys.proposer1, environment);
const nf3Users = [new Nf3(signingKeys.user1, environment), new Nf3(signingKeys.user2, environment)];
const nf3Proposer1 = new Nf3(signingKeys.proposer1, environment);

const web3Client = new Web3Client();

Expand Down
7 changes: 3 additions & 4 deletions test/e2e/protocol/health-and-contracts.test.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* eslint-disable no-await-in-loop */
import chai from 'chai';
import config from 'config';
import chaiHttp from 'chai-http';
import chaiAsPromised from 'chai-as-promised';
import { createRequire } from 'module';
Expand All @@ -10,15 +11,13 @@ const require = createRequire(import.meta.url);
const { expect } = chai;
chai.use(chaiHttp);
chai.use(chaiAsPromised);
const { web3WsUrl, network } = process.env;

// we need require here to import jsons
const environments = require('../environments.json');
const environment = config.ENVIRONMENTS[process.env.ENVIRONMENT];
const mnemonics = require('../mnemonics.json');
const signingKeys = require('../signingKeys.json');

const environment = environments[network];
const nf3User1 = new Nf3(web3WsUrl, signingKeys.user1, environment);
const nf3User1 = new Nf3(signingKeys.user1, environment);

before(async () => {
await nf3User1.init(mnemonics.user1);
Expand Down
12 changes: 6 additions & 6 deletions test/e2e/protocol/proposer.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import chai from 'chai';
import chaiHttp from 'chai-http';
import chaiAsPromised from 'chai-as-promised';
import config from 'config';
import { createRequire } from 'module';
import Nf3 from '../../../cli/lib/nf3.mjs';
import { Web3Client, expectTransaction } from '../../utils.mjs';
Expand All @@ -11,19 +12,18 @@ const require = createRequire(import.meta.url);
const { expect } = chai;
chai.use(chaiHttp);
chai.use(chaiAsPromised);
const { web3WsUrl, network } = process.env;

// we need require here to import jsons
const environments = require('../environments.json');
const environment = config.ENVIRONMENTS[process.env.ENVIRONMENT];

const mnemonics = require('../mnemonics.json');
const signingKeys = require('../signingKeys.json');
const { bond, gasCosts, txPerBlock } = require('../configs.json');

const environment = environments[network] || environments.localhost;
const testProposers = [
new Nf3(web3WsUrl, signingKeys.proposer1, environment),
new Nf3(web3WsUrl, signingKeys.proposer2, environment),
new Nf3(web3WsUrl, signingKeys.proposer3, environment),
new Nf3(signingKeys.proposer1, environment),
new Nf3(signingKeys.proposer2, environment),
new Nf3(signingKeys.proposer3, environment),
];

const web3Client = new Web3Client();
Expand Down

0 comments on commit e035052

Please sign in to comment.