Skip to content

Commit 4af3cf4

Browse files
Fix flaky tests (Azure#21841)
* Fix flaky tests * Fix
1 parent 0a02bef commit 4af3cf4

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

sdk/servicebus/Azure.Messaging.ServiceBus/tests/Diagnostics/EventSourceLiveTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ public async Task StoppingProcessorDoesNotLogTaskCanceledExceptions()
416416
{
417417
await using (var scope = await ServiceBusScope.CreateWithQueue(enablePartitioning: false, enableSession: false))
418418
{
419-
await using var client = CreateNoRetryClient(10);
419+
await using var client = CreateNoRetryClient();
420420
await using var processor = client.CreateProcessor(scope.QueueName);
421421

422422
processor.ProcessMessageAsync += args => Task.CompletedTask;
@@ -440,7 +440,7 @@ public async Task StoppingSessionProcessorDoesNotLogTaskCanceledExceptions()
440440
{
441441
await using (var scope = await ServiceBusScope.CreateWithQueue(enablePartitioning: false, enableSession: true))
442442
{
443-
await using var client = CreateNoRetryClient(5);
443+
await using var client = CreateNoRetryClient();
444444
await using var processor = client.CreateSessionProcessor(
445445
scope.QueueName,
446446
new ServiceBusSessionProcessorOptions
@@ -454,8 +454,8 @@ public async Task StoppingSessionProcessorDoesNotLogTaskCanceledExceptions()
454454

455455
await processor.StartProcessingAsync();
456456

457-
// wait twice as long as the try timeout to ensure that the Accept session will timeout
458-
await Task.Delay(TimeSpan.FromSeconds(10));
457+
// wait a few seconds to allow the receive to begin
458+
await Task.Delay(TimeSpan.FromSeconds(5));
459459

460460
await processor.StopProcessingAsync();
461461

sdk/servicebus/Azure.Messaging.ServiceBus/tests/Processor/ProcessorLiveTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ async Task ProcessMessage(ProcessMessageEventArgs args)
7979
var start = DateTime.UtcNow;
8080
await processor.StopProcessingAsync();
8181
var stop = DateTime.UtcNow;
82-
Assert.Less(stop - start, TimeSpan.FromSeconds(5));
82+
Assert.Less(stop - start, TimeSpan.FromSeconds(10));
8383

8484
// we complete each task after one message being processed, so the total number of messages
8585
// processed should equal the number of threads, but it's possible that we may process a few more per thread.

sdk/servicebus/Azure.Messaging.ServiceBus/tests/Processor/SessionProcessorLiveTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ async Task ProcessMessage(ProcessSessionMessageEventArgs args)
172172
var start = DateTime.UtcNow;
173173
await processor.StopProcessingAsync();
174174
var stop = DateTime.UtcNow;
175-
Assert.Less(stop - start, TimeSpan.FromSeconds(5));
175+
Assert.Less(stop - start, TimeSpan.FromSeconds(10));
176176

177177
// there is only one message for each session, and one
178178
// thread for each session, so the total messages processed

0 commit comments

Comments
 (0)