Skip to content

Commit

Permalink
smoke test tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
bpasero committed Nov 29, 2021
1 parent 3604f3d commit 1af6cb0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
18 changes: 12 additions & 6 deletions test/automation/src/playwrightDriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,18 +279,24 @@ async function launchBrowser(options: PlaywrightOptions, endpoint: string, works
}

async function teardown(server: ChildProcess): Promise<void> {
const serverPid = server.pid;
if (typeof serverPid !== 'number') {
return;
}

let retries = 0;
while (retries < 3) {
retries++;

try {
if (typeof server.pid === 'number') {
await promisify(kill)(server.pid);
}

return;
return await promisify(kill)(serverPid);
} catch (error) {
console.warn(`Error tearing down server (pid: ${server.pid}, attempt: ${retries}): ${error}`);
try {
process.kill(serverPid, 0); // throws an exception if the process doesn't exist anymore
console.warn(`Error tearing down server (pid: ${serverPid}, attempt: ${retries}): ${error}`);
} catch (error) {
return; // Expected when process is gone
}
}
}

Expand Down
6 changes: 6 additions & 0 deletions test/smoke/src/areas/workbench/data-migration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ export function setup(opts: ParsedArgs) {
const backupsHome = join(userDataDir, 'Backups');
console.log('Printing backup contents (after stable app stopped):');
for await (const entry of readdirp(backupsHome)) {
if (entry.path === 'workspaces.json') {
continue;
}
try {
const contents = readFileSync(join(backupsHome, entry.path)).toString();
const firstLine = contents.substring(0, contents.indexOf('\n'));
Expand All @@ -186,6 +189,9 @@ export function setup(opts: ParsedArgs) {

console.log('Printing backup contents (after insiders app started):');
for await (const entry of readdirp(backupsHome)) {
if (entry.path === 'workspaces.json') {
continue;
}
try {
const contents = readFileSync(join(backupsHome, entry.path)).toString();
const firstLine = contents.substring(0, contents.indexOf('\n'));
Expand Down

0 comments on commit 1af6cb0

Please sign in to comment.