Skip to content

Commit c63166e

Browse files
committed
Fix http tests
1 parent 266f781 commit c63166e

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

desktop/panel/http.test.js

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ const USERDATA_FILES = ['json', 'xlsx', 'csv', 'parquet', 'jsonl', 'cjson'];
3434
const PORT = '9799';
3535
const PORT2 = '9798';
3636

37-
let server, server2;
37+
let server = {},
38+
server2 = {};
3839
// Kill the existing server if it wasn't killed correctly already.
3940
beforeAll(async () => {
4041
// TODO: port this logic to other platforms...
@@ -51,8 +52,22 @@ beforeAll(async () => {
5152
}
5253

5354
// Start a new server for all tests
54-
server = spawn('python3', ['-m', 'http.server', PORT]);
55-
server2 = spawn('httpmirror', [PORT2]);
55+
while (true) {
56+
server = spawn('python3', ['-m', 'http.server', PORT]);
57+
if (server.pid !== undefined) {
58+
break;
59+
}
60+
61+
await new Promise((r) => setTimeout(r, 1000));
62+
}
63+
while (true) {
64+
server2 = spawn('httpmirror', [PORT2]);
65+
if (server2.pid !== undefined) {
66+
break;
67+
}
68+
69+
await new Promise((r) => setTimeout(r, 1000));
70+
}
5671

5772
[server, server2].forEach((server) => {
5873
server.stdout.on('data', (data) => {

0 commit comments

Comments
 (0)