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:
bors[bot] 2021-05-10 13:31:55 +00:00 committed by GitHub
commit cc35941803
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 1 deletions

View File

@ -97,6 +97,8 @@ jobs:
[ $(git status --short --ignore-submodules|wc -l) -eq 0 ]
- name: test
env:
DEBUG: "waku:nim-waku*,waku:test*"
run: npm run test
- name: Upload logs on failure

View File

@ -1,4 +1,5 @@
import { expect } from 'chai';
import debug from 'debug';
import TCP from 'libp2p-tcp';
import {
@ -13,6 +14,8 @@ import { WakuMessage } from '../waku_message';
import { RelayCodec, RelayDefaultTopic } from './index';
const log = debug('waku:test');
describe('Waku Relay', () => {
afterEach(function () {
if (this.currentTest?.state === 'failed') {
@ -130,6 +133,8 @@ describe('Waku Relay', () => {
beforeEach(async function () {
this.timeout(30_000);
log('Create waku node');
waku = await Waku.create({
staticNoiseKey: NOISE_KEY_1,
listenAddresses: ['/ip4/0.0.0.0/tcp/0'],
@ -138,8 +143,10 @@ describe('Waku Relay', () => {
const multiAddrWithId = waku.getLocalMultiaddrWithID();
nimWaku = new NimWaku(makeLogFileName(this));
log('Starting nim-waku');
await nimWaku.start({ staticnode: multiAddrWithId });
log('Waiting for heartbeat');
await new Promise((resolve) =>
waku.libp2p.pubsub.once('gossipsub:heartbeat', resolve)
);

View File

@ -14,7 +14,7 @@ import * as proto from '../proto/waku/v2/message';
import { existsAsync, mkdirAsync, openAsync } from './async_fs';
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_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');
dbg('nim-waku node has been started');
}
public stop(): void {