Skip to content

Commit 2352869

Browse files
committed
test/gopls: add time out in language client stop
Flush the trace if language server is still running after stop returns. For #2454 Change-Id: I14b224e440d6208a31b3ed3cb16d68481254fc20 Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/446297 TryBot-Result: kokoro <[email protected]> Reviewed-by: Suzy Mueller <[email protected]> Run-TryBot: Hyang-Ah Hana Kim <[email protected]>
1 parent 40074a4 commit 2352869

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

test/gopls/extension.test.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,20 @@ class Env {
116116
}
117117

118118
public async teardown() {
119-
await this.languageClient?.stop();
120-
for (const d of this.disposables) {
121-
d.dispose();
119+
try {
120+
await this.languageClient?.stop(1_000); // 1s timeout
121+
} catch (e) {
122+
console.log(`failed to stop gopls within 1sec: ${e}`);
123+
} finally {
124+
if (this.languageClient?.isRunning()) {
125+
console.log(`failed to stop language client on time: ${this.languageClient?.state}`);
126+
this.flushTrace(true);
127+
}
128+
for (const d of this.disposables) {
129+
d.dispose();
130+
}
131+
this.languageClient = undefined;
122132
}
123-
this.languageClient = undefined;
124133
}
125134

126135
public async openDoc(...paths: string[]) {

0 commit comments

Comments
 (0)