test(comm): de-race StreamRelay null-map + SiteConnectionUp gauge under load (#288)
This commit is contained in:
@@ -279,8 +279,16 @@ public class StreamRelayActorTests : TestKit
|
||||
var ts = DateTimeOffset.UtcNow;
|
||||
actor.Tell(new AttributeValueChanged("Inst", "Path", "Name", null, "Good", ts));
|
||||
|
||||
Thread.Sleep(500);
|
||||
Assert.True(channel.Reader.TryRead(out var evt));
|
||||
// Poll for the relayed event with a generous timeout instead of a single
|
||||
// fixed Thread.Sleep + one-shot TryRead. Under full-suite CPU
|
||||
// oversubscription the actor may not have processed the Tell within a
|
||||
// fixed 500ms window, racing the read; AwaitAssert retries until the
|
||||
// channel has the item (or the generous deadline elapses).
|
||||
SiteStreamEvent? evt = null;
|
||||
AwaitAssert(
|
||||
() => Assert.True(channel.Reader.TryRead(out evt), "Expected a relayed proto event on the channel"),
|
||||
TimeSpan.FromSeconds(5));
|
||||
Assert.NotNull(evt);
|
||||
Assert.Equal("", evt.AttributeChanged.Value);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user