Add ability to download geth logs

This commit is contained in:
Eric 2023-09-14 14:43:47 +10:00
parent ef2c18c599
commit c6c7cfc58e
No known key found for this signature in database
3 changed files with 12 additions and 4 deletions

View File

@ -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; }

View File

@ -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

View File

@ -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 " +