Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions test/instrumentation/modules/undici/fetch.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,8 @@ const apm = require('../../../..').start({
});

const http = require('http');
const { promisify } = require('util');
const test = require('tape');

const promisyApmFlush = promisify(apm.flush.bind(apm));
let server;
let origin;
let lastServerReq;
Expand Down Expand Up @@ -116,7 +114,7 @@ test('fetch', async (t) => {
t.equal(text, 'pong', 'response body');

aTrans.end();
t.error(await promisyApmFlush(), 'no apm.flush() error');
t.error(await apm.flush(), 'no apm.flush() error');

t.equal(apm._apmClient.spans.length, 1);
const span = apm._apmClient.spans[0];
Expand Down
12 changes: 5 additions & 7 deletions test/instrumentation/modules/undici/undici.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,11 @@ if (isUndiciIncompat) {

const http = require('http');
const { Writable } = require('stream');
const { promisify } = require('util');
const semver = require('semver');
const test = require('tape');
const undici = require('undici');
const undiciVer = require('undici/package.json').version;

const promisyApmFlush = promisify(apm.flush.bind(apm));
let server;
let origin;
let lastServerReq;
Expand Down Expand Up @@ -137,7 +135,7 @@ test('undici.request', async (t) => {
await consumeResponseBody(body);

aTrans.end();
t.error(await promisyApmFlush(), 'no apm.flush() error');
t.error(await apm.flush(), 'no apm.flush() error');

t.equal(apm._apmClient.spans.length, 1);
const span = apm._apmClient.spans[0];
Expand Down Expand Up @@ -181,7 +179,7 @@ test('undici.stream', async (t) => {
t.equal(chunks.join(''), 'pong', 'response body');

aTrans.end();
t.error(await promisyApmFlush(), 'no apm.flush() error');
t.error(await apm.flush(), 'no apm.flush() error');

t.equal(apm._apmClient.spans.length, 1);
const span = apm._apmClient.spans[0];
Expand All @@ -202,7 +200,7 @@ if (undici.fetch) {
t.equal(text, 'pong', 'response body');

aTrans.end();
t.error(await promisyApmFlush(), 'no apm.flush() error');
t.error(await apm.flush(), 'no apm.flush() error');

t.equal(apm._apmClient.spans.length, 1);
const span = apm._apmClient.spans[0];
Expand All @@ -229,7 +227,7 @@ if (global.AbortController) {
t.ok(reqErr, 'got a request error');

aTrans.end();
t.error(await promisyApmFlush(), 'no apm.flush() error');
t.error(await apm.flush(), 'no apm.flush() error');

t.equal(apm._apmClient.spans.length, 1);
const span = apm._apmClient.spans[0];
Expand Down Expand Up @@ -291,7 +289,7 @@ test('undici no duplicate headers', async (t) => {
await consumeResponseBody(body);

aTrans.end();
t.error(await promisyApmFlush(), 'no apm.flush() error');
t.error(await apm.flush(), 'no apm.flush() error');

t.equal(apm._apmClient.spans.length, 1);
const span = apm._apmClient.spans[0];
Expand Down
Loading