Skip to content

Commit

Permalink
[Event Hubs] Add test for exceeding max listeners on send (#4637)
Browse files Browse the repository at this point in the history
  • Loading branch information
ramya0820 authored and ramya-rao-a committed Aug 2, 2019
1 parent f3026bd commit 859fc21
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion sdk/eventhub/event-hubs/src/eventHubSender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ export class EventHubSender extends LinkEntity {
);
return resolve();
} catch (err) {
err = translate(err);
err = translate(err.innerError || err);
log.error(
"[%s] An error occurred while sending the message",
this._context.connectionId,
Expand Down
18 changes: 18 additions & 0 deletions sdk/eventhub/event-hubs/test/sender.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,24 @@ describe("EventHub Sender #RunnableInBrowser", function(): void {
}
await Promise.all(promises);
});

it("should be sent successfully in parallel, even when exceeding max event listener count of 1000", async function(): Promise<
void
> {
const senderCount = 1200;
try {
const producer = client.createProducer();
const promises = [];
for (let i = 0; i < senderCount; i++) {
promises.push(producer.send([{ body: `Hello World ${i}` }]));
}
await Promise.all(promises);
} catch (err) {
debug("An error occurred while running the test: ", err);
throw err;
}
});

it("should be sent successfully in parallel by multiple senders", async function(): Promise<
void
> {
Expand Down

0 comments on commit 859fc21

Please sign in to comment.