[Service Bus] Flaky test - Add delay to make sure the expiry time upon renewlock gets updated (#13330)

Hundreds of iterations of this test succeeded here https://github.com/Azure/azure-sdk-for-js/pull/13325
This commit is contained in:
Harsha Nalluru 2021-01-21 14:13:18 -08:00 коммит произвёл GitHub
Родитель f7c8787195
Коммит 5a4222e772
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 4 добавлений и 2 удалений

Просмотреть файл

@ -3,7 +3,7 @@
import chai from "chai"; import chai from "chai";
import chaiAsPromised from "chai-as-promised"; import chaiAsPromised from "chai-as-promised";
import { ServiceBusMessage } from "../src"; import { delay, ServiceBusMessage } from "../src";
import { TestClientType, TestMessage } from "./utils/testUtils"; import { TestClientType, TestMessage } from "./utils/testUtils";
import { ServiceBusReceiver, ServiceBusReceiverImpl } from "../src/receivers/receiver"; import { ServiceBusReceiver, ServiceBusReceiverImpl } from "../src/receivers/receiver";
import { ServiceBusSender } from "../src/sender"; import { ServiceBusSender } from "../src/sender";
@ -357,6 +357,7 @@ describe("Message settlement After Receiver is Closed - Through ManagementLink",
let errorWasThrown = false; let errorWasThrown = false;
try { 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 lockedUntilBeforeRenewlock = msg.lockedUntilUtc;
const lockedUntilAfterRenewlock = await receiver.renewMessageLock(msg); const lockedUntilAfterRenewlock = await receiver.renewMessageLock(msg);
should.equal( should.equal(

Просмотреть файл

@ -5,7 +5,7 @@ import chai from "chai";
const should = chai.should(); const should = chai.should();
import chaiAsPromised from "chai-as-promised"; import chaiAsPromised from "chai-as-promised";
chai.use(chaiAsPromised); chai.use(chaiAsPromised);
import { ServiceBusMessage } from "../src"; import { delay, ServiceBusMessage } from "../src";
import { TestClientType, TestMessage } from "./utils/testUtils"; import { TestClientType, TestMessage } from "./utils/testUtils";
import { import {
createServiceBusClientForTests, createServiceBusClientForTests,
@ -263,6 +263,7 @@ describe("Deferred Messages", () => {
if (!sequenceNumber) { if (!sequenceNumber) {
throw "Sequence Number can not be null"; 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 lockedUntilBeforeRenewlock = deferredMsg.lockedUntilUtc;
const lockedUntilAfterRenewlock = await receiver.renewMessageLock(deferredMsg); const lockedUntilAfterRenewlock = await receiver.renewMessageLock(deferredMsg);
should.equal( should.equal(