Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Made unit test more robust #307

Merged
merged 2 commits into from
Mar 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
55 changes: 27 additions & 28 deletions Sources/Runtime/Test.Psi/PipelineTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1976,36 +1976,35 @@ public void DiagnosticsTest()
var log = new List<string>();
PipelineDiagnostics graph = null;

using (var p = Pipeline.Create(enableDiagnostics: true, diagnosticsConfiguration: new DiagnosticsConfiguration() { SamplingInterval = TimeSpan.FromMilliseconds(1) }))
{
/*
* .........
* =---= . =---= . =---=
* | A |--->| B |--->| D |---+
* =---= . =---= . =---= |
* ^ ......... |
* | |
* +-----------------------+
*/
var sub = new Subpipeline(p);
var cIn = new Connector<int>(p, sub);
var cOut = new Connector<int>(sub, p);
var d = new FinalizationTestComponent(p, "C", log);
var b = new FinalizationTestComponent(sub, "B", log);
var a = new FinalizationTestComponent(p, "A", log);
var timer = Generators.Range(p, 0, 100, TimeSpan.FromMilliseconds(10));
timer.PipeTo(cIn.In);
cIn.Out.PipeTo(b.ReceiverX);
b.RelayFromX.PipeTo(cOut.In);
cOut.Out.PipeTo(d.ReceiverX);
using var p = Pipeline.Create(enableDiagnostics: true, diagnosticsConfiguration: new DiagnosticsConfiguration() { SamplingInterval = TimeSpan.FromMilliseconds(10) });

/*
* .........
* =---= . =---= . =---=
* | A |--->| B |--->| D |---+
* =---= . =---= . =---= |
* ^ ......... |
* | |
* +-----------------------+
*/
var sub = new Subpipeline(p);
var cIn = new Connector<int>(p, sub);
var cOut = new Connector<int>(sub, p);
var d = new FinalizationTestComponent(p, "C", log);
var b = new FinalizationTestComponent(sub, "B", log);
var a = new FinalizationTestComponent(p, "A", log);
var timer = Generators.Range(p, 0, 100, TimeSpan.FromMilliseconds(10));
timer.PipeTo(cIn.In);
cIn.Out.PipeTo(b.ReceiverX);
b.RelayFromX.PipeTo(cOut.In);
cOut.Out.PipeTo(d.ReceiverX);

p.Diagnostics.Do(diag => graph = diag.DeepClone());
p.Diagnostics.Do(diag => graph = diag.DeepClone());

p.RunAsync();
while (graph == null)
{
Thread.Sleep(10);
}
p.RunAsync();
while (graph == null)
{
Thread.Sleep(10);
}

Assert.AreEqual(2, graph.GetPipelineCount()); // total graphs
Expand Down