Skip to content

Commit b1e28f6

Browse files
committed
Fix running integration tests
The main fix is in `telemetry.ts:213`.
1 parent 1d414ba commit b1e28f6

File tree

6 files changed

+19
-8
lines changed

6 files changed

+19
-8
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ jobs:
126126
strategy:
127127
matrix:
128128
os: [ubuntu-latest, windows-latest]
129-
version: ['v2.2.6', 'v2.3.3', 'v2.4.5', 'v2.4.6', 'v2.5.5']
129+
version: ['v2.2.6', 'v2.3.3', 'v2.4.6', 'v2.5.5']
130130
env:
131131
CLI_VERSION: ${{ matrix.version }}
132132
TEST_CODEQL_PATH: '${{ github.workspace }}/codeql'

extensions/ql-vscode/src/cli.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -976,6 +976,7 @@ const lineEndings = ['\r\n', '\r', '\n'];
976976
*/
977977
async function logStream(stream: Readable, logger: Logger): Promise<void> {
978978
for await (const line of await splitStreamAtSeparators(stream, lineEndings)) {
979+
// Await the result of log here in order to ensure the logs are written in the correct order.
979980
await logger.log(line);
980981
}
981982
}

extensions/ql-vscode/src/databases.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@ export class DatabaseManager extends DisposableObject {
763763
item: DatabaseItem
764764
) {
765765
this._databaseItems.push(item);
766-
this.updatePersistedDatabaseList();
766+
await this.updatePersistedDatabaseList();
767767

768768
// Add this database item to the allow-list
769769
// Database items reconstituted from persisted state
@@ -780,7 +780,7 @@ export class DatabaseManager extends DisposableObject {
780780

781781
public async renameDatabaseItem(item: DatabaseItem, newName: string) {
782782
item.name = newName;
783-
this.updatePersistedDatabaseList();
783+
await this.updatePersistedDatabaseList();
784784
this._onDidChangeDatabaseItem.fire({
785785
// pass undefined so that the entire tree is rebuilt in order to re-sort
786786
item: undefined,
@@ -800,7 +800,7 @@ export class DatabaseManager extends DisposableObject {
800800
if (index >= 0) {
801801
this._databaseItems.splice(index, 1);
802802
}
803-
this.updatePersistedDatabaseList();
803+
await this.updatePersistedDatabaseList();
804804

805805
// Delete folder from workspace, if it is still there
806806
const folderIndex = (vscode.workspace.workspaceFolders || []).findIndex(
@@ -862,8 +862,8 @@ export class DatabaseManager extends DisposableObject {
862862
this._currentDatabaseItem.databaseUri.toString(true) : undefined);
863863
}
864864

865-
private updatePersistedDatabaseList(): void {
866-
void this.ctx.workspaceState.update(DB_LIST, this._databaseItems.map(item => item.getPersistedState()));
865+
private async updatePersistedDatabaseList(): Promise<void> {
866+
await this.ctx.workspaceState.update(DB_LIST, this._databaseItems.map(item => item.getPersistedState()));
867867
}
868868

869869
private isExtensionControlledLocation(uri: vscode.Uri) {

extensions/ql-vscode/src/telemetry.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,8 @@ export let telemetryListener: TelemetryListener;
209209

210210
export async function initializeTelemetry(extension: Extension<any>, ctx: ExtensionContext): Promise<void> {
211211
telemetryListener = new TelemetryListener(extension.id, extension.packageJSON.version, key, ctx);
212-
await telemetryListener.initialize();
212+
// do not await initialization, since doing so will sometimes cause a modal popup.
213+
// this is a particular problem during integration tests, which will hang if a modal popup is displayed.
214+
void telemetryListener.initialize();
213215
ctx.subscriptions.push(telemetryListener);
214216
}

extensions/ql-vscode/src/vscode-tests/ensureCli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const _10MB = _1MB * 10;
3939

4040
// CLI version to test. Hard code the latest as default. And be sure
4141
// to update the env if it is not otherwise set.
42-
const CLI_VERSION = process.env.CLI_VERSION || 'v2.4.2';
42+
const CLI_VERSION = process.env.CLI_VERSION || 'v2.5.5';
4343
process.env.CLI_VERSION = CLI_VERSION;
4444

4545
// Base dir where CLIs will be downloaded into

extensions/ql-vscode/src/vscode-tests/run-integration-tests.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,14 @@ function getLaunchArgs(dir: TestDir) {
128128
return [
129129
'--disable-gpu',
130130
path.resolve(__dirname, '../../test/data'),
131+
132+
// explicitly disable extensions that are known to interfere with the CLI integration tests
133+
'--disable-extension',
134+
'eamodio.gitlens',
135+
'--disable-extension',
136+
'github.codespaces',
137+
'--disable-extension',
138+
'github.copilot',
131139
process.env.TEST_CODEQL_PATH!
132140
];
133141

0 commit comments

Comments
 (0)