Skip to content

DNS channel cancel tests do not work as intended #44428

Description

@tniessen

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   ...

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    dnsIssues and PRs related to the dns subsystem.testIssues and PRs related to Node.js core tests and test infrastructure.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions