Skip to content

Commit

Permalink
Merge pull request #23 from axiomhq/test/fix-e2e-edge-test
Browse files Browse the repository at this point in the history
WIP: test: wait 1sec after ingesting on edge
  • Loading branch information
dasfmi authored Jun 21, 2023
2 parents afb2393 + 06bf76f commit bad81b3
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion e2e/nextjs-app/test/ingest.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { Axiom } from '@axiomhq/js';
import { describe, it, expect, beforeAll, afterAll } from '@jest/globals';
import { describe, it, expect, beforeAll, afterAll, jest } from '@jest/globals';

jest.useRealTimers()

describe('Ingestion & query on different runtime', () => {
const axiom = new Axiom();
Expand All @@ -25,6 +27,8 @@ describe('Ingestion & query on different runtime', () => {
// call route that ingests logs
const resp = await fetch(process.env.TESTING_TARGET_URL + '/api/lambda');
expect(resp.status).toEqual(200);
const payload = await resp.json();
expect(payload.ingested).toEqual(2);

// check dataset for ingested logs
const qResp = await axiom.query(`['${datasetName}'] | where ['test'] == "ingest_on_lambda"`, {
Expand All @@ -41,6 +45,10 @@ describe('Ingestion & query on different runtime', () => {
// call route that ingests logs
const resp = await fetch(process.env.TESTING_TARGET_URL + '/api/edge');
expect(resp.status).toEqual(200);
const payload = await resp.json();
expect(payload.ingested).toEqual(2);

await new Promise(resolve => setTimeout(resolve, 1000)); // wait 1 sec

// check dataset for ingested logs
const qResp = await axiom.query(`['${datasetName}'] | where ['test'] == "ingest_on_edge"`, {
Expand Down

0 comments on commit bad81b3

Please sign in to comment.