cs-codex-dist-tests/ContinuousTests/Tests/PerformanceTests.cs

81 lines
2.3 KiB
C#

using DistTestCore;
using DistTestCore.Codex;
using NUnit.Framework;
namespace ContinuousTests.Tests
{
//public class UploadPerformanceTest : PerformanceTest
//{
// public override int RequiredNumberOfNodes => 1;
// public override void Run()
// {
// UploadTest(100, Nodes[0]);
// }
//}
//public class DownloadLocalPerformanceTest : PerformanceTest
//{
// public override int RequiredNumberOfNodes => 1;
// public override void Run()
// {
// DownloadTest(100, Nodes[0], Nodes[0]);
// }
//}
//public class DownloadRemotePerformanceTest : PerformanceTest
//{
// public override int RequiredNumberOfNodes => 2;
// public override void Run()
// {
// DownloadTest(100, Nodes[0], Nodes[1]);
// }
//}
//public abstract class PerformanceTest : ContinuousTest
//{
// public void UploadTest(int megabytes, CodexNode uploadNode)
// {
// var file = FileManager.GenerateTestFile(megabytes.MB());
// var time = Measure(() =>
// {
// UploadFile(uploadNode, file);
// });
// var timePerMB = time / megabytes;
// Assert.That(timePerMB, Is.LessThan(CodexContainerRecipe.MaxUploadTimePerMegabyte), "MaxUploadTimePerMegabyte performance threshold breached.");
// }
// public void DownloadTest(int megabytes, CodexNode uploadNode, CodexNode downloadNode)
// {
// var file = FileManager.GenerateTestFile(megabytes.MB());
// var cid = UploadFile(uploadNode, file);
// Assert.That(cid, Is.Not.Null);
// TestFile? result = null;
// var time = Measure(() =>
// {
// result = DownloadContent(downloadNode, cid!);
// });
// file.AssertIsEqual(result);
// var timePerMB = time / megabytes;
// Assert.That(timePerMB, Is.LessThan(CodexContainerRecipe.MaxDownloadTimePerMegabyte), "MaxDownloadTimePerMegabyte performance threshold breached.");
// }
// private static TimeSpan Measure(Action action)
// {
// var start = DateTime.UtcNow;
// action();
// return DateTime.UtcNow - start;
// }
//}
}