2024-04-24 09:41:05 +02:00
|
|
|
|
using CodexPlugin;
|
|
|
|
|
using DistTestCore;
|
2024-04-27 11:33:13 +02:00
|
|
|
|
using Logging;
|
2024-04-24 09:41:05 +02:00
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
using Utils;
|
|
|
|
|
|
|
|
|
|
namespace CodexTests.ScalabilityTests
|
|
|
|
|
{
|
|
|
|
|
[TestFixture]
|
|
|
|
|
public class OneClientLargeFileTests : CodexDistTest
|
|
|
|
|
{
|
|
|
|
|
[Test]
|
|
|
|
|
[Combinatorial]
|
|
|
|
|
[UseLongTimeouts]
|
|
|
|
|
public void OneClientLargeFile([Values(
|
|
|
|
|
256,
|
|
|
|
|
512,
|
|
|
|
|
1024, // GB
|
|
|
|
|
2048,
|
|
|
|
|
4096,
|
|
|
|
|
8192,
|
|
|
|
|
16384,
|
|
|
|
|
32768,
|
|
|
|
|
65536,
|
|
|
|
|
131072
|
|
|
|
|
)] int sizeMb)
|
|
|
|
|
{
|
|
|
|
|
var testFile = GenerateTestFile(sizeMb.MB());
|
|
|
|
|
|
2024-04-25 09:25:00 +02:00
|
|
|
|
var node = AddCodex(s => s
|
|
|
|
|
.WithLogLevel(CodexLogLevel.Warn)
|
|
|
|
|
.WithStorageQuota((sizeMb + 10).MB())
|
|
|
|
|
);
|
2024-04-24 09:41:05 +02:00
|
|
|
|
var contentId = node.UploadFile(testFile);
|
|
|
|
|
var downloadedFile = node.DownloadContent(contentId);
|
|
|
|
|
|
|
|
|
|
testFile.AssertIsEqual(downloadedFile);
|
|
|
|
|
}
|
2024-04-27 11:33:13 +02:00
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void ManyFiles()
|
|
|
|
|
{
|
|
|
|
|
// I suspect that the upload speed is linked to the total
|
|
|
|
|
// number of blocks already in the node. I suspect the
|
|
|
|
|
// metadata store to be the cause of any slow-down.
|
|
|
|
|
// Using this test to detect and quantify the numbers.
|
|
|
|
|
|
|
|
|
|
var node = AddCodex(s => s
|
|
|
|
|
.WithLogLevel(CodexLogLevel.Trace)
|
|
|
|
|
.WithStorageQuota(20.GB())
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
var times = new List<TimeSpan>();
|
|
|
|
|
for (var i = 0; i < 100; i++)
|
|
|
|
|
{
|
|
|
|
|
Thread.Sleep(1000);
|
|
|
|
|
var file = GenerateTestFile(100.MB());
|
|
|
|
|
times.Add(Stopwatch.Measure(GetTestLog(), "Upload_" + i, () =>
|
|
|
|
|
{
|
|
|
|
|
node.UploadFile(file);
|
|
|
|
|
}));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Log("Upload times:");
|
|
|
|
|
foreach (var t in times)
|
|
|
|
|
{
|
|
|
|
|
Log(Time.FormatDuration(t));
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-24 09:41:05 +02:00
|
|
|
|
}
|
|
|
|
|
}
|