Skip to content

Commit

Permalink
[Service Bus] Flaky test - Add delay to make sure the expiry time upo…
Browse files Browse the repository at this point in the history
…n renewlock gets updated (#13330)

Hundreds of iterations of this test succeeded here #13325
  • Loading branch information
HarshaNalluru authored Jan 21, 2021
1 parent f7c8787 commit 5a4222e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import chai from "chai";
import chaiAsPromised from "chai-as-promised";
import { ServiceBusMessage } from "../src";
import { delay, ServiceBusMessage } from "../src";
import { TestClientType, TestMessage } from "./utils/testUtils";
import { ServiceBusReceiver, ServiceBusReceiverImpl } from "../src/receivers/receiver";
import { ServiceBusSender } from "../src/sender";
Expand Down Expand Up @@ -357,6 +357,7 @@ describe("Message settlement After Receiver is Closed - Through ManagementLink",

let errorWasThrown = false;
try {
await delay(2000); // Add a delay after receiving the messages to make sure the msg.lockedUntil gets updated after the renewlock operation
const lockedUntilBeforeRenewlock = msg.lockedUntilUtc;
const lockedUntilAfterRenewlock = await receiver.renewMessageLock(msg);
should.equal(
Expand Down
3 changes: 2 additions & 1 deletion sdk/servicebus/service-bus/test/deferredMessage.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import chai from "chai";
const should = chai.should();
import chaiAsPromised from "chai-as-promised";
chai.use(chaiAsPromised);
import { ServiceBusMessage } from "../src";
import { delay, ServiceBusMessage } from "../src";
import { TestClientType, TestMessage } from "./utils/testUtils";
import {
createServiceBusClientForTests,
Expand Down Expand Up @@ -263,6 +263,7 @@ describe("Deferred Messages", () => {
if (!sequenceNumber) {
throw "Sequence Number can not be null";
}
await delay(2000); // Add a delay after receiving the messages to make sure the msg.lockedUntil gets updated after the renewlock operation
const lockedUntilBeforeRenewlock = deferredMsg.lockedUntilUtc;
const lockedUntilAfterRenewlock = await receiver.renewMessageLock(deferredMsg);
should.equal(
Expand Down

0 comments on commit 5a4222e

Please sign in to comment.