|
1 |
| -/* eslint-disable @typescript-eslint/no-non-null-assertion */ |
2 |
| -import { Socket } from 'net'; |
3 | 1 | import * as path from 'path';
|
4 | 2 |
|
5 | 3 | import { loadSpecTests } from '../../spec';
|
6 | 4 | import { runUnifiedSuite } from '../../tools/unified-spec-runner/runner';
|
7 |
| -import { TestFilter } from '../../tools/unified-spec-runner/schema'; |
8 |
| -import { sleep } from '../../tools/utils'; |
9 |
| - |
10 |
| -const filter: TestFilter = ({ description }) => { |
11 |
| - switch (description) { |
12 |
| - case 'Network error on Monitor check': |
13 |
| - case 'Network timeout on Monitor check': |
14 |
| - return 'TODO(NODE-4608): Disallow parallel monitor checks'; |
15 |
| - default: |
16 |
| - return false; |
17 |
| - } |
18 |
| -}; |
19 | 5 |
|
20 | 6 | describe('SDAM Unified Tests', function () {
|
21 |
| - afterEach(async function () { |
22 |
| - if (this.currentTest!.pending) { |
23 |
| - return; |
24 |
| - } |
25 |
| - // TODO(NODE-4573): fix socket leaks |
26 |
| - const LEAKY_TESTS = [ |
27 |
| - 'Command error on Monitor handshake', |
28 |
| - 'Network error on Monitor check', |
29 |
| - 'Network timeout on Monitor check', |
30 |
| - 'Network error on Monitor handshake', |
31 |
| - 'Network timeout on Monitor handshake' |
32 |
| - ]; |
33 |
| - |
34 |
| - await sleep(250); |
35 |
| - const sockArray = (process as any)._getActiveHandles().filter(handle => { |
36 |
| - // Stdio are instanceof Socket so look for fd to be null |
37 |
| - return handle.fd == null && handle instanceof Socket && handle.destroyed !== true; |
38 |
| - }); |
39 |
| - if (!sockArray.length) { |
40 |
| - return; |
41 |
| - } |
42 |
| - for (const sock of sockArray) { |
43 |
| - sock.destroy(); |
44 |
| - } |
45 |
| - if (!LEAKY_TESTS.some(test => test === this.currentTest!.title)) { |
46 |
| - this.test!.error(new Error(`Test failed to clean up ${sockArray.length} socket(s)`)); |
47 |
| - } |
48 |
| - }); |
49 |
| - runUnifiedSuite(loadSpecTests(path.join('server-discovery-and-monitoring', 'unified')), filter); |
| 7 | + runUnifiedSuite(loadSpecTests(path.join('server-discovery-and-monitoring', 'unified'))); |
50 | 8 | });
|
0 commit comments