cs-codex-dist-tests/DistTestCore/CodexStarter.cs

35 lines
1.1 KiB
C#
Raw Normal View History

2023-04-12 14:12:04 +00:00
using DistTestCore.Codex;
using KubernetesWorkflow;
2023-04-12 14:06:04 +00:00
namespace DistTestCore
{
public class CodexStarter
{
private readonly WorkflowCreator workflowCreator;
2023-04-13 07:33:10 +00:00
private readonly TestLifecycle lifecycle;
2023-04-12 14:06:04 +00:00
2023-04-13 07:33:10 +00:00
public CodexStarter(TestLifecycle lifecycle, Configuration configuration)
2023-04-12 14:06:04 +00:00
{
workflowCreator = new WorkflowCreator(configuration.GetK8sConfiguration());
2023-04-13 07:33:10 +00:00
this.lifecycle = lifecycle;
2023-04-12 14:06:04 +00:00
}
2023-04-13 07:33:10 +00:00
public ICodexNodeGroup BringOnline(CodexSetup codexSetup)
2023-04-12 14:06:04 +00:00
{
2023-04-12 14:12:04 +00:00
var workflow = workflowCreator.CreateWorkflow();
var startupConfig = new StartupConfig();
2023-04-13 07:33:10 +00:00
startupConfig.Add(codexSetup);
2023-04-12 14:06:04 +00:00
2023-04-13 07:33:10 +00:00
var runningContainers = workflow.Start(codexSetup.NumberOfNodes, codexSetup.Location, new CodexContainerRecipe(), startupConfig);
2023-04-12 14:12:04 +00:00
2023-04-13 07:33:10 +00:00
return new CodexNodeGroup(lifecycle, codexSetup, runningContainers);
2023-04-12 14:06:04 +00:00
}
public void DeleteAllResources()
{
var workflow = workflowCreator.CreateWorkflow();
workflow.DeleteAllResources();
}
}
}