we don't need this test

This commit is contained in:
Ben 2025-08-21 10:06:02 +02:00
parent 015eaef638
commit bdf114d1ae
No known key found for this signature in database
GPG Key ID: 0F16E812E736C24B

View File

@ -46,93 +46,6 @@ namespace CodexReleaseTests.DataTests
}
}
[Test]
[Combinatorial]
public void BlackHoleTest(
[Values(5)] int numBlackHoles,
[Values(50, 200)] int sourceNodes)
{
var blackHoles = StartCodex(numBlackHoles, n => n.WithName("BlackHole"));
var remaining = sourceNodes;
var listLock = new object();
var nodes = new List<ICodexNode>();
var startTask = Task.Run(() =>
{
while (remaining > 0)
{
if (nodes.Count < 3)
{
var count = Math.Min(5, remaining);
remaining -= count;
var n = StartCodex(count);
lock (listLock)
{
nodes.AddRange(n);
}
}
Thread.Sleep(100);
}
});
while (remaining > 0 || nodes.Count > 0)
{
var node = TakeNode(nodes, listLock);
var file = GenerateTestFile(200.MB());
var cid = node.UploadFile(file);
SimultaneousDownload(blackHoles, file, cid);
node.Stop(waitTillStopped: false);
AllOk(blackHoles);
}
startTask.Wait();
}
private void AllOk(ICodexNodeGroup blackHoles)
{
foreach (var n in blackHoles)
{
Assert.That(n.HasCrashed(), Is.False);
var info = n.GetDebugInfo();
Assert.That(string.IsNullOrEmpty(info.Spr), Is.False);
}
}
private void SimultaneousDownload(ICodexNodeGroup blackHoles, TrackedFile file, ContentId cid)
{
var tasks = blackHoles.Select(n =>
Task<TrackedFile>.Run(() => n.DownloadContent(cid))
).ToArray();
Task.WaitAll(tasks);
var received = tasks.Select(t => t.Result).ToArray();
foreach (var r in received)
{
file.AssertIsEqual(r);
}
}
private ICodexNode TakeNode(List<ICodexNode> nodes, object listLock)
{
while (nodes.Count == 0)
{
Thread.Sleep(1000);
}
lock (listLock)
{
var n = nodes[0];
nodes.RemoveAt(0);
return n;
}
}
private void AllNodesHaveFile()
{
Log($"{nameof(AllNodesHaveFile)} {nodes.Names()}");