additional application ids, fixes deployment namespace issue
This commit is contained in:
parent
683cc882be
commit
c7e5ddb0cb
|
@ -72,7 +72,7 @@ namespace CodexNetDeployer
|
|||
k8sNamespacePrefix: config.KubeNamespace
|
||||
);
|
||||
|
||||
return new TestLifecycle(log, lifecycleConfig, timeset, config.TestsTypePodLabel);
|
||||
return new TestLifecycle(log, lifecycleConfig, timeset, config.TestsTypePodLabel, string.Empty);
|
||||
}
|
||||
|
||||
private RunningContainer? StartMetricsService(TestLifecycle lifecycle, CodexSetup setup, List<RunningContainer> codexContainers)
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace ContinuousTests
|
|||
k8sNamespacePrefix: customNamespace
|
||||
);
|
||||
|
||||
return new TestLifecycle(log, lifecycleConfig, timeSet, "continuous-tests");
|
||||
return new TestLifecycle(log, lifecycleConfig, timeSet, "continuous-tests", string.Empty);
|
||||
}
|
||||
|
||||
private static string? GetKubeConfig(string kubeConfigFile)
|
||||
|
|
|
@ -53,7 +53,7 @@ namespace DistTestCore
|
|||
{
|
||||
Stopwatch.Measure(fixtureLog, "Global setup", () =>
|
||||
{
|
||||
var wc = new WorkflowCreator(fixtureLog, configuration.GetK8sConfiguration(GetTimeSet()), new PodLabels(TestsType, "null"));
|
||||
var wc = new WorkflowCreator(fixtureLog, configuration.GetK8sConfiguration(GetTimeSet()), new PodLabels(TestsType, null!), string.Empty);
|
||||
wc.CreateWorkflow().DeleteAllResources();
|
||||
});
|
||||
}
|
||||
|
@ -196,7 +196,9 @@ namespace DistTestCore
|
|||
{
|
||||
lock (lifecycleLock)
|
||||
{
|
||||
lifecycles.Add(testName, new TestLifecycle(fixtureLog.CreateTestLog(), configuration, GetTimeSet(), TestsType));
|
||||
var testNamespace = Guid.NewGuid().ToString();
|
||||
var lifecycle = new TestLifecycle(fixtureLog.CreateTestLog(), configuration, GetTimeSet(), TestsType, testNamespace);
|
||||
lifecycles.Add(testName, lifecycle);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -207,7 +209,7 @@ namespace DistTestCore
|
|||
var testResult = GetTestResult();
|
||||
var testDuration = lifecycle.GetTestDuration();
|
||||
fixtureLog.Log($"{GetCurrentTestName()} = {testResult} ({testDuration})");
|
||||
statusLog.ConcludeTest(testResult, testDuration, lifecycle.GetCodexId());
|
||||
statusLog.ConcludeTest(testResult, testDuration, lifecycle.GetApplicationIds());
|
||||
Stopwatch.Measure(fixtureLog, $"Teardown for {GetCurrentTestName()}", () =>
|
||||
{
|
||||
lifecycle.Log.EndTest();
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
using DistTestCore.Codex;
|
||||
using DistTestCore.Logs;
|
||||
using DistTestCore.Marketplace;
|
||||
using DistTestCore.Metrics;
|
||||
using KubernetesWorkflow;
|
||||
using Logging;
|
||||
using Utils;
|
||||
|
@ -10,14 +12,14 @@ namespace DistTestCore
|
|||
{
|
||||
private readonly DateTime testStart;
|
||||
|
||||
public TestLifecycle(BaseLog log, Configuration configuration, ITimeSet timeSet, string testsType)
|
||||
public TestLifecycle(BaseLog log, Configuration configuration, ITimeSet timeSet, string testsType, string testNamespace)
|
||||
{
|
||||
Log = log;
|
||||
Configuration = configuration;
|
||||
TimeSet = timeSet;
|
||||
|
||||
var podLabels = new PodLabels(testsType, GetCodexId());
|
||||
WorkflowCreator = new WorkflowCreator(log, configuration.GetK8sConfiguration(timeSet), podLabels);
|
||||
var podLabels = new PodLabels(testsType, GetApplicationIds());
|
||||
WorkflowCreator = new WorkflowCreator(log, configuration.GetK8sConfiguration(timeSet), podLabels, testNamespace);
|
||||
|
||||
FileManager = new FileManager(Log, configuration);
|
||||
CodexStarter = new CodexStarter(this);
|
||||
|
@ -68,7 +70,17 @@ namespace DistTestCore
|
|||
if (CodexVersion == null) CodexVersion = version;
|
||||
}
|
||||
|
||||
public string GetCodexId()
|
||||
public ApplicationIds GetApplicationIds()
|
||||
{
|
||||
return new ApplicationIds(
|
||||
codexId: GetCodexId(),
|
||||
gethId: new GethContainerRecipe().Image,
|
||||
prometheusId: new PrometheusContainerRecipe().Image,
|
||||
codexContractsId: new CodexContractsContainerRecipe().Image
|
||||
);
|
||||
}
|
||||
|
||||
private string GetCodexId()
|
||||
{
|
||||
var v = CodexVersion;
|
||||
if (v == null) return new CodexContainerRecipe().Image;
|
||||
|
|
|
@ -11,15 +11,20 @@ namespace KubernetesWorkflow
|
|||
labels = source.labels.ToDictionary(p => p.Key, p => p.Value);
|
||||
}
|
||||
|
||||
public PodLabels(string testsType, string codexId)
|
||||
public PodLabels(string testsType, ApplicationIds applicationIds)
|
||||
{
|
||||
Add("tests-type", testsType);
|
||||
Add("runid", NameUtils.GetRunId());
|
||||
Add("testid", NameUtils.GetTestId());
|
||||
Add("category", NameUtils.GetCategoryName());
|
||||
Add("codexid", codexId);
|
||||
Add("fixturename", NameUtils.GetRawFixtureName());
|
||||
Add("testname", NameUtils.GetTestMethodName());
|
||||
|
||||
if (applicationIds == null) return;
|
||||
Add("codexid", applicationIds.CodexId);
|
||||
Add("gethid", applicationIds.GethId);
|
||||
Add("prometheusid", applicationIds.PrometheusId);
|
||||
Add("codexcontractsid", applicationIds.CodexContractsId);
|
||||
}
|
||||
|
||||
public PodLabels GetLabelsForAppName(string appName)
|
||||
|
|
|
@ -13,12 +13,12 @@ namespace KubernetesWorkflow
|
|||
private readonly PodLabels podLabels;
|
||||
private readonly string testNamespace;
|
||||
|
||||
public WorkflowCreator(BaseLog log, Configuration configuration, PodLabels podLabels)
|
||||
public WorkflowCreator(BaseLog log, Configuration configuration, PodLabels podLabels, string testNamespace)
|
||||
{
|
||||
cluster = new K8sCluster(configuration);
|
||||
this.log = log;
|
||||
this.podLabels = podLabels;
|
||||
testNamespace = Guid.NewGuid().ToString().ToLowerInvariant();
|
||||
this.testNamespace = testNamespace.ToLowerInvariant();
|
||||
}
|
||||
|
||||
public StartupWorkflow CreateWorkflow()
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
namespace Logging
|
||||
{
|
||||
public class ApplicationIds
|
||||
{
|
||||
public ApplicationIds(string codexId, string gethId, string prometheusId, string codexContractsId)
|
||||
{
|
||||
CodexId = codexId;
|
||||
GethId = gethId;
|
||||
PrometheusId = prometheusId;
|
||||
CodexContractsId = codexContractsId;
|
||||
}
|
||||
|
||||
public string CodexId { get; }
|
||||
public string GethId { get; }
|
||||
public string PrometheusId { get; }
|
||||
public string CodexContractsId { get; }
|
||||
}
|
||||
}
|
|
@ -14,7 +14,7 @@ namespace Logging
|
|||
fixtureName = NameUtils.GetRawFixtureName();
|
||||
}
|
||||
|
||||
public void ConcludeTest(string resultStatus, string testDuration, string codexId)
|
||||
public void ConcludeTest(string resultStatus, string testDuration, ApplicationIds applicationIds)
|
||||
{
|
||||
Write(new StatusLogJson
|
||||
{
|
||||
|
@ -22,7 +22,10 @@ namespace Logging
|
|||
runid = NameUtils.GetRunId(),
|
||||
status = resultStatus,
|
||||
testid = NameUtils.GetTestId(),
|
||||
codexid = codexId,
|
||||
codexid = applicationIds.CodexId,
|
||||
gethid = applicationIds.GethId,
|
||||
prometheusid = applicationIds.PrometheusId,
|
||||
codexcontractsid = applicationIds.CodexContractsId,
|
||||
category = NameUtils.GetCategoryName(),
|
||||
fixturename = fixtureName,
|
||||
testname = NameUtils.GetTestMethodName(),
|
||||
|
@ -53,6 +56,9 @@ namespace Logging
|
|||
public string status { get; set; } = string.Empty;
|
||||
public string testid { get; set; } = string.Empty;
|
||||
public string codexid { get; set; } = string.Empty;
|
||||
public string gethid { get; set; } = string.Empty;
|
||||
public string prometheusid { get; set; } = string.Empty;
|
||||
public string codexcontractsid { get; set; } = string.Empty;
|
||||
public string category { get; set; } = string.Empty;
|
||||
public string fixturename { get; set; } = string.Empty;
|
||||
public string testname { get; set; } = string.Empty;
|
||||
|
|
Loading…
Reference in New Issue