Fix running integration tests

The main fix is in `telemetry.ts:213`.
This commit is contained in:
Andrew Eisenberg
2021-06-10 15:52:59 -07:00
parent 1d414bac55
commit b1e28f6b7d
6 changed files with 19 additions and 8 deletions

View File

@@ -126,7 +126,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
version: ['v2.2.6', 'v2.3.3', 'v2.4.5', 'v2.4.6', 'v2.5.5']
version: ['v2.2.6', 'v2.3.3', 'v2.4.6', 'v2.5.5']
env:
CLI_VERSION: ${{ matrix.version }}
TEST_CODEQL_PATH: '${{ github.workspace }}/codeql'

View File

@@ -976,6 +976,7 @@ const lineEndings = ['\r\n', '\r', '\n'];
*/
async function logStream(stream: Readable, logger: Logger): Promise<void> {
for await (const line of await splitStreamAtSeparators(stream, lineEndings)) {
// Await the result of log here in order to ensure the logs are written in the correct order.
await logger.log(line);
}
}

View File

@@ -763,7 +763,7 @@ export class DatabaseManager extends DisposableObject {
item: DatabaseItem
) {
this._databaseItems.push(item);
this.updatePersistedDatabaseList();
await this.updatePersistedDatabaseList();
// Add this database item to the allow-list
// Database items reconstituted from persisted state
@@ -780,7 +780,7 @@ export class DatabaseManager extends DisposableObject {
public async renameDatabaseItem(item: DatabaseItem, newName: string) {
item.name = newName;
this.updatePersistedDatabaseList();
await this.updatePersistedDatabaseList();
this._onDidChangeDatabaseItem.fire({
// pass undefined so that the entire tree is rebuilt in order to re-sort
item: undefined,
@@ -800,7 +800,7 @@ export class DatabaseManager extends DisposableObject {
if (index >= 0) {
this._databaseItems.splice(index, 1);
}
this.updatePersistedDatabaseList();
await this.updatePersistedDatabaseList();
// Delete folder from workspace, if it is still there
const folderIndex = (vscode.workspace.workspaceFolders || []).findIndex(
@@ -862,8 +862,8 @@ export class DatabaseManager extends DisposableObject {
this._currentDatabaseItem.databaseUri.toString(true) : undefined);
}
private updatePersistedDatabaseList(): void {
void this.ctx.workspaceState.update(DB_LIST, this._databaseItems.map(item => item.getPersistedState()));
private async updatePersistedDatabaseList(): Promise<void> {
await this.ctx.workspaceState.update(DB_LIST, this._databaseItems.map(item => item.getPersistedState()));
}
private isExtensionControlledLocation(uri: vscode.Uri) {

View File

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

View File

@@ -39,7 +39,7 @@ const _10MB = _1MB * 10;
// CLI version to test. Hard code the latest as default. And be sure
// to update the env if it is not otherwise set.
const CLI_VERSION = process.env.CLI_VERSION || 'v2.4.2';
const CLI_VERSION = process.env.CLI_VERSION || 'v2.5.5';
process.env.CLI_VERSION = CLI_VERSION;
// Base dir where CLIs will be downloaded into

View File

@@ -128,6 +128,14 @@ function getLaunchArgs(dir: TestDir) {
return [
'--disable-gpu',
path.resolve(__dirname, '../../test/data'),
// explicitly disable extensions that are known to interfere with the CLI integration tests
'--disable-extension',
'eamodio.gitlens',
'--disable-extension',
'github.codespaces',
'--disable-extension',
'github.copilot',
process.env.TEST_CODEQL_PATH!
];