running data tests

This commit is contained in:
Ben 2024-11-21 12:15:15 +01:00
parent cfb6297357
commit 7c4ad416d4
No known key found for this signature in database
GPG Key ID: 0F16E812E736C24B
6 changed files with 17 additions and 10 deletions

View File

@ -8,6 +8,8 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="NUnit" Version="3.13.3" /> <PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.4.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -8,13 +8,13 @@ namespace CodexReleaseTests.DataTests
public class ManifestOnlyDownloadTest : CodexDistTest public class ManifestOnlyDownloadTest : CodexDistTest
{ {
[Test] [Test]
public void StreamlessTest() public void ManifestOnlyTest()
{ {
var uploader = StartCodex(); var uploader = StartCodex();
var downloader = StartCodex(s => s.WithBootstrapNode(uploader)); var downloader = StartCodex(s => s.WithBootstrapNode(uploader));
var file = GenerateTestFile(2.GB()); var file = GenerateTestFile(2.GB());
var size = Convert.ToInt64(file.GetFilesize()); var size = file.GetFilesize().SizeInBytes;
var cid = uploader.UploadFile(file); var cid = uploader.UploadFile(file);
var startSpace = downloader.Space(); var startSpace = downloader.Space();

View File

@ -14,7 +14,7 @@ namespace CodexReleaseTests.DataTests
var downloader = StartCodex(s => s.WithBootstrapNode(uploader)); var downloader = StartCodex(s => s.WithBootstrapNode(uploader));
var file = GenerateTestFile(10.MB()); var file = GenerateTestFile(10.MB());
var size = Convert.ToInt64(file.GetFilesize()); var size = file.GetFilesize().SizeInBytes;
var cid = uploader.UploadFile(file); var cid = uploader.UploadFile(file);
var startSpace = downloader.Space(); var startSpace = downloader.Space();
@ -34,7 +34,8 @@ namespace CodexReleaseTests.DataTests
retry.Run(() => retry.Run(() =>
{ {
var space = downloader.Space(); 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. // Stop the uploader node and verify that the downloader has the data.

View File

@ -14,8 +14,8 @@ namespace CodexReleaseTests.DataTests
[TestFixture] [TestFixture]
public class SwarmTests : AutoBootstrapDistTest public class SwarmTests : AutoBootstrapDistTest
{ {
private const int NumberOfNodes = 10; private const int NumberOfNodes = 5;
private const int FileSizeMb = 100; private const int FileSizeMb = 2;
[Test] [Test]
public void SmallSwarm() public void SmallSwarm()

View File

@ -28,10 +28,8 @@ namespace CodexReleaseTests.DataTests
} }
catch (Exception ex) catch (Exception ex)
{ {
if (!ex.Message.StartsWith("Retry 'DownloadFile' timed out")) var expectedMessage = $"Download of '{unknownCid.Id}' timed out";
{ if (!ex.Message.StartsWith(expectedMessage)) throw;
throw;
}
} }
WaitAndCheckNodesStaysAlive(TimeSpan.FromMinutes(2), node); WaitAndCheckNodesStaysAlive(TimeSpan.FromMinutes(2), node);

View File

@ -0,0 +1,6 @@
using NUnit.Framework;
[assembly: LevelOfParallelism(1)]
namespace CodexReleaseTests.DataTests
{
}