Do not run bootstrap live data test as part of normal CI (#468)

This commit is contained in:
Franck R 2022-02-03 16:58:53 +11:00 committed by GitHub
parent fac4afac9d
commit 91d6e436d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 68 additions and 37 deletions

View File

@ -5,12 +5,14 @@ module.exports = function (config) {
frameworks: ['mocha', 'karma-typescript'],
files: ['src/lib/**/*.ts', 'src/proto/**/*.ts'],
preprocessors: {
'**/*.ts': ['karma-typescript'],
'**/*.ts': ['karma-typescript', 'env'],
},
envPreprocessor: ['CI'],
plugins: [
require('karma-mocha'),
require('karma-typescript'),
require('karma-chrome-launcher'),
require('karma-env-preprocessor'),
],
reporters: ['progress', 'karma-typescript'],
browsers: ['ChromeHeadless'],

13
package-lock.json generated
View File

@ -60,6 +60,7 @@
"gh-pages": "^3.2.3",
"karma": "^6.3.12",
"karma-chrome-launcher": "^3.1.0",
"karma-env-preprocessor": "^0.1.1",
"karma-mocha": "^2.0.1",
"karma-typescript": "^5.5.3",
"mocha": "^9.1.3",
@ -9984,6 +9985,12 @@
"which": "bin/which"
}
},
"node_modules/karma-env-preprocessor": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/karma-env-preprocessor/-/karma-env-preprocessor-0.1.1.tgz",
"integrity": "sha1-u+jIfVnADtt2BwvTwxtLOdXcfhU=",
"dev": true
},
"node_modules/karma-mocha": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/karma-mocha/-/karma-mocha-2.0.1.tgz",
@ -25507,6 +25514,12 @@
}
}
},
"karma-env-preprocessor": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/karma-env-preprocessor/-/karma-env-preprocessor-0.1.1.tgz",
"integrity": "sha1-u+jIfVnADtt2BwvTwxtLOdXcfhU=",
"dev": true
},
"karma-mocha": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/karma-mocha/-/karma-mocha-2.0.1.tgz",

View File

@ -107,6 +107,7 @@
"gh-pages": "^3.2.3",
"karma": "^6.3.12",
"karma-chrome-launcher": "^3.1.0",
"karma-env-preprocessor": "^0.1.1",
"karma-mocha": "^2.0.1",
"karma-typescript": "^5.5.3",
"mocha": "^9.1.3",

View File

@ -3,6 +3,12 @@ import { expect } from 'chai';
import { DnsClient, DnsNodeDiscovery } from './dns';
import testData from './testdata.json';
declare global {
interface Window {
__env__?: any;
}
}
const mockData = testData.dns;
const host = 'nodes.example.org';
@ -176,7 +182,7 @@ describe('DNS Node Discovery [live data]', function () {
const maxQuantity = 3;
before(function () {
if (process.env.CI) {
if (process.env.CI || window.__env__.CI) {
this.skip();
}
});

View File

@ -44,41 +44,6 @@ describe('Waku Dial [node only]', function () {
});
});
describe('Bootstrap [live data]', function () {
let waku: Waku;
let nimWaku: NimWaku;
afterEach(async function () {
!!nimWaku && nimWaku.stop();
!!waku && waku.stop().catch((e) => console.log('Waku failed to stop', e));
});
before(function () {
if (process.env.CI) {
this.skip();
}
});
it('Enabling default [live data]', async function () {
// This test depends on fleets.status.im being online.
// This dependence must be removed once DNS discovery is implemented
this.timeout(20_000);
waku = await Waku.create({
staticNoiseKey: NOISE_KEY_1,
bootstrap: { default: true },
});
const connectedPeerID: PeerId = await new Promise((resolve) => {
waku.libp2p.connectionManager.on('peer:connect', (connection) => {
resolve(connection.remotePeer);
});
});
expect(connectedPeerID).to.not.be.undefined;
});
});
describe('Bootstrap', function () {
let waku: Waku;
let nimWaku: NimWaku;

44
src/lib/waku.spec.ts Normal file
View File

@ -0,0 +1,44 @@
import { expect } from 'chai';
import PeerId from 'peer-id';
import { Waku } from './waku';
declare global {
interface Window {
__env__?: any;
}
}
describe('Waku Dial', function () {
describe('Bootstrap [live data]', function () {
let waku: Waku;
afterEach(function () {
!!waku && waku.stop().catch((e) => console.log('Waku failed to stop', e));
});
before(function () {
if (process.env.CI || window.__env__.CI) {
this.skip();
}
});
it('Enabling default [live data]', async function () {
// This test depends on fleets.status.im being online.
// This dependence must be removed once DNS discovery is implemented
this.timeout(20_000);
waku = await Waku.create({
bootstrap: { default: true },
});
const connectedPeerID: PeerId = await new Promise((resolve) => {
waku.libp2p.connectionManager.on('peer:connect', (connection) => {
resolve(connection.remotePeer);
});
});
expect(connectedPeerID).to.not.be.undefined;
});
});
});