Restores performance tests
This commit is contained in:
parent
40b4d8aba3
commit
ae3b4df92c
|
@ -4,77 +4,83 @@ using NUnit.Framework;
|
||||||
|
|
||||||
namespace ContinuousTests.Tests
|
namespace ContinuousTests.Tests
|
||||||
{
|
{
|
||||||
//public class UploadPerformanceTest : PerformanceTest
|
public class UploadPerformanceTest : PerformanceTest
|
||||||
//{
|
{
|
||||||
// public override int RequiredNumberOfNodes => 1;
|
public override int RequiredNumberOfNodes => 1;
|
||||||
|
|
||||||
// public override void Run()
|
[TestMoment(t: Zero)]
|
||||||
// {
|
public void UploadTest()
|
||||||
// UploadTest(100, Nodes[0]);
|
{
|
||||||
// }
|
UploadTest(100, Nodes[0]);
|
||||||
//}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//public class DownloadLocalPerformanceTest : PerformanceTest
|
public class DownloadLocalPerformanceTest : PerformanceTest
|
||||||
//{
|
{
|
||||||
// public override int RequiredNumberOfNodes => 1;
|
public override int RequiredNumberOfNodes => 1;
|
||||||
|
|
||||||
// public override void Run()
|
[TestMoment(t: Zero)]
|
||||||
// {
|
public void DownloadTest()
|
||||||
// DownloadTest(100, Nodes[0], Nodes[0]);
|
{
|
||||||
// }
|
DownloadTest(100, Nodes[0], Nodes[0]);
|
||||||
//}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//public class DownloadRemotePerformanceTest : PerformanceTest
|
public class DownloadRemotePerformanceTest : PerformanceTest
|
||||||
//{
|
{
|
||||||
// public override int RequiredNumberOfNodes => 2;
|
public override int RequiredNumberOfNodes => 2;
|
||||||
|
|
||||||
// public override void Run()
|
[TestMoment(t: Zero)]
|
||||||
// {
|
public void DownloadTest()
|
||||||
// DownloadTest(100, Nodes[0], Nodes[1]);
|
{
|
||||||
// }
|
DownloadTest(100, Nodes[0], Nodes[1]);
|
||||||
//}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//public abstract class PerformanceTest : ContinuousTest
|
public abstract class PerformanceTest : ContinuousTest
|
||||||
//{
|
{
|
||||||
// public void UploadTest(int megabytes, CodexNode uploadNode)
|
public override TimeSpan RunTestEvery => TimeSpan.FromHours(1);
|
||||||
// {
|
public override TestFailMode TestFailMode => TestFailMode.AlwaysRunAllMoments;
|
||||||
// var file = FileManager.GenerateTestFile(megabytes.MB());
|
|
||||||
|
|
||||||
// var time = Measure(() =>
|
public void UploadTest(int megabytes, CodexNode uploadNode)
|
||||||
// {
|
{
|
||||||
// UploadFile(uploadNode, file);
|
var file = FileManager.GenerateTestFile(megabytes.MB());
|
||||||
// });
|
|
||||||
|
|
||||||
// var timePerMB = time / megabytes;
|
var time = Measure(() =>
|
||||||
|
{
|
||||||
|
UploadFile(uploadNode, file);
|
||||||
|
});
|
||||||
|
|
||||||
// Assert.That(timePerMB, Is.LessThan(CodexContainerRecipe.MaxUploadTimePerMegabyte), "MaxUploadTimePerMegabyte performance threshold breached.");
|
var timePerMB = time / megabytes;
|
||||||
// }
|
|
||||||
|
|
||||||
// public void DownloadTest(int megabytes, CodexNode uploadNode, CodexNode downloadNode)
|
Assert.That(timePerMB, Is.LessThan(CodexContainerRecipe.MaxUploadTimePerMegabyte), "MaxUploadTimePerMegabyte performance threshold breached.");
|
||||||
// {
|
}
|
||||||
// var file = FileManager.GenerateTestFile(megabytes.MB());
|
|
||||||
|
|
||||||
// var cid = UploadFile(uploadNode, file);
|
public void DownloadTest(int megabytes, CodexNode uploadNode, CodexNode downloadNode)
|
||||||
// Assert.That(cid, Is.Not.Null);
|
{
|
||||||
|
var file = FileManager.GenerateTestFile(megabytes.MB());
|
||||||
|
|
||||||
// TestFile? result = null;
|
var cid = UploadFile(uploadNode, file);
|
||||||
// var time = Measure(() =>
|
Assert.That(cid, Is.Not.Null);
|
||||||
// {
|
|
||||||
// result = DownloadContent(downloadNode, cid!);
|
|
||||||
// });
|
|
||||||
|
|
||||||
// file.AssertIsEqual(result);
|
TestFile? result = null;
|
||||||
|
var time = Measure(() =>
|
||||||
|
{
|
||||||
|
result = DownloadContent(downloadNode, cid!);
|
||||||
|
});
|
||||||
|
|
||||||
// var timePerMB = time / megabytes;
|
file.AssertIsEqual(result);
|
||||||
|
|
||||||
// Assert.That(timePerMB, Is.LessThan(CodexContainerRecipe.MaxDownloadTimePerMegabyte), "MaxDownloadTimePerMegabyte performance threshold breached.");
|
var timePerMB = time / megabytes;
|
||||||
// }
|
|
||||||
|
|
||||||
// private static TimeSpan Measure(Action action)
|
Assert.That(timePerMB, Is.LessThan(CodexContainerRecipe.MaxDownloadTimePerMegabyte), "MaxDownloadTimePerMegabyte performance threshold breached.");
|
||||||
// {
|
}
|
||||||
// var start = DateTime.UtcNow;
|
|
||||||
// action();
|
private static TimeSpan Measure(Action action)
|
||||||
// return DateTime.UtcNow - start;
|
{
|
||||||
// }
|
var start = DateTime.UtcNow;
|
||||||
//}
|
action();
|
||||||
|
return DateTime.UtcNow - start;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue