Skip to content

Commit 88b9095

Browse files
authored
chore: one should be enough? (#3079)
* one should be enough? * add debugging * timeout closing compass before the afterAll can timeout
1 parent 3992792 commit 88b9095

File tree

3 files changed

+26
-19
lines changed

3 files changed

+26
-19
lines changed

.evergreen/functions.yml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -81,17 +81,9 @@ post:
8181
params:
8282
local_files_include_filter:
8383
- src/packages/compass-e2e-tests/.log/**/*
84-
- <<: *save-diagnostic-file
85-
params:
86-
local_files_include_filter:
8784
- src/packages/compass-e2e-tests/.nyc_output/coverage.json
88-
- <<: *save-diagnostic-file
89-
params:
90-
local_files_include_filter:
85+
- src/packages/compass-e2e-tests/.log/report.json
9186
- ~/.mongodb/runner/*.log
92-
- command: attach.results
93-
params:
94-
file_location: src/packages/compass-e2e-tests/.log/report.json
9587

9688
functions:
9789
clone:

packages/compass-e2e-tests/helpers/commands/shell-eval.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ export async function shellEval(
5757
} catch (err) {
5858
// just leave it unparsed for now if there's a parse error because
5959
// that's really helpful when debugging
60+
console.error('Could not parse result:', result);
6061
}
6162
}
6263

packages/compass-e2e-tests/helpers/compass.ts

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -628,18 +628,32 @@ export async function afterTests(
628628
await compass.capturePage(filename);
629629
}
630630

631-
try {
632-
await compass.stop(test);
633-
} catch (err) {
634-
debug('An error occurred while stopping compass:');
635-
debug(err);
631+
let timeoutId;
632+
const timeoutPromise = new Promise<void>((resolve) => {
633+
timeoutId = setTimeout(() => {
634+
console.error('It took too long to close compass');
635+
resolve();
636+
}, 30000);
637+
});
638+
639+
const closePromise = (async function close(): Promise<void> {
636640
try {
637-
// make sure the process can exit
638-
await compass.browser.deleteSession();
639-
} catch (_) {
640-
debug('browser already closed');
641+
await compass.stop(test);
642+
} catch (err) {
643+
debug('An error occurred while stopping compass:');
644+
debug(err);
645+
try {
646+
// make sure the process can exit
647+
await compass.browser.deleteSession();
648+
} catch (_) {
649+
debug('browser already closed');
650+
}
641651
}
642-
}
652+
clearTimeout(timeoutId);
653+
return;
654+
})();
655+
656+
return Promise.race([timeoutPromise, closePromise]);
643657
}
644658

645659
function pathName(text: string) {

0 commit comments

Comments
 (0)