mirror of https://github.com/waku-org/js-waku.git
Merge #142
142: Add debug statement in tests r=D4nte a=D4nte Also enable debug logs in CI. Co-authored-by: Franck Royer <franck@status.im>
This commit is contained in:
commit
cc35941803
|
@ -97,6 +97,8 @@ jobs:
|
||||||
[ $(git status --short --ignore-submodules|wc -l) -eq 0 ]
|
[ $(git status --short --ignore-submodules|wc -l) -eq 0 ]
|
||||||
|
|
||||||
- name: test
|
- name: test
|
||||||
|
env:
|
||||||
|
DEBUG: "waku:nim-waku*,waku:test*"
|
||||||
run: npm run test
|
run: npm run test
|
||||||
|
|
||||||
- name: Upload logs on failure
|
- name: Upload logs on failure
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { expect } from 'chai';
|
import { expect } from 'chai';
|
||||||
|
import debug from 'debug';
|
||||||
import TCP from 'libp2p-tcp';
|
import TCP from 'libp2p-tcp';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
@ -13,6 +14,8 @@ import { WakuMessage } from '../waku_message';
|
||||||
|
|
||||||
import { RelayCodec, RelayDefaultTopic } from './index';
|
import { RelayCodec, RelayDefaultTopic } from './index';
|
||||||
|
|
||||||
|
const log = debug('waku:test');
|
||||||
|
|
||||||
describe('Waku Relay', () => {
|
describe('Waku Relay', () => {
|
||||||
afterEach(function () {
|
afterEach(function () {
|
||||||
if (this.currentTest?.state === 'failed') {
|
if (this.currentTest?.state === 'failed') {
|
||||||
|
@ -130,6 +133,8 @@ describe('Waku Relay', () => {
|
||||||
|
|
||||||
beforeEach(async function () {
|
beforeEach(async function () {
|
||||||
this.timeout(30_000);
|
this.timeout(30_000);
|
||||||
|
|
||||||
|
log('Create waku node');
|
||||||
waku = await Waku.create({
|
waku = await Waku.create({
|
||||||
staticNoiseKey: NOISE_KEY_1,
|
staticNoiseKey: NOISE_KEY_1,
|
||||||
listenAddresses: ['/ip4/0.0.0.0/tcp/0'],
|
listenAddresses: ['/ip4/0.0.0.0/tcp/0'],
|
||||||
|
@ -138,8 +143,10 @@ describe('Waku Relay', () => {
|
||||||
|
|
||||||
const multiAddrWithId = waku.getLocalMultiaddrWithID();
|
const multiAddrWithId = waku.getLocalMultiaddrWithID();
|
||||||
nimWaku = new NimWaku(makeLogFileName(this));
|
nimWaku = new NimWaku(makeLogFileName(this));
|
||||||
|
log('Starting nim-waku');
|
||||||
await nimWaku.start({ staticnode: multiAddrWithId });
|
await nimWaku.start({ staticnode: multiAddrWithId });
|
||||||
|
|
||||||
|
log('Waiting for heartbeat');
|
||||||
await new Promise((resolve) =>
|
await new Promise((resolve) =>
|
||||||
waku.libp2p.pubsub.once('gossipsub:heartbeat', resolve)
|
waku.libp2p.pubsub.once('gossipsub:heartbeat', resolve)
|
||||||
);
|
);
|
||||||
|
|
|
@ -14,7 +14,7 @@ import * as proto from '../proto/waku/v2/message';
|
||||||
import { existsAsync, mkdirAsync, openAsync } from './async_fs';
|
import { existsAsync, mkdirAsync, openAsync } from './async_fs';
|
||||||
import waitForLine from './log_file';
|
import waitForLine from './log_file';
|
||||||
|
|
||||||
const dbg = debug('nim-waku');
|
const dbg = debug('waku:nim-waku');
|
||||||
|
|
||||||
const NIM_WAKU_DEFAULT_P2P_PORT = 60000;
|
const NIM_WAKU_DEFAULT_P2P_PORT = 60000;
|
||||||
const NIM_WAKU_DEFAULT_RPC_PORT = 8545;
|
const NIM_WAKU_DEFAULT_RPC_PORT = 8545;
|
||||||
|
@ -114,7 +114,9 @@ export class NimWaku {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
dbg("Waiting to see 'RPC Server started' in nim-waku logs");
|
||||||
await this.waitForLog('RPC Server started');
|
await this.waitForLog('RPC Server started');
|
||||||
|
dbg('nim-waku node has been started');
|
||||||
}
|
}
|
||||||
|
|
||||||
public stop(): void {
|
public stop(): void {
|
||||||
|
|
Loading…
Reference in New Issue