cs-codex-dist-tests/Tests/BasicTests/SimpleTests.cs

106 lines
2.9 KiB
C#
Raw Normal View History

2023-03-21 12:20:21 +00:00
using CodexDistTestCore;
using NUnit.Framework;
2023-03-21 12:20:21 +00:00
namespace Tests.BasicTests
{
[TestFixture]
2023-03-21 12:20:21 +00:00
public class SimpleTests : DistTest
{
2023-03-24 13:32:25 +00:00
[Test]
public void CanAccessLogs()
2023-03-24 13:32:25 +00:00
{
var group = SetupCodexNodes(2).BringOnline();
var log = group[0].DownloadLog();
log.AssertLogContains("topics=\"discv5\"");
2023-03-24 13:32:25 +00:00
}
//[Test]
//public void GetDebugInfo()
//{
// var dockerImage = new CodexDockerImage();
// var node = SetupCodexNodes(1)
// .BringOnline()[0];
// var debugInfo = node.GetDebugInfo();
// Assert.That(debugInfo.spr, Is.Not.Empty);
// Assert.That(debugInfo.codex.revision, Is.EqualTo(dockerImage.GetExpectedImageRevision()));
//}
//[Test]
//public void OneClientTest()
//{
// var primary = SetupCodexNodes(1)
// .BringOnline()[0];
// var testFile = GenerateTestFile(1.MB());
// var contentId = primary.UploadFile(testFile);
// var downloadedFile = primary.DownloadContent(contentId);
2023-03-22 13:49:01 +00:00
// testFile.AssertIsEqual(downloadedFile);
//}
2023-03-22 13:49:01 +00:00
//[Test]
//public void TwoClientsOnePodTest()
//{
// var group = SetupCodexNodes(2)
// .BringOnline();
// var primary = group[0];
// var secondary = group[1];
// PerformTwoClientTest(primary, secondary);
//}
//[Test]
//public void TwoClientsTwoPodsTest()
//{
// var primary = SetupCodexNodes(1)
// .BringOnline()[0];
2023-03-22 13:49:01 +00:00
// var secondary = SetupCodexNodes(1)
// .BringOnline()[0];
2023-03-24 13:16:59 +00:00
// PerformTwoClientTest(primary, secondary);
//}
2023-03-24 13:16:59 +00:00
//[Test]
//public void TwoClientsTwoLocationsTest()
//{
// var primary = SetupCodexNodes(1)
// .At(Location.BensLaptop)
// .BringOnline()[0];
// var secondary = SetupCodexNodes(1)
// .At(Location.BensOldGamingMachine)
// .BringOnline()[0];
// var debugInfo = primary.GetDebugInfo();
// Assert.That(debugInfo.spr, Is.Not.Empty);
// var debugInfo2 = secondary.GetDebugInfo();
// Assert.That(debugInfo2.spr, Is.Not.Empty);
// PerformTwoClientTest(primary, secondary);
//}
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-22 10:27:51 +00:00
var testFile = GenerateTestFile(1.MB());
2023-03-22 10:27:51 +00:00
var contentId = primary.UploadFile(testFile);
2023-03-22 10:27:51 +00:00
var downloadedFile = secondary.DownloadContent(contentId);
testFile.AssertIsEqual(downloadedFile);
}
}
}