From c6c7cfc58e017ea5b4fd6b1dd90663fd33aff144 Mon Sep 17 00:00:00 2001 From: Eric <5089238+emizzle@users.noreply.github.com> Date: Thu, 14 Sep 2023 14:43:47 +1000 Subject: [PATCH] Add ability to download geth logs --- DistTestCore/CodexNodeGroup.cs | 4 +++- DistTestCore/CodexStarter.cs | 6 +++--- DistTestCore/OnlineCodexNode.cs | 6 ++++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/DistTestCore/CodexNodeGroup.cs b/DistTestCore/CodexNodeGroup.cs index 7759ea7..44b3e59 100644 --- a/DistTestCore/CodexNodeGroup.cs +++ b/DistTestCore/CodexNodeGroup.cs @@ -14,13 +14,14 @@ namespace DistTestCore { private readonly TestLifecycle lifecycle; - public CodexNodeGroup(TestLifecycle lifecycle, CodexSetup setup, RunningContainers[] containers, ICodexNodeFactory codexNodeFactory) + public CodexNodeGroup(TestLifecycle lifecycle, CodexSetup setup, RunningContainers[] containers, ICodexNodeFactory codexNodeFactory, RunningContainer gethContainer) { this.lifecycle = lifecycle; Setup = setup; Containers = containers; Nodes = containers.Containers().Select(c => CreateOnlineCodexNode(c, codexNodeFactory)).ToArray(); Version = new CodexDebugVersionResponse(); + GethContainer = gethContainer; } public IOnlineCodexNode this[int index] @@ -46,6 +47,7 @@ namespace DistTestCore public CodexSetup Setup { get; private set; } public RunningContainers[] Containers { get; private set; } + public RunningContainer GethContainer { get; private set; } public OnlineCodexNode[] Nodes { get; private set; } public CodexDebugVersionResponse Version { get; private set; } diff --git a/DistTestCore/CodexStarter.cs b/DistTestCore/CodexStarter.cs index 86a839e..97bf9f5 100644 --- a/DistTestCore/CodexStarter.cs +++ b/DistTestCore/CodexStarter.cs @@ -29,7 +29,7 @@ namespace DistTestCore var codexNodeFactory = new CodexNodeFactory(lifecycle, metricAccessFactory, gethStartResult.MarketplaceAccessFactory); - var group = CreateCodexGroup(codexSetup, containers, codexNodeFactory); + var group = CreateCodexGroup(codexSetup, containers, codexNodeFactory, gethStartResult.CompanionNode.RunningContainer); lifecycle.SetCodexVersion(group.Version); var nl = Environment.NewLine; @@ -107,9 +107,9 @@ namespace DistTestCore return result.ToArray(); } - private CodexNodeGroup CreateCodexGroup(CodexSetup codexSetup, RunningContainers[] runningContainers, CodexNodeFactory codexNodeFactory) + private CodexNodeGroup CreateCodexGroup(CodexSetup codexSetup, RunningContainers[] runningContainers, CodexNodeFactory codexNodeFactory, RunningContainer gethContainer) { - var group = new CodexNodeGroup(lifecycle, codexSetup, runningContainers, codexNodeFactory); + var group = new CodexNodeGroup(lifecycle, codexSetup, runningContainers, codexNodeFactory, gethContainer); RunningGroups.Add(group); try diff --git a/DistTestCore/OnlineCodexNode.cs b/DistTestCore/OnlineCodexNode.cs index 52fb81f..a8481f5 100644 --- a/DistTestCore/OnlineCodexNode.cs +++ b/DistTestCore/OnlineCodexNode.cs @@ -17,6 +17,7 @@ namespace DistTestCore TestFile? DownloadContent(ContentId contentId, string fileLabel = ""); void ConnectToPeer(IOnlineCodexNode node); IDownloadedLog DownloadLog(int? tailLines = null); + IDownloadedLog DownloadGethLog(); IMetricsAccess Metrics { get; } IMarketplaceAccess Marketplace { get; } CodexDebugVersionResponse Version { get; } @@ -108,6 +109,11 @@ namespace DistTestCore return lifecycle.DownloadLog(CodexAccess.Container, tailLines); } + public IDownloadedLog DownloadGethLog() + { + return lifecycle.DownloadLog(Group.GethContainer); + } + public ICodexSetup BringOffline() { if (Group.Count() > 1) throw new InvalidOperationException("Codex-nodes that are part of a group cannot be " +