Skip to content

Commit 7306329

Browse files
committed
Fix flaky test
Sometimes waiting 2 seconds is not long enough: https://ci.rabbitmq.com/teams/main/pipelines/dotnet/jobs/test/builds/240
1 parent 1631482 commit 7306329

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

projects/client/Unit/src/unit/TestAsyncConsumer.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public class TestAsyncConsumer
5454
[Test]
5555
public void TestBasicRoundtrip()
5656
{
57-
var cf = new ConnectionFactory{ DispatchConsumersAsync = true };
57+
var cf = new ConnectionFactory { DispatchConsumersAsync = true };
5858
using(IConnection c = cf.CreateConnection())
5959
using(IModel m = c.CreateModel())
6060
{
@@ -84,7 +84,7 @@ public void TestBasicRoundtrip()
8484
[Test]
8585
public void TestBasicRoundtripNoWait()
8686
{
87-
var cf = new ConnectionFactory{ DispatchConsumersAsync = true };
87+
var cf = new ConnectionFactory { DispatchConsumersAsync = true };
8888
using (IConnection c = cf.CreateConnection())
8989
{
9090
using (IModel m = c.CreateModel())
@@ -102,12 +102,13 @@ public void TestBasicRoundtripNoWait()
102102
};
103103
string tag = m.BasicConsume(q.QueueName, true, consumer);
104104
// ensure we get a delivery
105-
bool waitRes = are.WaitOne(2000);
105+
bool waitRes = are.WaitOne(5000);
106106
Assert.IsTrue(waitRes);
107107
// unsubscribe and ensure no further deliveries
108108
m.BasicCancelNoWait(tag);
109+
Thread.Sleep(1000);
109110
m.BasicPublish("", q.QueueName, bp, body);
110-
bool waitResFalse = are.WaitOne(2000);
111+
bool waitResFalse = are.WaitOne(5000);
111112
Assert.IsFalse(waitResFalse);
112113
}
113114
}

0 commit comments

Comments
 (0)