2023-04-18 11:22:41 +00:00
|
|
|
|
using KubernetesWorkflow;
|
2023-04-25 09:31:15 +00:00
|
|
|
|
using Logging;
|
2023-04-18 11:22:41 +00:00
|
|
|
|
|
|
|
|
|
namespace DistTestCore
|
|
|
|
|
{
|
|
|
|
|
public class BaseStarter
|
|
|
|
|
{
|
|
|
|
|
protected readonly TestLifecycle lifecycle;
|
|
|
|
|
protected readonly WorkflowCreator workflowCreator;
|
|
|
|
|
private Stopwatch? stopwatch;
|
|
|
|
|
|
|
|
|
|
public BaseStarter(TestLifecycle lifecycle, WorkflowCreator workflowCreator)
|
|
|
|
|
{
|
|
|
|
|
this.lifecycle = lifecycle;
|
|
|
|
|
this.workflowCreator = workflowCreator;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void LogStart(string msg)
|
|
|
|
|
{
|
|
|
|
|
Log(msg);
|
|
|
|
|
stopwatch = Stopwatch.Begin(lifecycle.Log, GetClassName());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void LogEnd(string msg)
|
|
|
|
|
{
|
|
|
|
|
stopwatch!.End(msg);
|
|
|
|
|
stopwatch = null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void Log(string msg)
|
|
|
|
|
{
|
2023-04-19 07:19:06 +00:00
|
|
|
|
lifecycle.Log.Log($"{GetClassName()} {msg}");
|
2023-04-18 11:22:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private string GetClassName()
|
|
|
|
|
{
|
2023-04-19 07:19:06 +00:00
|
|
|
|
return $"({GetType().Name})";
|
2023-04-18 11:22:41 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|