mirror of https://github.com/waku-org/js-waku.git
Separate tests that use DNS data in CI
This commit is contained in:
parent
0bfe9c9a64
commit
2c16f0befb
|
@ -90,3 +90,42 @@ jobs:
|
|||
with:
|
||||
name: nim-waku-logs
|
||||
path: log/
|
||||
|
||||
# Run tests that use live data or depend on external systems
|
||||
# This should not be mandatory as part of the PR process to not have
|
||||
# a blocker because said external system is down.
|
||||
build_and_test_live_data:
|
||||
strategy:
|
||||
matrix:
|
||||
node: [16]
|
||||
os: [ubuntu-latest]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2.3.3
|
||||
|
||||
- name: Install NodeJS
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
|
||||
- name: Cache npm cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: node-${{ matrix.os }}-${{ matrix.node }}-v1-${{ hashFiles('**/package-lock.json') }}
|
||||
|
||||
- name: install using npm ci
|
||||
uses: bahmutov/npm-install@v1
|
||||
|
||||
- name: karma live data tests
|
||||
env:
|
||||
DEBUG: "waku:test*"
|
||||
run: npm run test:karma-live-data
|
||||
|
||||
- name: Upload logs on failure
|
||||
uses: actions/upload-artifact@v2
|
||||
if: failure()
|
||||
with:
|
||||
name: nim-waku-logs
|
||||
path: log/
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
process.env.CHROME_BIN = require('puppeteer').executablePath();
|
||||
|
||||
module.exports = function (config) {
|
||||
config.set({
|
||||
frameworks: ['mocha', 'karma-typescript'],
|
||||
files: ['src/lib/**/*.ts', 'src/proto/**/*.ts'],
|
||||
preprocessors: {
|
||||
'**/*.ts': ['karma-typescript'],
|
||||
},
|
||||
plugins: [
|
||||
require('karma-mocha'),
|
||||
require('karma-typescript'),
|
||||
require('karma-chrome-launcher'),
|
||||
],
|
||||
reporters: ['progress', 'karma-typescript'],
|
||||
browsers: ['ChromeHeadless'],
|
||||
singleRun: true,
|
||||
client: {
|
||||
mocha: {
|
||||
timeout: 6000, // Default is 2s
|
||||
},
|
||||
args: ['--grep', '[live data]]'],
|
||||
},
|
||||
karmaTypescriptConfig: {
|
||||
bundlerOptions: {
|
||||
entrypoints: /^.*[^(node)]\.spec\.ts$/,
|
||||
},
|
||||
coverageOptions: {
|
||||
instrumentation: false,
|
||||
},
|
||||
tsconfig: './tsconfig.json',
|
||||
compilerOptions: {
|
||||
noEmit: false,
|
||||
},
|
||||
include: {
|
||||
mode: 'replace',
|
||||
values: ['src/lib/**/*.ts', 'src/proto/**/*.ts'],
|
||||
},
|
||||
exclude: {
|
||||
mode: 'replace',
|
||||
values: ['node_modules/**'],
|
||||
},
|
||||
},
|
||||
});
|
||||
};
|
|
@ -39,6 +39,7 @@
|
|||
"test:spelling": "cspell \"{README.md,.github/*.md,guides/*.md,src/**/*.ts}\"",
|
||||
"test:unit": "nyc --silent mocha",
|
||||
"test:karma": "karma start",
|
||||
"test:karma-live-data": "LIVE_DATA_TESTS=true karma start ./karma-live-data.conf.js",
|
||||
"examples:test": "run-s examples:pretest; for d in examples/*/; do (cd $d && npm test;); done",
|
||||
"proto": "run-s proto:*",
|
||||
"proto:lint": "buf lint",
|
||||
|
|
|
@ -176,6 +176,12 @@ describe('DNS Node Discovery [live data]', function () {
|
|||
const ipTestRegex = /^\d+\.\d+\.\d+\.\d+$/;
|
||||
const maxQuantity = 3;
|
||||
|
||||
before(function () {
|
||||
if (process.env.CI && !process.env.LIVE_DATA_TESTS) {
|
||||
this.skip();
|
||||
}
|
||||
});
|
||||
|
||||
it(`should retrieve ${maxQuantity} PeerInfos for test.nodes.vac.dev`, async function () {
|
||||
this.timeout(5000);
|
||||
// Google's dns server address. Needs to be set explicitly to run in CI
|
||||
|
|
Loading…
Reference in New Issue