cs-codex-dist-tests/Tests/CodexTests/BasicTests/TwoClientTests.cs

51 lines
1.3 KiB
C#
Raw Normal View History

2023-09-12 13:43:30 +00:00
using CodexPlugin;
using DistTestCore;
2023-04-14 12:53:39 +00:00
using KubernetesWorkflow;
using NUnit.Framework;
2023-09-08 08:21:40 +00:00
using Utils;
2023-04-14 12:53:39 +00:00
namespace Tests.BasicTests
{
[TestFixture]
public class TwoClientTests : DistTest
{
[Test]
public void TwoClientTest()
2023-04-14 12:53:39 +00:00
{
var group = Ci.SetupCodexNodes(2);
2023-04-14 12:53:39 +00:00
var primary = group[0];
var secondary = group[1];
PerformTwoClientTest(primary, secondary);
2023-04-14 12:53:39 +00:00
}
[Test]
public void TwoClientsTwoLocationsTest()
{
var primary = Ci.SetupCodexNode(s => s.At(Location.One));
var secondary = Ci.SetupCodexNode(s => s.At(Location.Two));
2023-04-14 12:53:39 +00:00
PerformTwoClientTest(primary, secondary);
}
2023-09-19 09:51:59 +00:00
private void PerformTwoClientTest(ICodexNode primary, ICodexNode secondary)
2023-05-04 06:25:48 +00:00
{
PerformTwoClientTest(primary, secondary, 1.MB());
}
2023-09-19 09:51:59 +00:00
private void PerformTwoClientTest(ICodexNode primary, ICodexNode secondary, ByteSize size)
2023-04-14 12:53:39 +00:00
{
primary.ConnectToPeer(secondary);
2023-05-04 06:25:48 +00:00
var testFile = GenerateTestFile(size);
2023-04-14 12:53:39 +00:00
var contentId = primary.UploadFile(testFile);
var downloadedFile = secondary.DownloadContent(contentId);
testFile.AssertIsEqual(downloadedFile);
}
}
}