cs-codex-dist-tests/Tests/CodexContinuousTests/EntryPointFactory.cs

37 lines
1.2 KiB
C#
Raw Permalink Normal View History

2023-09-20 11:33:58 +00:00
using Logging;
using Core;
namespace ContinuousTests
{
public class EntryPointFactory
{
2023-09-20 11:56:01 +00:00
public EntryPointFactory()
{
ProjectPlugin.Load<CodexPlugin.CodexPlugin>();
ProjectPlugin.Load<CodexContractsPlugin.CodexContractsPlugin>();
ProjectPlugin.Load<GethPlugin.GethPlugin>();
ProjectPlugin.Load<MetricsPlugin.MetricsPlugin>();
}
2023-09-20 11:33:58 +00:00
public EntryPoint CreateEntryPoint(string kubeConfigFile, string dataFilePath, string customNamespace, ILog log)
{
var kubeConfig = GetKubeConfig(kubeConfigFile);
var lifecycleConfig = new KubernetesWorkflow.Configuration
(
kubeConfigFile: kubeConfig,
operationTimeout: TimeSpan.FromMinutes(2),
retryDelay: TimeSpan.FromSeconds(30),
2023-09-20 11:33:58 +00:00
kubernetesNamespace: customNamespace
);
return new EntryPoint(log, lifecycleConfig, dataFilePath);
}
private static string? GetKubeConfig(string kubeConfigFile)
{
if (string.IsNullOrEmpty(kubeConfigFile) || kubeConfigFile.ToLowerInvariant() == "null") return null;
return kubeConfigFile;
}
}
}