Skip to content

Commit

Permalink
test: mark test-worker-debug as flaky
Browse files Browse the repository at this point in the history
Also try to make more traceable.

PR-URL: #28035
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
  • Loading branch information
refack authored and BridgeAR committed Jun 17, 2019
1 parent 098cf74 commit 3feaf3d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 15 deletions.
2 changes: 2 additions & 0 deletions test/parallel/parallel.status
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ test-worker-memory: PASS,FLAKY
# https://github.com/nodejs/node/issues/20750
test-http2-client-upload: PASS,FLAKY
test-http2-client-upload-reject: PASS,FLAKY
# https://github.com/nodejs/node/issues/28106
test-worker-debug: PASS,FLAKY

[$system==linux]

Expand Down
34 changes: 19 additions & 15 deletions test/parallel/test-worker-debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,14 @@ class WorkerSession extends EventEmitter {
this.emit(message.method, message);
return;
}
const callback = this._requestCallbacks.get(message.id);
if (callback) {
this._requestCallbacks.delete(message.id);
if (message.error)
callback[1](message.error.message);
else
callback[0](message.result);
}
if (!this._requestCallbacks.has(message.id))
return;
const [ resolve, reject ] = this._requestCallbacks.get(message.id);
this._requestCallbacks.delete(message.id);
if (message.error)
reject(new Error(message.error.message));
else
resolve(message.result);
}

async waitForBreakAfterCommand(command, script, line) {
Expand Down Expand Up @@ -144,7 +144,7 @@ async function testBasicWorkerDebug(session, post) {
assert.strictEqual(waitingForDebugger, true);
const detached = waitForWorkerDetach(session, sessionId);
const workerSession = new WorkerSession(session, sessionId);
const contextEvents = Promise.all([
const contextEventPromises = Promise.all([
waitForEvent(workerSession, 'Runtime.executionContextCreated'),
waitForEvent(workerSession, 'Runtime.executionContextDestroyed')
]);
Expand All @@ -156,9 +156,10 @@ async function testBasicWorkerDebug(session, post) {
'Runtime.runIfWaitingForDebugger', __filename, 1);
await workerSession.waitForBreakAfterCommand(
'Debugger.resume', __filename, 26); // V8 line number is zero-based
assert.strictEqual(await consolePromise, workerMessage);
const msg = await consolePromise;
assert.strictEqual(msg, workerMessage);
workerSession.post('Debugger.resume');
await Promise.all([worker, detached, contextEvents]);
await Promise.all([worker, detached, contextEventPromises]);
}

async function testNoWaitOnStart(session, post) {
Expand Down Expand Up @@ -252,7 +253,7 @@ async function testWaitForDisconnectInWorker(session, post) {
sessionWithoutWaiting.disconnect();
}

async function test() {
(async function test() {
const session = new Session();
session.connect();
const post = doPost.bind(null, session);
Expand All @@ -264,11 +265,14 @@ async function test() {
await runWorker(1);

await testNoWaitOnStart(session, post);

await testTwoWorkers(session, post);

await testWaitForDisconnectInWorker(session, post);

session.disconnect();
console.log('Test done');
}

test();
})().catch((err) => {
console.error(err);
process.abort();
});

0 comments on commit 3feaf3d

Please sign in to comment.