Skip to content

Commit 7eb939b

Browse files
committed
Wait for update server to close
1 parent 110b4a6 commit 7eb939b

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

packages/compass-smoke-tests/src/tests/auto-update-from.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import assert from 'node:assert/strict';
2-
import fs from 'node:fs';
2+
33
import createDebug from 'debug';
4+
45
import { type SmokeTestsContext } from '../context';
56
import { getInstaller } from '../installers';
67
import { createSandbox } from '../directories';
78
import { getTestSubject } from '../test-subject';
89
import { executeAsync } from '../execute';
9-
import { startAutoUpdateServer } from './update-server';
10+
import { startAutoUpdateServer, stopAutoUpdateServer } from './update-server';
1011

1112
const debug = createDebug('compass:smoketests:auto-update-from');
1213

@@ -66,7 +67,7 @@ export async function testAutoUpdateFrom(context: SmokeTestsContext) {
6667
);
6768
} finally {
6869
debug('Stopping auto-update server');
69-
server.close();
70+
await stopAutoUpdateServer(server);
7071
delete process.env.UPDATE_CHECKER_ALLOW_DOWNGRADES;
7172
}
7273
} finally {

packages/compass-smoke-tests/src/tests/auto-update-to.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { createSandbox } from '../directories';
77
import { getTestSubjectDetails } from '../test-subject';
88
import { executeAsync } from '../execute';
99
import { getLatestRelease, getLatestReleaseKindByKind } from '../releases';
10-
import { startAutoUpdateServer } from './update-server';
10+
import { startAutoUpdateServer, stopAutoUpdateServer } from './update-server';
1111

1212
const debug = createDebug('compass:smoketests:auto-update-to');
1313

@@ -100,7 +100,7 @@ export async function testAutoUpdateTo(context: SmokeTestsContext) {
100100
);
101101
} finally {
102102
debug('Stopping auto-update server');
103-
server.close();
103+
await stopAutoUpdateServer(server);
104104
delete process.env.DEV_RELEASE;
105105
delete process.env.PUBLISHED_RELEASES;
106106
delete process.env.UPDATE_CHECKER_ALLOW_DOWNGRADES;

packages/compass-smoke-tests/src/tests/update-server.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
import { once } from 'node:events';
2+
import type http from 'node:http';
3+
import { promisify } from 'node:util';
4+
25
import createDebug from 'debug';
36

47
const debug = createDebug('compass:smoketests:update-server');
@@ -20,3 +23,7 @@ export async function startAutoUpdateServer() {
2023

2124
return httpServer;
2225
}
26+
27+
export async function stopAutoUpdateServer(server: http.Server) {
28+
await promisify(server.close.bind(server))();
29+
}

0 commit comments

Comments
 (0)