Skip to content

Commit

Permalink
simplify, longer timeout, more logs
Browse files Browse the repository at this point in the history
  • Loading branch information
jloleysens committed Aug 21, 2023
1 parent 0efae80 commit 6446381
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,11 @@ export const createServerlessES = () => {
});
const cluster = new Cluster({ log });

let started = false;
const api = {
start: async () => {
if (started) throw new Error('ES already started!');
await Promise.race([
cluster
.runServerless({
basePath: Path.join(REPO_ROOT, '.es/es_test_serverless'),
})
.then(() => {
started = true;
}),
new Promise((res) => setTimeout(res, 60000)).then(async () => {
if (!started) {
await api.stop().catch(() => undefined);
throw new Error(`could not start ES serverless in 60 seconds ( ,_,)`);
}
}),
]);
await cluster.runServerless({
basePath: Path.join(REPO_ROOT, '.es/es_test_serverless'),
});
},
stop: async () => {
// hack to stop the ES cluster
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
describe('smoke', () => {
let serverlessES: TestServerlessESUtils;
let serverlessKibana: TestServerlessKibanaUtils;
jest.setTimeout(300_000); // five mins :shrug:
jest.setTimeout(600_000);
beforeEach(() => {
serverlessES = createServerlessES();
serverlessKibana = createServerlessKibana();
Expand All @@ -28,6 +28,7 @@ describe('smoke', () => {
});
test('it can start Kibana and ES serverless', async () => {
async function doIt() {
console.log('ES STARTING');
await serverlessES.start();
console.log('ES STARTED');
await serverlessKibana.preboot();
Expand Down

0 comments on commit 6446381

Please sign in to comment.