Skip to content

Commit

Permalink
smoke - diagnose failing backup test
Browse files Browse the repository at this point in the history
  • Loading branch information
bpasero committed Nov 29, 2021
1 parent fc55e8c commit 5bb6533
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/smoke/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"mkdirp": "^1.0.4",
"ncp": "^2.0.0",
"node-fetch": "^2.6.1",
"readdirp": "^3.6.0",
"rimraf": "3.0.2",
"vscode-test": "^1.6.1"
},
Expand Down
24 changes: 24 additions & 0 deletions test/smoke/src/areas/workbench/data-migration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@

import { Application, ApplicationOptions, Quality } from '../../../../automation';
import { ParsedArgs } from 'minimist';
import * as readdirp from 'readdirp';
import { afterSuite, getRandomUserDataDir, startApp } from '../../utils';
import { join } from 'path';
import { readFileSync } from 'fs';

export function setup(opts: ParsedArgs) {

Expand Down Expand Up @@ -158,12 +161,33 @@ export function setup(opts: ParsedArgs) {
await stableApp.stop();
stableApp = undefined;

const backupsHome = join(userDataDir, 'Backups');
console.log('Printing backup contents (after stable app stopped):');
for await (const entry of readdirp(backupsHome)) {
try {
const contents = readFileSync(join(backupsHome, entry.path)).toString();
console.log(`${entry.path}: ${contents.substring(0, contents.indexOf('\n'))}`);
} catch (error) {
console.log(`${entry.path}: Error reading file: ${error}`);
}
}

const insiderOptions: ApplicationOptions = Object.assign({}, this.defaultOptions);
insiderOptions.userDataDir = userDataDir;

insidersApp = new Application(insiderOptions);
await insidersApp.start();

console.log('Printing backup contents (after insiders app started):');
for await (const entry of readdirp(backupsHome)) {
try {
const contents = readFileSync(join(backupsHome, entry.path)).toString();
console.log(`${entry.path}: ${contents.substring(0, contents.indexOf('\n'))}`);
} catch (error) {
console.log(`${entry.path}: Error reading file: ${error}`);
}
}

await insidersApp.workbench.editors.waitForTab(readmeMd, true);
await insidersApp.workbench.quickaccess.openFile(readmeMd);
await insidersApp.workbench.editor.waitForEditorContents(readmeMd, c => c.indexOf(textToType) > -1);
Expand Down
12 changes: 12 additions & 0 deletions test/smoke/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,11 @@ path-type@^3.0.0:
dependencies:
pify "^3.0.0"

picomatch@^2.2.1:
version "2.3.0"
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.0.tgz#f1f061de8f6a4bf022892e2d128234fb98302972"
integrity sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==

pidtree@^0.3.0:
version "0.3.1"
resolved "https://registry.yarnpkg.com/pidtree/-/pidtree-0.3.1.tgz#ef09ac2cc0533df1f3250ccf2c4d366b0d12114a"
Expand Down Expand Up @@ -640,6 +645,13 @@ readable-stream@^2.0.2, readable-stream@~2.3.6:
string_decoder "~1.1.1"
util-deprecate "~1.0.1"

readdirp@^3.6.0:
version "3.6.0"
resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.6.0.tgz#74a370bd857116e245b29cc97340cd431a02a6c7"
integrity sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==
dependencies:
picomatch "^2.2.1"

resolve@^1.10.0:
version "1.19.0"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.19.0.tgz#1af5bf630409734a067cae29318aac7fa29a267c"
Expand Down

0 comments on commit 5bb6533

Please sign in to comment.