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-05 06:35:13 +00:00
|
|
|
|
[Test]
|
2023-08-28 09:16:58 +00:00
|
|
|
|
public void TwoClientTest()
|
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-05 06:35:13 +00:00
|
|
|
|
PerformTwoClientTest(primary, secondary);
|
2023-04-14 12:53:39 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void TwoClientsTwoLocationsTest()
|
|
|
|
|
{
|
2023-06-02 08:04:07 +00:00
|
|
|
|
var primary = SetupCodexNode(s => s.At(Location.One));
|
|
|
|
|
var secondary = SetupCodexNode(s => s.At(Location.Two));
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|