2023-04-14 12:53:39 +00:00
|
|
|
|
using DistTestCore;
|
|
|
|
|
using KubernetesWorkflow;
|
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
|
|
|
|
|
namespace Tests.BasicTests
|
|
|
|
|
{
|
|
|
|
|
[TestFixture]
|
|
|
|
|
public class TwoClientTests : DistTest
|
|
|
|
|
{
|
2023-05-04 06:25:48 +00:00
|
|
|
|
[TestCase(1)]
|
|
|
|
|
[TestCase(2)]
|
|
|
|
|
[TestCase(3)]
|
|
|
|
|
[TestCase(4)]
|
|
|
|
|
[TestCase(5)]
|
|
|
|
|
[TestCase(6)]
|
|
|
|
|
[TestCase(7)]
|
|
|
|
|
[TestCase(8)]
|
|
|
|
|
[TestCase(9)]
|
|
|
|
|
public void TwoClientsOnePodTest(int size)
|
2023-04-14 12:53:39 +00:00
|
|
|
|
{
|
2023-04-25 10:52:11 +00:00
|
|
|
|
var group = SetupCodexNodes(2);
|
2023-04-14 12:53:39 +00:00
|
|
|
|
|
|
|
|
|
var primary = group[0];
|
|
|
|
|
var secondary = group[1];
|
|
|
|
|
|
2023-05-04 06:25:48 +00:00
|
|
|
|
PerformTwoClientTest(primary, secondary, size.MB());
|
2023-04-14 12:53:39 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void TwoClientsTwoPodsTest()
|
|
|
|
|
{
|
2023-04-25 10:52:11 +00:00
|
|
|
|
var primary = SetupCodexNode();
|
|
|
|
|
var secondary = SetupCodexNode();
|
2023-04-14 12:53:39 +00:00
|
|
|
|
|
|
|
|
|
PerformTwoClientTest(primary, secondary);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
[Ignore("Requires Location map to be configured for k8s cluster.")]
|
|
|
|
|
public void TwoClientsTwoLocationsTest()
|
|
|
|
|
{
|
2023-04-25 10:52:11 +00:00
|
|
|
|
var primary = SetupCodexNode(s => s.At(Location.BensLaptop));
|
|
|
|
|
var secondary = SetupCodexNode(s => s.At(Location.BensOldGamingMachine));
|
2023-04-14 12:53:39 +00:00
|
|
|
|
|
|
|
|
|
PerformTwoClientTest(primary, secondary);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void PerformTwoClientTest(IOnlineCodexNode primary, IOnlineCodexNode secondary)
|
2023-05-04 06:25:48 +00:00
|
|
|
|
{
|
|
|
|
|
PerformTwoClientTest(primary, secondary, 1.MB());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void PerformTwoClientTest(IOnlineCodexNode primary, IOnlineCodexNode 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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|