Skip to content

Commit

Permalink
[service-bus] Flaky test fix - un-awaited abandonMessage() calls caus…
Browse files Browse the repository at this point in the history
…e unrelated tests to fail (#15716)

We had some abandonMessage() calls in atomE2E.ts that were not being await'd on, which meant when they did ultimately fail, it would happen in an unrelated test.

I'm a bit unsure why but it appears that mocha was attributing these failures to these tests, even though they weren't started or a part of them.

As an example: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=943479&view=logs&j=07f0c2bc-806a-58d0-ca0d-069f605ef81d&t=fd27c4cf-da6b-5a51-aa3d-cd45c93f6ef8

(there are other failures in that same build that I'm not entirely are are related, but this part is definitely incorrect and can be fixed).
  • Loading branch information
richardpark-msft authored Jun 12, 2021
1 parent d368283 commit 2b246bd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions sdk/servicebus/service-bus/test/internal/atomE2ETests.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,10 @@ describe("getSubscriptionRuntimeProperties", () => {
async function receiveMessagesAndAbandon(subscriptionName: string): Promise<void> {
const receiver = serviceBusClient.createReceiver(topicName, subscriptionName);
const receivedMessages = await receiver.receiveMessages(10);
receivedMessages.forEach(async (msg) => {

for (const msg of receivedMessages) {
await receiver.abandonMessage(msg);
});
}
}

it("Active Message Count - single subscription", async () => {
Expand Down

0 comments on commit 2b246bd

Please sign in to comment.