Skip to content
This repository was archived by the owner on Oct 31, 2024. It is now read-only.

Commit 0ac7597

Browse files
author
Amir Blum
authored
test(amqplib): reduce wait time after channel close (#85)
1 parent e3bd5ea commit 0ac7597

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/instrumentation-amqplib/test/amqplib-promise.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ describe('amqplib instrumentation promise model', function () {
3535
});
3636
after(async () => {
3737
await conn.close();
38-
// the 'close' event might take some time to arrive
39-
await new Promise((resolve) => setTimeout(resolve, 70));
4038
instrumentation.disable();
4139
});
4240

@@ -83,6 +81,9 @@ describe('amqplib instrumentation promise model', function () {
8381
afterEach(async () => {
8482
try {
8583
channel.close();
84+
// the 'close' event on the emitter might take some time to arrive after close promise ends,
85+
// we add small timeout to let it settle before going on to next
86+
await new Promise((resolve) => setTimeout(resolve, 5));
8687
} catch {}
8788
instrumentation.disable();
8889
});
@@ -224,7 +225,6 @@ describe('amqplib instrumentation promise model', function () {
224225
channel.ack(msgs[2]);
225226
channel.ack(msgs[0]);
226227
// assert all 3 span messages are ended
227-
console.log(memoryExporter.getFinishedSpans());
228228
expect(memoryExporter.getFinishedSpans().length).toBe(6);
229229
expectConsumeEndSpyStatus([EndOperation.Ack, EndOperation.Ack, EndOperation.Ack]);
230230
});

0 commit comments

Comments
 (0)