From 7c4ad416d44ec4520016e71ecfe86f413de09f00 Mon Sep 17 00:00:00 2001 From: Ben Date: Thu, 21 Nov 2024 12:15:15 +0100 Subject: [PATCH] running data tests --- Tests/CodexReleaseTests/CodexReleaseTests.csproj | 2 ++ .../CodexReleaseTests/DataTests/ManifestOnlyDownloadTest.cs | 4 ++-- Tests/CodexReleaseTests/DataTests/StreamlessDownloadTest.cs | 5 +++-- Tests/CodexReleaseTests/DataTests/SwarmTest.cs | 4 ++-- Tests/CodexReleaseTests/DataTests/UnknownCidTest.cs | 6 ++---- Tests/CodexReleaseTests/Parallelism.cs | 6 ++++++ 6 files changed, 17 insertions(+), 10 deletions(-) create mode 100644 Tests/CodexReleaseTests/Parallelism.cs diff --git a/Tests/CodexReleaseTests/CodexReleaseTests.csproj b/Tests/CodexReleaseTests/CodexReleaseTests.csproj index 269cf26..0b04347 100644 --- a/Tests/CodexReleaseTests/CodexReleaseTests.csproj +++ b/Tests/CodexReleaseTests/CodexReleaseTests.csproj @@ -8,6 +8,8 @@ + + diff --git a/Tests/CodexReleaseTests/DataTests/ManifestOnlyDownloadTest.cs b/Tests/CodexReleaseTests/DataTests/ManifestOnlyDownloadTest.cs index 35a0178..c55b3f8 100644 --- a/Tests/CodexReleaseTests/DataTests/ManifestOnlyDownloadTest.cs +++ b/Tests/CodexReleaseTests/DataTests/ManifestOnlyDownloadTest.cs @@ -8,13 +8,13 @@ namespace CodexReleaseTests.DataTests public class ManifestOnlyDownloadTest : CodexDistTest { [Test] - public void StreamlessTest() + public void ManifestOnlyTest() { var uploader = StartCodex(); var downloader = StartCodex(s => s.WithBootstrapNode(uploader)); var file = GenerateTestFile(2.GB()); - var size = Convert.ToInt64(file.GetFilesize()); + var size = file.GetFilesize().SizeInBytes; var cid = uploader.UploadFile(file); var startSpace = downloader.Space(); diff --git a/Tests/CodexReleaseTests/DataTests/StreamlessDownloadTest.cs b/Tests/CodexReleaseTests/DataTests/StreamlessDownloadTest.cs index afd4d2d..b7fb507 100644 --- a/Tests/CodexReleaseTests/DataTests/StreamlessDownloadTest.cs +++ b/Tests/CodexReleaseTests/DataTests/StreamlessDownloadTest.cs @@ -14,7 +14,7 @@ namespace CodexReleaseTests.DataTests var downloader = StartCodex(s => s.WithBootstrapNode(uploader)); var file = GenerateTestFile(10.MB()); - var size = Convert.ToInt64(file.GetFilesize()); + var size = file.GetFilesize().SizeInBytes; var cid = uploader.UploadFile(file); var startSpace = downloader.Space(); @@ -34,7 +34,8 @@ namespace CodexReleaseTests.DataTests retry.Run(() => { var space = downloader.Space(); - Assert.That(space.FreeBytes, Is.LessThanOrEqualTo(startSpace.FreeBytes - size)); + var expected = startSpace.FreeBytes - size; + if (space.FreeBytes > expected) throw new Exception("Expected free space not reached."); }); // Stop the uploader node and verify that the downloader has the data. diff --git a/Tests/CodexReleaseTests/DataTests/SwarmTest.cs b/Tests/CodexReleaseTests/DataTests/SwarmTest.cs index a0e9be9..c08d201 100644 --- a/Tests/CodexReleaseTests/DataTests/SwarmTest.cs +++ b/Tests/CodexReleaseTests/DataTests/SwarmTest.cs @@ -14,8 +14,8 @@ namespace CodexReleaseTests.DataTests [TestFixture] public class SwarmTests : AutoBootstrapDistTest { - private const int NumberOfNodes = 10; - private const int FileSizeMb = 100; + private const int NumberOfNodes = 5; + private const int FileSizeMb = 2; [Test] public void SmallSwarm() diff --git a/Tests/CodexReleaseTests/DataTests/UnknownCidTest.cs b/Tests/CodexReleaseTests/DataTests/UnknownCidTest.cs index a7f0e66..d0699a5 100644 --- a/Tests/CodexReleaseTests/DataTests/UnknownCidTest.cs +++ b/Tests/CodexReleaseTests/DataTests/UnknownCidTest.cs @@ -28,10 +28,8 @@ namespace CodexReleaseTests.DataTests } catch (Exception ex) { - if (!ex.Message.StartsWith("Retry 'DownloadFile' timed out")) - { - throw; - } + var expectedMessage = $"Download of '{unknownCid.Id}' timed out"; + if (!ex.Message.StartsWith(expectedMessage)) throw; } WaitAndCheckNodesStaysAlive(TimeSpan.FromMinutes(2), node); diff --git a/Tests/CodexReleaseTests/Parallelism.cs b/Tests/CodexReleaseTests/Parallelism.cs new file mode 100644 index 0000000..a1b26c7 --- /dev/null +++ b/Tests/CodexReleaseTests/Parallelism.cs @@ -0,0 +1,6 @@ +using NUnit.Framework; + +[assembly: LevelOfParallelism(1)] +namespace CodexReleaseTests.DataTests +{ +}