Skip to content

Commit 40f5a25

Browse files
committed
Add test constraint and debugging
1 parent 9af8bf8 commit 40f5a25

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

projects/Unit/TestFloodPublishing.cs

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
using NUnit.Framework;
4242
using RabbitMQ.Client.Events;
4343
using System;
44-
using System.Diagnostics;
4544
using System.Text;
4645
using System.Threading;
4746
using System.Threading.Tasks;
@@ -75,15 +74,25 @@ public void TestUnthrottledFloodPublishing()
7574
}
7675
};
7776

78-
bool elapsed = false;
79-
using (Timer t = new Timer((_obj) => { elapsed = true; }, null, (int)_tenSeconds.TotalMilliseconds, -1))
77+
bool shouldStop = false;
78+
DateTime now = DateTime.Now;
79+
DateTime stopTime = DateTime.Now.Add(_tenSeconds);
80+
for (int i = 0; i < 65535*64; i++)
8081
{
81-
while (!elapsed)
82+
if (i % 65536 == 0)
8283
{
83-
model.BasicPublish("", "", null, _body);
84+
now = DateTime.Now;
85+
shouldStop = DateTime.Now > stopTime;
86+
TestContext.Out.WriteLine("@@@@@@@@ NUNIT Checking now {0} stopTime {1} shouldStop {2}", now, stopTime, shouldStop);
87+
Console.Error.WriteLine("@@@@@@@@ STDERR Checking now {0} stopTime {1} shouldStop {2}", now, stopTime, shouldStop);
88+
if (shouldStop)
89+
{
90+
break;
91+
}
8492
}
85-
Assert.IsTrue(conn.IsOpen);
93+
model.BasicPublish("", "", null, _body);
8694
}
95+
Assert.IsTrue(conn.IsOpen);
8796
}
8897
}
8998
}

0 commit comments

Comments
 (0)