Skip to content

Commit 859bbaf

Browse files
committed
Tests: prevent Locking tests from killing the runner.
This takes out the global build if it throws...let's not do that.
1 parent 90e1659 commit 859bbaf

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

StackExchange.Redis.Tests/Locking.cs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,22 @@ public void AggressiveParallel(TestMode testMode)
3737
{
3838
void cb(object obj)
3939
{
40-
var conn = (IDatabase)obj;
41-
conn.Multiplexer.ErrorMessage += delegate { Interlocked.Increment(ref errorCount); };
40+
try
41+
{
42+
var conn = (IDatabase)obj;
43+
conn.Multiplexer.ErrorMessage += delegate { Interlocked.Increment(ref errorCount); };
4244

43-
for (int i = 0; i < 1000; i++)
45+
for (int i = 0; i < 1000; i++)
46+
{
47+
conn.LockTakeAsync("abc", "def", TimeSpan.FromSeconds(5));
48+
}
49+
conn.Ping();
50+
if (Interlocked.Decrement(ref count) == 0) evt.Set();
51+
}
52+
catch (Exception ex)
4453
{
45-
conn.LockTakeAsync("abc", "def", TimeSpan.FromSeconds(5));
54+
Assert.True(false, "Exception in AggressiveParallel callback: " + ex.Message);
4655
}
47-
conn.Ping();
48-
if (Interlocked.Decrement(ref count) == 0) evt.Set();
4956
}
5057
int db = testMode == TestMode.Twemproxy ? 0 : 2;
5158
ThreadPool.QueueUserWorkItem(cb, c1.GetDatabase(db));

0 commit comments

Comments
 (0)