Wires up the status log.
This commit is contained in:
parent
f50b8dfc83
commit
009ce1e9f3
|
@ -57,9 +57,11 @@ namespace ContinuousTests
|
||||||
private static void PrintHelp()
|
private static void PrintHelp()
|
||||||
{
|
{
|
||||||
var nl = Environment.NewLine;
|
var nl = Environment.NewLine;
|
||||||
Console.WriteLine("CodexNetDownloader lets you download all container logs given a codex-deployment.json file." + nl);
|
Console.WriteLine("ContinuousTests will run a set of tests against a codex deployment given a codex-deployment.json file." + nl +
|
||||||
|
"The tests will run in an endless loop unless otherwise specified, using the test-specific timing values." + nl);
|
||||||
|
|
||||||
Console.WriteLine("CodexNetDownloader assumes you are running this tool from *inside* the Kubernetes cluster. " +
|
|
||||||
|
Console.WriteLine("ContinuousTests assumes you are running this tool from *inside* the Kubernetes cluster. " +
|
||||||
"If you are not running this from a container inside the cluster, add the argument '--external'." + nl);
|
"If you are not running this from a container inside the cluster, add the argument '--external'." + nl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ namespace ContinuousTests
|
||||||
startupChecker.Check();
|
startupChecker.Check();
|
||||||
|
|
||||||
var taskFactory = new TaskFactory();
|
var taskFactory = new TaskFactory();
|
||||||
var overviewLog = new FixtureLog(new LogConfig(config.LogPath, false), "Overview");
|
var overviewLog = new FixtureLog(new LogConfig(config.LogPath, false), DateTime.UtcNow, "Overview");
|
||||||
overviewLog.Log("Continuous tests starting...");
|
overviewLog.Log("Continuous tests starting...");
|
||||||
var allTests = testFactory.CreateTests();
|
var allTests = testFactory.CreateTests();
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ namespace ContinuousTests
|
||||||
this.handle = handle;
|
this.handle = handle;
|
||||||
this.cancelToken = cancelToken;
|
this.cancelToken = cancelToken;
|
||||||
testName = handle.Test.GetType().Name;
|
testName = handle.Test.GetType().Name;
|
||||||
fixtureLog = new FixtureLog(new LogConfig(config.LogPath, true), testName);
|
fixtureLog = new FixtureLog(new LogConfig(config.LogPath, true), DateTime.UtcNow, testName);
|
||||||
|
|
||||||
nodes = CreateRandomNodes(handle.Test.RequiredNumberOfNodes);
|
nodes = CreateRandomNodes(handle.Test.RequiredNumberOfNodes);
|
||||||
dataFolder = config.DataPath + "-" + Guid.NewGuid();
|
dataFolder = config.DataPath + "-" + Guid.NewGuid();
|
||||||
|
|
|
@ -19,7 +19,7 @@ namespace ContinuousTests
|
||||||
|
|
||||||
public void Check()
|
public void Check()
|
||||||
{
|
{
|
||||||
var log = new FixtureLog(new LogConfig(config.LogPath, false), "StartupChecks");
|
var log = new FixtureLog(new LogConfig(config.LogPath, false), DateTime.UtcNow, "StartupChecks");
|
||||||
log.Log("Starting continuous test run...");
|
log.Log("Starting continuous test run...");
|
||||||
log.Log("Checking configuration...");
|
log.Log("Checking configuration...");
|
||||||
PreflightCheck(config);
|
PreflightCheck(config);
|
||||||
|
|
|
@ -16,6 +16,7 @@ namespace DistTestCore
|
||||||
private readonly Configuration configuration = new Configuration();
|
private readonly Configuration configuration = new Configuration();
|
||||||
private readonly Assembly[] testAssemblies;
|
private readonly Assembly[] testAssemblies;
|
||||||
private readonly FixtureLog fixtureLog;
|
private readonly FixtureLog fixtureLog;
|
||||||
|
private readonly StatusLog statusLog;
|
||||||
private readonly object lifecycleLock = new object();
|
private readonly object lifecycleLock = new object();
|
||||||
private readonly Dictionary<string, TestLifecycle> lifecycles = new Dictionary<string, TestLifecycle>();
|
private readonly Dictionary<string, TestLifecycle> lifecycles = new Dictionary<string, TestLifecycle>();
|
||||||
|
|
||||||
|
@ -24,7 +25,10 @@ namespace DistTestCore
|
||||||
var assemblies = AppDomain.CurrentDomain.GetAssemblies();
|
var assemblies = AppDomain.CurrentDomain.GetAssemblies();
|
||||||
testAssemblies = assemblies.Where(a => a.FullName!.ToLowerInvariant().Contains("test")).ToArray();
|
testAssemblies = assemblies.Where(a => a.FullName!.ToLowerInvariant().Contains("test")).ToArray();
|
||||||
|
|
||||||
fixtureLog = new FixtureLog(configuration.GetLogConfig());
|
var logConfig = configuration.GetLogConfig();
|
||||||
|
var startTime = DateTime.UtcNow;
|
||||||
|
fixtureLog = new FixtureLog(logConfig, startTime);
|
||||||
|
statusLog = new StatusLog(logConfig, startTime, CodexContainerRecipe.DockerImage);
|
||||||
|
|
||||||
PeerConnectionTestHelpers = new PeerConnectionTestHelpers(this);
|
PeerConnectionTestHelpers = new PeerConnectionTestHelpers(this);
|
||||||
PeerDownloadTestHelpers = new PeerDownloadTestHelpers(this);
|
PeerDownloadTestHelpers = new PeerDownloadTestHelpers(this);
|
||||||
|
@ -196,6 +200,7 @@ namespace DistTestCore
|
||||||
{
|
{
|
||||||
var lifecycle = Get();
|
var lifecycle = Get();
|
||||||
fixtureLog.Log($"{GetCurrentTestName()} = {GetTestResult()} ({lifecycle.GetTestDuration()})");
|
fixtureLog.Log($"{GetCurrentTestName()} = {GetTestResult()} ({lifecycle.GetTestDuration()})");
|
||||||
|
statusLog.ConcludeTest(GetTestResult());
|
||||||
Stopwatch.Measure(fixtureLog, $"Teardown for {GetCurrentTestName()}", () =>
|
Stopwatch.Measure(fixtureLog, $"Teardown for {GetCurrentTestName()}", () =>
|
||||||
{
|
{
|
||||||
lifecycle.Log.EndTest();
|
lifecycle.Log.EndTest();
|
||||||
|
|
|
@ -16,23 +16,13 @@ namespace Logging
|
||||||
this.codexId = codexId;
|
this.codexId = codexId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void TestPassed()
|
public void ConcludeTest(string resultStatus)
|
||||||
{
|
|
||||||
Write("successful");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void TestFailed()
|
|
||||||
{
|
|
||||||
Write("failed");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Write(string status)
|
|
||||||
{
|
{
|
||||||
Write(new StatusLogJson
|
Write(new StatusLogJson
|
||||||
{
|
{
|
||||||
time = DateTime.UtcNow.ToString("u"),
|
time = DateTime.UtcNow.ToString("u"),
|
||||||
runid = GetRunId(),
|
runid = GetRunId(),
|
||||||
status = status,
|
status = resultStatus,
|
||||||
testid = GetTestId(),
|
testid = GetTestId(),
|
||||||
codexid = codexId,
|
codexid = codexId,
|
||||||
fixturename = fixtureName,
|
fixturename = fixtureName,
|
||||||
|
|
Loading…
Reference in New Issue