47 lines
1.5 KiB
C#
Raw Normal View History

2023-04-14 09:54:07 +02:00
using DistTestCore.Logs;
2023-04-13 14:36:17 +02:00
using KubernetesWorkflow;
2023-04-13 11:30:19 +02:00
using Logging;
2023-04-12 13:53:55 +02:00
namespace DistTestCore
{
public class TestLifecycle
{
2023-04-13 14:36:17 +02:00
private readonly WorkflowCreator workflowCreator;
2023-04-14 14:53:39 +02:00
public TestLifecycle(TestLog log, Configuration configuration)
2023-04-12 13:53:55 +02:00
{
2023-04-14 14:53:39 +02:00
Log = log;
2023-04-25 11:31:15 +02:00
workflowCreator = new WorkflowCreator(log, configuration.GetK8sConfiguration());
2023-04-13 14:36:17 +02:00
2023-04-12 16:06:04 +02:00
FileManager = new FileManager(Log, configuration);
2023-04-13 14:36:17 +02:00
CodexStarter = new CodexStarter(this, workflowCreator);
PrometheusStarter = new PrometheusStarter(this, workflowCreator);
2023-04-14 09:54:07 +02:00
GethStarter = new GethStarter(this, workflowCreator);
2023-04-12 16:06:04 +02:00
}
2023-04-12 13:53:55 +02:00
2023-04-12 16:06:04 +02:00
public TestLog Log { get; }
public FileManager FileManager { get; }
public CodexStarter CodexStarter { get; }
2023-04-13 14:36:17 +02:00
public PrometheusStarter PrometheusStarter { get; }
2023-04-14 09:54:07 +02:00
public GethStarter GethStarter { get; }
2023-04-12 13:53:55 +02:00
2023-04-12 16:06:04 +02:00
public void DeleteAllResources()
{
CodexStarter.DeleteAllResources();
FileManager.DeleteAllTestFiles();
2023-04-12 13:53:55 +02:00
}
2023-04-13 11:30:19 +02:00
public ICodexNodeLog DownloadLog(OnlineCodexNode node)
{
var subFile = Log.CreateSubfile();
2023-04-19 14:57:00 +02:00
var description = node.GetName();
var handler = new LogDownloadHandler(node, description, subFile);
2023-04-13 11:30:19 +02:00
2023-04-14 14:53:39 +02:00
Log.Log($"Downloading logs for {description} to file '{subFile.FullFilename}'");
2023-04-13 11:30:19 +02:00
CodexStarter.DownloadLog(node.CodexAccess.Container, handler);
return new CodexNodeLog(subFile, node);
2023-04-13 11:30:19 +02:00
}
2023-04-12 13:53:55 +02:00
}
}