workflow creator lifecycle

This commit is contained in:
benbierens 2023-09-12 11:37:20 +02:00
parent c995732f35
commit 4cbd9ac828
No known key found for this signature in database
GPG Key ID: FE44815D96D0A1AA
3 changed files with 8 additions and 5 deletions

View File

@ -45,7 +45,7 @@ namespace CodexPlugin
public ICodexNodeGroup SetupCodexNodes(int number)
{
var rc = StartCodexNodes(1, s => { });
var rc = StartCodexNodes(number, s => { });
return WrapCodexContainers(rc);
}

View File

@ -12,6 +12,7 @@ namespace DistTestCore
public abstract class DistTest : PluginInterface
{
private const string TestsType = "dist-tests";
private const string TestNamespacePrefix = "ct-";
private readonly Configuration configuration = new Configuration();
private readonly Assembly[] testAssemblies;
private readonly FixtureLog fixtureLog;
@ -45,7 +46,7 @@ namespace DistTestCore
Stopwatch.Measure(fixtureLog, "Global setup", () =>
{
var wc = new WorkflowCreator(fixtureLog, configuration.GetK8sConfiguration(GetTimeSet()), string.Empty);
wc.CreateWorkflow().DeleteNamespace();
wc.CreateWorkflow().DeleteNamespacesStartingWith(TestNamespacePrefix);
});
}
catch (Exception ex)
@ -221,7 +222,7 @@ namespace DistTestCore
{
lock (lifecycleLock)
{
var testNamespace = Guid.NewGuid().ToString();
var testNamespace = TestNamespacePrefix + Guid.NewGuid().ToString();
var lifecycle = new TestLifecycle(fixtureLog.CreateTestLog(), configuration, GetTimeSet(), testNamespace);
lifecycles.Add(testName, lifecycle);
DefaultContainerRecipe.TestsType = TestsType;

View File

@ -9,6 +9,7 @@ namespace DistTestCore
{
private readonly PluginManager pluginManager;
private readonly DateTime testStart;
private readonly WorkflowCreator workflowCreator;
public TestLifecycle(TestLog log, Configuration configuration, ITimeSet timeSet, string testNamespace)
{
@ -19,6 +20,8 @@ namespace DistTestCore
testStart = DateTime.UtcNow;
FileManager = new FileManager(Log, Configuration.GetFileManagerFolder());
workflowCreator = new WorkflowCreator(Log, Configuration.GetK8sConfiguration(TimeSet), TestNamespace);
pluginManager = new PluginManager();
pluginManager.DiscoverPlugins();
pluginManager.InitializePlugins(this);
@ -50,8 +53,7 @@ namespace DistTestCore
public IStartupWorkflow CreateWorkflow(string? namespaceOverride = null)
{
if (namespaceOverride != null) throw new Exception("Namespace override is not supported in the DistTest environment. (It would mess up automatic resource cleanup.)");
var wc = new WorkflowCreator(Log, Configuration.GetK8sConfiguration(TimeSet), TestNamespace);
return wc.CreateWorkflow();
return workflowCreator.CreateWorkflow();
}
public IFileManager GetFileManager()