Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DNS channel cancel tests do not work as intended #44428

Closed
tniessen opened this issue Aug 28, 2022 · 0 comments · Fixed by #44432
Closed

DNS channel cancel tests do not work as intended #44428

tniessen opened this issue Aug 28, 2022 · 0 comments · Fixed by #44432
Labels
dns Issues and PRs related to the dns subsystem. test Issues and PRs related to the tests.

Comments

@tniessen
Copy link
Member

See #44022 (comment).

test/parallel/test-dns-channel-cancel-promise.js and test/parallel/test-dns-channel-cancel.js do not work as intended.

Both tests use mustNotCall() incorrectly, passing mustNotCall (i.e., a utility function that returns a function) when they should likely be passing mustNotCall() (i.e., the function returned by mustNotCall). However, properly using mustNotCall() (as in #44022) leads to failures because the function is indeed being called when the tests say that it should not be.

const addMessageListener = () => {
server.removeAllListeners('message');
server.once('message', () => {
server.once('message', common.mustNotCall);
resolver.cancel();
});
};

const addMessageListener = () => {
server.removeAllListeners('message');
server.once('message', () => {
server.once('message', common.mustNotCall);
resolver.cancel();
});
};

Example output in #44022:

16:49:21 not ok 575 parallel/test-dns-channel-cancel
16:49:21   ---
16:49:21   duration_ms: 0.116
16:49:21   severity: fail
16:49:21   exitcode: 1
16:49:21   stack: |-
16:49:21     node:assert:171
16:49:21       throw err;
16:49:21       ^
16:49:21     
16:49:21     AssertionError [ERR_ASSERTION]: function should not have been called at /home/iojs/build/workspace/node-test-commit-linuxone/test/parallel/test-dns-channel-cancel.js:17
16:49:21     called with arguments: <Buffer b0 9b 01 00 00 01 00 00 00 00 00 00 08 65 78 61 6d 70 6c 65 32 03 6f 72 67 00 00 01 00 01>, { address: '127.0.0.1', family: 'IPv4', port: 60918, size: 30 }
16:49:21         at Socket.mustNotCall (/home/iojs/build/workspace/node-test-commit-linuxone/test/common/index.js:522:12)
16:49:21         at Object.onceWrapper (node:events:628:26)
16:49:21         at Socket.emit (node:events:513:28)
16:49:21         at UDP.onMessage [as onmessage] (node:dgram:930:8) {
16:49:21       generatedMessage: false,
16:49:21       code: 'ERR_ASSERTION',
16:49:21       actual: undefined,
16:49:21       expected: undefined,
16:49:21       operator: 'fail'
16:49:21     }
16:49:21     
16:49:21     Node.js v19.0.0-pre
16:49:21   ...
16:49:21 not ok 576 parallel/test-dns-channel-cancel-promise
16:49:21   ---
16:49:21   duration_ms: 0.59
16:49:21   severity: fail
16:49:21   exitcode: 1
16:49:21   stack: |-
16:49:21     node:assert:171
16:49:21       throw err;
16:49:21       ^
16:49:21     
16:49:21     AssertionError [ERR_ASSERTION]: function should not have been called at /home/iojs/build/workspace/node-test-commit-linuxone/test/parallel/test-dns-channel-cancel-promise.js:14
16:49:21     called with arguments: <Buffer b0 9b 01 00 00 01 00 00 00 00 00 00 08 65 78 61 6d 70 6c 65 32 03 6f 72 67 00 00 01 00 01>, { address: '127.0.0.1', family: 'IPv4', port: 33976, size: 30 }
16:49:21         at Socket.mustNotCall (/home/iojs/build/workspace/node-test-commit-linuxone/test/common/index.js:522:12)
16:49:21         at Object.onceWrapper (node:events:628:26)
16:49:21         at Socket.emit (node:events:513:28)
16:49:21         at UDP.onMessage [as onmessage] (node:dgram:930:8) {
16:49:21       generatedMessage: false,
16:49:21       code: 'ERR_ASSERTION',
16:49:21       actual: undefined,
16:49:21       expected: undefined,
16:49:21       operator: 'fail'
16:49:21     }
16:49:21     
16:49:21     Node.js v19.0.0-pre
16:49:21   ...
@tniessen tniessen added dns Issues and PRs related to the dns subsystem. test Issues and PRs related to the tests. labels Aug 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dns Issues and PRs related to the dns subsystem. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant