From 1f8fc52cb1265abb7d30f6433e8bc6606d6d69a4 Mon Sep 17 00:00:00 2001 From: benbierens Date: Thu, 13 Jul 2023 09:20:24 +0200 Subject: [PATCH] Adds three-client test to check discovery relaying --- ContinuousTests/StartupChecker.cs | 8 +++++--- Tests/BasicTests/ThreeClientTest.cs | 24 ++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 Tests/BasicTests/ThreeClientTest.cs diff --git a/ContinuousTests/StartupChecker.cs b/ContinuousTests/StartupChecker.cs index 8e9357a4..a2e1e1f5 100644 --- a/ContinuousTests/StartupChecker.cs +++ b/ContinuousTests/StartupChecker.cs @@ -64,9 +64,9 @@ namespace ContinuousTests { cancelToken.ThrowIfCancellationRequested(); - log.Log($"Checking '{n.Address.Host}'..."); + log.Log($"Checking {n.Container.Name} @ '{n.Address.Host}:{n.Address.Port}'..."); - if (EnsureOnline(n)) + if (EnsureOnline(log, n)) { log.Log("OK"); } @@ -82,12 +82,14 @@ namespace ContinuousTests } } - private bool EnsureOnline(CodexAccess n) + private bool EnsureOnline(BaseLog log, CodexAccess n) { try { var info = n.GetDebugInfo(); if (info == null || string.IsNullOrEmpty(info.id)) return false; + + log.Log($"Codex version: '{info.codex.version}' revision: '{info.codex.revision}'"); } catch { diff --git a/Tests/BasicTests/ThreeClientTest.cs b/Tests/BasicTests/ThreeClientTest.cs new file mode 100644 index 00000000..78ef25e7 --- /dev/null +++ b/Tests/BasicTests/ThreeClientTest.cs @@ -0,0 +1,24 @@ +using DistTestCore; +using NUnit.Framework; + +namespace Tests.BasicTests +{ + [TestFixture] + public class ThreeClientTest : AutoBootstrapDistTest + { + [Test] + public void ThreeClient() + { + var primary = SetupCodexNode(); + var secondary = SetupCodexNode(); + + var testFile = GenerateTestFile(10.MB()); + + var contentId = primary.UploadFile(testFile); + + var downloadedFile = secondary.DownloadContent(contentId); + + testFile.AssertIsEqual(downloadedFile); + } + } +}