2023-03-21 12:20:21 +00:00
|
|
|
|
using CodexDistTestCore;
|
2023-03-26 08:57:54 +00:00
|
|
|
|
using CodexDistTestCore.Config;
|
2023-03-17 10:43:29 +00:00
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
|
2023-03-21 12:20:21 +00:00
|
|
|
|
namespace Tests.BasicTests
|
2023-03-17 10:43:29 +00:00
|
|
|
|
{
|
|
|
|
|
[TestFixture]
|
2023-03-21 12:20:21 +00:00
|
|
|
|
public class SimpleTests : DistTest
|
2023-03-17 10:43:29 +00:00
|
|
|
|
{
|
2023-03-31 06:39:24 +00:00
|
|
|
|
//[Test]
|
|
|
|
|
//public void GetDebugInfo()
|
|
|
|
|
//{
|
|
|
|
|
// var dockerImage = new CodexDockerImage();
|
2023-03-21 07:30:40 +00:00
|
|
|
|
|
2023-03-31 06:39:24 +00:00
|
|
|
|
// var node = SetupCodexNodes(1).BringOnline()[0];
|
2023-03-17 10:43:29 +00:00
|
|
|
|
|
2023-03-31 06:39:24 +00:00
|
|
|
|
// var debugInfo = node.GetDebugInfo();
|
2023-03-20 08:23:32 +00:00
|
|
|
|
|
2023-03-31 06:39:24 +00:00
|
|
|
|
// Assert.That(debugInfo.spr, Is.Not.Empty);
|
|
|
|
|
// Assert.That(debugInfo.codex.revision, Is.EqualTo(dockerImage.GetExpectedImageRevision()));
|
|
|
|
|
//}
|
2023-03-20 08:23:32 +00:00
|
|
|
|
|
2023-03-31 06:39:24 +00:00
|
|
|
|
//[Test, DontDownloadLogsAndMetricsOnFailure]
|
|
|
|
|
//public void CanAccessLogs()
|
|
|
|
|
//{
|
|
|
|
|
// var node = SetupCodexNodes(1).BringOnline()[0];
|
2023-03-20 08:23:32 +00:00
|
|
|
|
|
2023-03-31 06:39:24 +00:00
|
|
|
|
// var log = node.DownloadLog();
|
2023-03-20 08:23:32 +00:00
|
|
|
|
|
2023-03-31 06:39:24 +00:00
|
|
|
|
// log.AssertLogContains("Started codex node");
|
|
|
|
|
//}
|
2023-03-20 08:23:32 +00:00
|
|
|
|
|
2023-03-31 06:39:24 +00:00
|
|
|
|
//[Test]
|
|
|
|
|
//public void TwoMetricsExample()
|
|
|
|
|
//{
|
|
|
|
|
// var group = SetupCodexNodes(2)
|
|
|
|
|
// .EnableMetrics()
|
|
|
|
|
// .BringOnline();
|
2023-03-20 08:23:32 +00:00
|
|
|
|
|
2023-03-31 06:39:24 +00:00
|
|
|
|
// var metrics = GatherMetrics(group);
|
2023-03-19 09:49:03 +00:00
|
|
|
|
|
2023-03-31 06:39:24 +00:00
|
|
|
|
// var group2 = SetupCodexNodes(2)
|
|
|
|
|
// .EnableMetrics()
|
|
|
|
|
// .BringOnline();
|
2023-03-28 11:43:25 +00:00
|
|
|
|
|
2023-03-31 06:39:24 +00:00
|
|
|
|
// var metrics2 = GatherMetrics(group2);
|
2023-03-28 11:43:25 +00:00
|
|
|
|
|
2023-03-31 06:39:24 +00:00
|
|
|
|
// var primary = group[0];
|
|
|
|
|
// var secondary = group[1];
|
|
|
|
|
// var primary2 = group2[0];
|
|
|
|
|
// var secondary2 = group2[1];
|
2023-03-28 11:43:25 +00:00
|
|
|
|
|
2023-03-31 06:39:24 +00:00
|
|
|
|
// primary.ConnectToPeer(secondary);
|
|
|
|
|
// primary2.ConnectToPeer(secondary2);
|
2023-03-19 09:49:03 +00:00
|
|
|
|
|
2023-03-31 06:39:24 +00:00
|
|
|
|
// Thread.Sleep(TimeSpan.FromMinutes(5));
|
2023-03-30 08:43:17 +00:00
|
|
|
|
|
2023-03-31 06:39:24 +00:00
|
|
|
|
// metrics.AssertThat(primary, "libp2p_peers", Is.EqualTo(1));
|
|
|
|
|
// metrics2.AssertThat(primary2, "libp2p_peers", Is.EqualTo(1));
|
|
|
|
|
//}
|
2023-03-22 13:49:01 +00:00
|
|
|
|
|
2023-03-31 06:39:24 +00:00
|
|
|
|
//[Test]
|
|
|
|
|
//public void OneClientTest()
|
|
|
|
|
//{
|
|
|
|
|
// var primary = SetupCodexNodes(1).BringOnline()[0];
|
2023-03-23 11:41:34 +00:00
|
|
|
|
|
2023-03-31 06:39:24 +00:00
|
|
|
|
// var testFile = GenerateTestFile(1.MB());
|
2023-03-23 11:41:34 +00:00
|
|
|
|
|
2023-03-31 06:39:24 +00:00
|
|
|
|
// var contentId = primary.UploadFile(testFile);
|
2023-03-23 11:41:34 +00:00
|
|
|
|
|
2023-03-31 06:39:24 +00:00
|
|
|
|
// var downloadedFile = primary.DownloadContent(contentId);
|
2023-03-22 13:49:01 +00:00
|
|
|
|
|
2023-03-31 06:39:24 +00:00
|
|
|
|
// testFile.AssertIsEqual(downloadedFile);
|
|
|
|
|
//}
|
2023-03-24 13:16:59 +00:00
|
|
|
|
|
2023-03-31 06:39:24 +00:00
|
|
|
|
//[Test]
|
|
|
|
|
//public void TwoClientsOnePodTest()
|
|
|
|
|
//{
|
|
|
|
|
// var group = SetupCodexNodes(2).BringOnline();
|
2023-03-24 13:16:59 +00:00
|
|
|
|
|
2023-03-31 06:39:24 +00:00
|
|
|
|
// var primary = group[0];
|
|
|
|
|
// var secondary = group[1];
|
2023-03-26 08:45:01 +00:00
|
|
|
|
|
2023-03-31 06:39:24 +00:00
|
|
|
|
// PerformTwoClientTest(primary, secondary);
|
|
|
|
|
//}
|
2023-03-26 08:45:01 +00:00
|
|
|
|
|
2023-03-31 06:39:24 +00:00
|
|
|
|
//[Test]
|
|
|
|
|
//public void TwoClientsTwoPodsTest()
|
|
|
|
|
//{
|
|
|
|
|
// var primary = SetupCodexNodes(1).BringOnline()[0];
|
2023-03-22 13:49:01 +00:00
|
|
|
|
|
2023-03-31 06:39:24 +00:00
|
|
|
|
// var secondary = SetupCodexNodes(1).BringOnline()[0];
|
2023-03-27 08:27:08 +00:00
|
|
|
|
|
2023-03-31 06:39:24 +00:00
|
|
|
|
// PerformTwoClientTest(primary, secondary);
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
//[Test]
|
|
|
|
|
//public void TwoClientsTwoLocationsTest()
|
|
|
|
|
//{
|
|
|
|
|
// var primary = SetupCodexNodes(1)
|
|
|
|
|
// .At(Location.BensLaptop)
|
|
|
|
|
// .BringOnline()[0];
|
|
|
|
|
|
|
|
|
|
// var secondary = SetupCodexNodes(1)
|
|
|
|
|
// .At(Location.BensOldGamingMachine)
|
|
|
|
|
// .BringOnline()[0];
|
|
|
|
|
|
|
|
|
|
// PerformTwoClientTest(primary, secondary);
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
//[Test]
|
|
|
|
|
//public void RequestStorageTest()
|
|
|
|
|
//{
|
|
|
|
|
// var primary = SetupCodexNodes(1)
|
|
|
|
|
// .Enable(startupCoins:100)
|
|
|
|
|
// .BringOnline()[0];
|
|
|
|
|
|
|
|
|
|
// GiveCoins(primary, 0);
|
|
|
|
|
|
|
|
|
|
// AssertBalance(primary, 100);
|
|
|
|
|
|
|
|
|
|
//}
|
2023-03-27 12:49:34 +00:00
|
|
|
|
|
2023-03-30 08:43:17 +00:00
|
|
|
|
[Test]
|
2023-03-31 06:39:24 +00:00
|
|
|
|
public void DoCommand()
|
2023-03-30 08:43:17 +00:00
|
|
|
|
{
|
2023-03-31 06:39:24 +00:00
|
|
|
|
var primary = SetupCodexNodes(1).BringOnline()[0];
|
2023-03-27 12:49:34 +00:00
|
|
|
|
|
2023-03-31 06:39:24 +00:00
|
|
|
|
k8sManager.ExampleOfCMD(primary);
|
2023-03-30 08:43:17 +00:00
|
|
|
|
}
|
2023-03-27 08:27:08 +00:00
|
|
|
|
|
2023-03-22 13:49:01 +00:00
|
|
|
|
private void PerformTwoClientTest(IOnlineCodexNode primary, IOnlineCodexNode secondary)
|
|
|
|
|
{
|
2023-03-22 10:27:51 +00:00
|
|
|
|
primary.ConnectToPeer(secondary);
|
2023-03-19 09:49:03 +00:00
|
|
|
|
|
2023-03-22 10:27:51 +00:00
|
|
|
|
var testFile = GenerateTestFile(1.MB());
|
2023-03-19 09:49:03 +00:00
|
|
|
|
|
2023-03-22 10:27:51 +00:00
|
|
|
|
var contentId = primary.UploadFile(testFile);
|
2023-03-19 09:49:03 +00:00
|
|
|
|
|
2023-03-22 10:27:51 +00:00
|
|
|
|
var downloadedFile = secondary.DownloadContent(contentId);
|
|
|
|
|
|
|
|
|
|
testFile.AssertIsEqual(downloadedFile);
|
|
|
|
|
}
|
2023-03-17 10:43:29 +00:00
|
|
|
|
}
|
|
|
|
|
}
|