refactor(benchmark): Separate cloud env provisioning from running benchmarks (#10657)

This commit is contained in:
Tomi Turtiainen
2024-09-04 13:14:41 +03:00
committed by GitHub
parent da44fe4b89
commit 8750b287f5
7 changed files with 113 additions and 64 deletions

View File

@@ -39,16 +39,9 @@ export async function runInCloud(config) {
isVerbose: config.isVerbose,
});
try {
const benchmarkEnv = await terraformClient.provisionEnvironment();
const benchmarkEnv = await terraformClient.getTerraformOutputs();
await runBenchmarksOnVm(config, benchmarkEnv);
} catch (error) {
console.error('An error occurred while running the benchmarks:');
console.error(error);
} finally {
await terraformClient.destroyEnvironment();
}
await runBenchmarksOnVm(config, benchmarkEnv);
}
async function ensureDependencies() {
@@ -117,7 +110,15 @@ async function runBenchmarkForN8nSetup({ config, sshClient, scriptsDir, n8nSetup
}
async function ensureVmIsReachable(sshClient) {
await sshClient.ssh('echo "VM is reachable"');
try {
await sshClient.ssh('echo "VM is reachable"');
} catch (error) {
console.error(`VM is not reachable: ${error.message}`);
console.error(
`Did you provision the cloud environment first with 'pnpm provision-cloud-env'? You can also run the benchmarks locally with 'pnpm run benchmark-locally'.`,
);
process.exit(1);
}
}
/**