Try waiting a few seconds before renaming
This commit is contained in:
@@ -11,6 +11,8 @@ import { DB_URL, dbLoc, testprojLoc } from "../global.helper";
|
||||
import fetch from "node-fetch";
|
||||
import { renameSync } from "fs";
|
||||
import { unzipToDirectoryConcurrently } from "../../../src/common/unzip-concurrently";
|
||||
import { platform } from "os";
|
||||
import { wait } from "./utils";
|
||||
|
||||
beforeAll(async () => {
|
||||
// ensure the test database is downloaded
|
||||
@@ -37,6 +39,11 @@ beforeAll(async () => {
|
||||
if (!existsSync(testprojLoc)) {
|
||||
console.log(`Unzipping test database to ${testprojLoc}`);
|
||||
await unzipToDirectoryConcurrently(dbLoc, dbParentDir);
|
||||
// On Windows, wait a few seconds to make sure all background processes
|
||||
// release their lock on the files before renaming the directory.
|
||||
if (platform() === "win32") {
|
||||
await wait(3000);
|
||||
}
|
||||
renameSync(join(dbParentDir, "db"), testprojLoc);
|
||||
console.log("Unzip completed.");
|
||||
}
|
||||
|
||||
@@ -7,3 +7,7 @@ import { join } from "path";
|
||||
export function getDataFolderFilePath(path: string): string {
|
||||
return join(workspace.workspaceFolders![0].uri.fsPath, path);
|
||||
}
|
||||
|
||||
export async function wait(ms = 1000) {
|
||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||
}
|
||||
|
||||
@@ -101,6 +101,9 @@ describe("local databases", () => {
|
||||
onStart: () => {
|
||||
/**/
|
||||
},
|
||||
onQueryRunStarting: () => {
|
||||
/**/
|
||||
},
|
||||
}),
|
||||
mockedObject<CodeQLCliServer>({
|
||||
resolveDatabase: resolveDatabaseSpy,
|
||||
|
||||
Reference in New Issue
Block a user