e2e-test: pass through errors

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2022-04-04 14:50:07 +02:00
parent 5a968c2e52
commit d77cedd2ca
+25 -36
View File
@@ -43,50 +43,39 @@ const templatePackagePaths = [
];
export async function run() {
try {
const rootDir = await fs.mkdtemp(
resolvePath(os.tmpdir(), 'backstage-e2e-'),
);
print(`CLI E2E test root: ${rootDir}\n`);
const rootDir = await fs.mkdtemp(resolvePath(os.tmpdir(), 'backstage-e2e-'));
print(`CLI E2E test root: ${rootDir}\n`);
print('Building dist workspace');
const workspaceDir = await buildDistWorkspace('workspace', rootDir);
print('Building dist workspace');
const workspaceDir = await buildDistWorkspace('workspace', rootDir);
const isPostgres = Boolean(process.env.POSTGRES_USER);
print('Creating a Backstage App');
const appDir = await createApp(
'test-app',
isPostgres,
workspaceDir,
rootDir,
);
const isPostgres = Boolean(process.env.POSTGRES_USER);
print('Creating a Backstage App');
const appDir = await createApp('test-app', isPostgres, workspaceDir, rootDir);
print('Creating a Backstage Plugin');
const pluginName = await createPlugin('test-plugin', appDir);
print('Creating a Backstage Plugin');
const pluginName = await createPlugin('test-plugin', appDir);
print('Creating a Backstage Backend Plugin');
await createPlugin('test-plugin', appDir, ['--backend']);
print('Creating a Backstage Backend Plugin');
await createPlugin('test-plugin', appDir, ['--backend']);
print('Starting the app');
await testAppServe(pluginName, appDir);
print('Starting the app');
await testAppServe(pluginName, appDir);
print('Testing the backend startup');
await testBackendStart(appDir, isPostgres);
print('Testing the backend startup');
await testBackendStart(appDir, isPostgres);
if (process.env.CI) {
// Cleanup actually takes significant time, so skip it in CI since the
// runner will be destroyed anyway
print('All tests successful');
} else {
print('All tests successful, removing test dir');
await fs.remove(rootDir);
}
// Just in case some child process was left hanging
process.exit(0);
} catch {
process.exit(1);
if (process.env.CI) {
// Cleanup actually takes significant time, so skip it in CI since the
// runner will be destroyed anyway
print('All tests successful');
} else {
print('All tests successful, removing test dir');
await fs.remove(rootDir);
}
// Just in case some child process was left hanging
process.exit(0);
}
/**