Skip to content

Commit 70a32e0

Browse files
add timeouts
Signed-off-by: Abhishek Choudhary <shreemaan.abhishek@gmail.com>
1 parent 7674a8d commit 70a32e0

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

t/plugin/lago.spec.mts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { existsSync } from 'node:fs';
1919
import { readFile, rm, writeFile } from 'node:fs/promises';
2020
import { promisify } from 'node:util';
2121

22-
import { afterAll, beforeAll, describe, expect, it } from '@jest/globals';
22+
import { afterAll, beforeAll, describe, expect, it, jest } from '@jest/globals';
2323
import axios from 'axios';
2424
import * as compose from 'docker-compose';
2525
import { gql, request } from 'graphql-request';
@@ -69,6 +69,7 @@ const launchLago = async () => {
6969
cwd: LAGO_PATH,
7070
log: true,
7171
env: {
72+
...process.env,
7273
LAGO_RSA_PRIVATE_KEY: Buffer.from(privateKey).toString('base64'),
7374
FRONT_PORT: `${LAGO_FRONT_PORT}`, // avoiding conflicts, tests do not require a front-end
7475
API_PORT: `${LAGO_API_PORT}`,
@@ -302,7 +303,7 @@ describe('Plugin - Lago', () => {
302303
}),
303304
).resolves.not.toThrow();
304305
console.log(`[${new Date().toLocaleTimeString()}] created routes`)
305-
});
306+
}, 5 * 1000);
306307

307308
it('should create consumer', async () => {
308309
console.log(`[${new Date().toLocaleTimeString()}] creating consumer`)
@@ -322,7 +323,7 @@ describe('Plugin - Lago', () => {
322323
const res = await client.get('/hello', { validateStatus: () => true });
323324
expect(res.status).toEqual(401);
324325
console.log(`[${new Date().toLocaleTimeString()}] called API without key`)
325-
});
326+
}, 5 * 1000);
326327

327328
it('call normal API', async () => {
328329
console.log(`[${new Date().toLocaleTimeString()}] calling normal API`)
@@ -333,7 +334,7 @@ describe('Plugin - Lago', () => {
333334
}
334335
await wait(500);
335336
console.log(`[${new Date().toLocaleTimeString()}] called normal API`)
336-
});
337+
}, 5 * 1000);
337338

338339
it('check Lago events (normal API)', async () => {
339340
console.log(`[${new Date().toLocaleTimeString()}] checking Lago events (normal API)`)
@@ -344,7 +345,7 @@ describe('Plugin - Lago', () => {
344345
expect(data.events).toHaveLength(3);
345346
expect(data.events[0].code).toEqual(LAGO_BILLABLE_METRIC_CODE);
346347
console.log(`[${new Date().toLocaleTimeString()}] checked Lago events (normal API)`)
347-
});
348+
}, 5 * 1000);
348349

349350
let expensiveStartAt: Date;
350351
it('call expensive API', async () => {
@@ -357,7 +358,7 @@ describe('Plugin - Lago', () => {
357358
}
358359
await wait(500);
359360
console.log(`[${new Date().toLocaleTimeString()}] called expensive API`)
360-
});
361+
}, 5 * 1000);
361362

362363
it('check Lago events (expensive API)', async () => {
363364
console.log(`[${new Date().toLocaleTimeString()}] checking Lago events (expensive API)`)
@@ -370,5 +371,5 @@ describe('Plugin - Lago', () => {
370371
expect(data.events[0].code).toEqual(LAGO_BILLABLE_METRIC_CODE);
371372
expect(data.events[1].properties).toEqual({ tier: 'expensive' });
372373
console.log(`[${new Date().toLocaleTimeString()}] checked Lago events (expensive API)`)
373-
});
374+
}, 5 * 1000);
374375
});

t/plugin/lago.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ property "event_properties" validation failed: wrong type: expected object, got
6767
6868
6969
=== TEST 2: test
70-
--- timeout: 300
70+
--- timeout: 302
7171
--- max_size: 2048000
7272
--- exec
7373
cd t && pnpm test plugin/lago.spec.mts 2>&1

0 commit comments

Comments
 (0)