Implements bringOffline for codex nodes
This commit is contained in:
parent
53bb9968ff
commit
d1895bab02
|
@ -13,8 +13,11 @@ namespace CodexPlugin
|
|||
|
||||
public class CodexNodeGroup : ICodexNodeGroup
|
||||
{
|
||||
public CodexNodeGroup(IPluginTools tools, RunningContainers[] containers, ICodexNodeFactory codexNodeFactory)
|
||||
private readonly CodexStarter starter;
|
||||
|
||||
public CodexNodeGroup(CodexStarter starter, IPluginTools tools, RunningContainers[] containers, ICodexNodeFactory codexNodeFactory)
|
||||
{
|
||||
this.starter = starter;
|
||||
Containers = containers;
|
||||
Nodes = containers.Containers().Select(c => CreateOnlineCodexNode(c, tools, codexNodeFactory)).ToArray();
|
||||
Version = new CodexDebugVersionResponse();
|
||||
|
@ -30,11 +33,8 @@ namespace CodexPlugin
|
|||
|
||||
public void BringOffline()
|
||||
{
|
||||
//lifecycle.CodexStarter.BringOffline(this);
|
||||
|
||||
//var result = Setup;
|
||||
starter.BringOffline(this);
|
||||
// Clear everything. Prevent accidental use.
|
||||
//Setup = null!;
|
||||
Nodes = Array.Empty<OnlineCodexNode>();
|
||||
Containers = null!;
|
||||
}
|
||||
|
|
|
@ -54,27 +54,27 @@ namespace CodexPlugin
|
|||
|
||||
public void BringOffline(CodexNodeGroup group)
|
||||
{
|
||||
//LogStart($"Stopping {group.Describe()}...");
|
||||
//var workflow = CreateWorkflow();
|
||||
//foreach (var c in group.Containers)
|
||||
Log($"Stopping {group.Describe()}...");
|
||||
var workflow = pluginTools.CreateWorkflow();
|
||||
foreach (var c in group.Containers)
|
||||
{
|
||||
StopCrashWatcher(c);
|
||||
workflow.Stop(c);
|
||||
}
|
||||
Log("Stopped.");
|
||||
}
|
||||
|
||||
//public void DeleteAllResources()
|
||||
//{
|
||||
// StopCrashWatcher(c);
|
||||
// workflow.Stop(c);
|
||||
// //var workflow = CreateWorkflow();
|
||||
// //workflow.DeleteTestResources();
|
||||
//}
|
||||
//LogEnd("Stopped.");
|
||||
}
|
||||
|
||||
public void DeleteAllResources()
|
||||
{
|
||||
//var workflow = CreateWorkflow();
|
||||
//workflow.DeleteTestResources();
|
||||
}
|
||||
|
||||
public void DownloadLog(RunningContainer container, ILogHandler logHandler, int? tailLines)
|
||||
{
|
||||
//var workflow = CreateWorkflow();
|
||||
//workflow.DownloadContainerLog(container, logHandler, tailLines);
|
||||
}
|
||||
//public void DownloadLog(RunningContainer container, ILogHandler logHandler, int? tailLines)
|
||||
//{
|
||||
// //var workflow = CreateWorkflow();
|
||||
// //workflow.DownloadContainerLog(container, logHandler, tailLines);
|
||||
//}
|
||||
|
||||
//private IMetricsAccessFactory CollectMetrics(CodexSetup codexSetup, RunningContainers[] containers)
|
||||
//{
|
||||
|
@ -114,7 +114,7 @@ namespace CodexPlugin
|
|||
|
||||
private CodexNodeGroup CreateCodexGroup(RunningContainers[] runningContainers, CodexNodeFactory codexNodeFactory)
|
||||
{
|
||||
var group = new CodexNodeGroup(pluginTools, runningContainers, codexNodeFactory);
|
||||
var group = new CodexNodeGroup(this, pluginTools, runningContainers, codexNodeFactory);
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -151,12 +151,12 @@ namespace CodexPlugin
|
|||
pluginTools.GetLog().Log(message);
|
||||
}
|
||||
|
||||
//private void StopCrashWatcher(RunningContainers containers)
|
||||
//{
|
||||
// foreach (var c in containers.Containers)
|
||||
// {
|
||||
// c.CrashWatcher?.Stop();
|
||||
// }
|
||||
//}
|
||||
private void StopCrashWatcher(RunningContainers containers)
|
||||
{
|
||||
foreach (var c in containers.Containers)
|
||||
{
|
||||
c.CrashWatcher?.Stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,9 +21,9 @@ namespace Tests.BasicTests
|
|||
{
|
||||
var primary = Ci.SetupCodexNode();
|
||||
|
||||
//var setup = primary.BringOffline();
|
||||
primary.BringOffline();
|
||||
|
||||
//primary = BringOnline(setup)[0];
|
||||
primary = Ci.SetupCodexNode();
|
||||
|
||||
PerformOneClientTest(primary);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue