mirror of
https://github.com/codex-storage/cs-codex-dist-tests.git
synced 2025-02-13 04:27:01 +00:00
Adds test for making sure node does not crash after mysterious CID is downloaded
This commit is contained in:
parent
54f053cfcc
commit
e1da38b6e8
@ -17,18 +17,6 @@ namespace CodexTests.BasicTests
|
||||
LogNodeStatus(primary);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void RestartTest()
|
||||
{
|
||||
var primary = StartCodex();
|
||||
|
||||
primary.Stop(waitTillStopped: true);
|
||||
|
||||
primary = StartCodex();
|
||||
|
||||
PerformOneClientTest(primary);
|
||||
}
|
||||
|
||||
private void PerformOneClientTest(ICodexNode primary)
|
||||
{
|
||||
var testFile = GenerateTestFile(1.MB());
|
||||
|
@ -1,4 +1,5 @@
|
||||
using NUnit.Framework;
|
||||
using CodexPlugin;
|
||||
using NUnit.Framework;
|
||||
using Utils;
|
||||
|
||||
namespace CodexTests.BasicTests
|
||||
@ -20,5 +21,34 @@ namespace CodexTests.BasicTests
|
||||
|
||||
testFile.AssertIsEqual(downloadedFile);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DownloadingUnknownCidDoesNotCauseCrash()
|
||||
{
|
||||
var node = StartCodex(2).First();
|
||||
|
||||
var unknownCid = new ContentId("zDvZRwzkzHsok3Z8yMoiXE9EDBFwgr8WygB8s4ddcLzzSwwXAxLZ");
|
||||
|
||||
try
|
||||
{
|
||||
node.DownloadContent(unknownCid);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (!ex.Message.StartsWith("Retry 'DownloadFile' timed out"))
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
// Check that the node stays alive for at least another 5 minutes.
|
||||
var start = DateTime.UtcNow;
|
||||
while ((DateTime.UtcNow - start) < TimeSpan.FromMinutes(5))
|
||||
{
|
||||
Thread.Sleep(5000);
|
||||
var info = node.GetDebugInfo();
|
||||
Assert.That(!string.IsNullOrEmpty(info.Id));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user