Skip to content

Commit 341c89c

Browse files
One more concurrent connection access test
1 parent 3848436 commit 341c89c

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,5 +76,26 @@ public void TestConcurrentChannelOpenWithPublishing()
7676

7777
Assert.IsTrue(latch.Wait(TimeSpan.FromSeconds(90)));
7878
}
79+
80+
[Test]
81+
public void TestConcurrentChannelOpenCloseLoop()
82+
{
83+
var n = 32;
84+
var latch = new CountdownEvent(n);
85+
foreach (var i in Enumerable.Range(0, n))
86+
{
87+
var t = new Thread(() => {
88+
foreach (var j in Enumerable.Range(0, 100))
89+
{
90+
var ch = Conn.CreateModel();
91+
ch.Close();
92+
}
93+
latch.Signal();
94+
});
95+
t.Start();
96+
}
97+
98+
Assert.IsTrue(latch.Wait(TimeSpan.FromSeconds(90)));
99+
}
79100
}
80101
}

0 commit comments

Comments
 (0)