Skip to content

Commit

Permalink
Update release notes for 1.1.0 beta1 (#108)
Browse files Browse the repository at this point in the history
* Change ClearOutputDirectory option to AppendLogOutput

* Update RELEASE_NOTES.md for 1.1.0-beta1 release
  • Loading branch information
Arkatufus committed Nov 8, 2021
1 parent 5047db5 commit 25c3214
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 49 deletions.
27 changes: 27 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
#### 1.1.0-beta1 October 20 2019 ####

- [Switch to pure Xunit implementation](https://github.com/akkadotnet/Akka.MultiNodeTestRunner/pull/105)

In this release we removed VSTest Adapter and moved to a pure Xunit implementation. This brings about a few changes that needs to be observed:

- Moved `.runsettings` configuration feature to `xunit.multinode.runner.json`

`.runsettings` content are not passed downstream by `dotnet test` to the actual test runner, so this feature is moved to Xunit-like configuration through a .json file. You can declare your setting file name as either `{assembly_name}.xunit.multinode.runner.json` or `xunit.multinode.runner.json`. Supported settings are:
- `outputDirectory`: the output directory where all the runner logs will be stored. Note that this is different than the `dotnet test --result-directory` settings which dictates where the VSTest reporter will export their outputs.
__Default:__ `TestResults` in the folder where the tested assembly is located.
- `failedSpecsDirectory`: an output directory __inside the `outputDirectory`__ where all aggregated failed logs will be stored.
__Default:__ `FAILED_SPECS_LOGS`
- `listenAddress`: the host name or IP of the machine that is running the test. Will be bound to the TCP logging service.
__Default:__ `127.0.0.1` (localhost)
- `listenPort`: the port where the TCP logging service will be listening to. a random free port will be used if set to 0.
__Default:__ 0
- `appendLogOutput`: if set, all logs are appended to the old logs from previous runs.
__Default:__ true

- Parallelized test support (__BETA__)

Tests can be run in parallel now, with caveats. Parallel test is not recommended if any of your tests are very timing dependent;
it is still recommended that you __do not__ run your tests in parallel. Note that Xunit turns this feature on __by default__, so if your tests are failing, make sure that this feature is properly turned off. Please read the xunit [documentation](https://xunit.net/docs/running-tests-in-parallel) on how to set this up.

Note that the `maxParallelThreads` in Xunit will not be honored by this test adapter because MultiNode tests will spawn a process for every cluster node being used inside the test, inflating the number of threads being used inside a test.

#### 1.0.0 October 20 2019 ####
- Fix [result folder clearing, add documentation](https://github.com/akkadotnet/Akka.MultiNodeTestRunner/pull/95)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public string ListenAddress
/// <summary>
/// If set, performs output directory cleanup before running tests
/// </summary>
public bool ClearOutputDirectory { get; set; }
public bool AppendLogOutput { get; set; } = true;

public string? Platform { get; set; }
}
Expand Down
6 changes: 3 additions & 3 deletions src/Akka.MultiNode.TestAdapter/Configuration/OptionsReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ private static MultiNodeTestRunnerOptions Load(Stream configStream)
switch (propertyValue)
{
case JsonBoolean booleanValue:
if (string.Equals(propertyName, Configuration.ClearOutputDirectory, StringComparison.OrdinalIgnoreCase))
result.ClearOutputDirectory = booleanValue.Value;
if (string.Equals(propertyName, Configuration.AppendLogOutput, StringComparison.OrdinalIgnoreCase))
result.AppendLogOutput = booleanValue.Value;
break;

case JsonString stringValue:
Expand Down Expand Up @@ -86,7 +86,7 @@ static class Configuration
public const string FailedSpecsDirectory = "failedSpecsDirectory";
public const string ListenAddress = "listenAddress";
public const string ListenPort = "listenPort";
public const string ClearOutputDirectory = "clearOutputDirectory";
public const string AppendLogOutput = "appendLogOutput";
}
}
}
30 changes: 17 additions & 13 deletions src/Akka.MultiNode.TestAdapter/Internal/MultiNodeTestCaseRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,7 @@ protected override async Task<RunSummary> RunTestAsync()
PublishRunnerMessage($"Starting test {TestCase.DisplayName}");
StartNewSpec();

var timelineCollector = TestRunSystem.ActorOf(Props.Create(() => new TimelineLogCollectorActor()));
//TODO: might need to do some validation here to avoid the 260 character max path error on Windows
var folder = Directory.CreateDirectory(Path.Combine(Options.OutputDirectory, TestCase.DisplayName));
var testOutputDir = folder.FullName;
var timelineCollector = TestRunSystem.ActorOf(Props.Create(() => new TimelineLogCollectorActor(Options.AppendLogOutput)));

var tasks = new List<Task<RunSummary>>();
var serverPort = SocketUtil.TemporaryTcpAddress("localhost").Port;
Expand Down Expand Up @@ -199,7 +196,7 @@ protected override async Task<RunSummary> RunTestAsync()
}

// Save timelined logs to file system
await DumpAggregatedSpecLogs(summary, Options, testOutputDir, timelineCollector);
await DumpAggregatedSpecLogs(summary, timelineCollector);

await FinishSpec(timelineCollector);

Expand All @@ -226,24 +223,31 @@ protected override async Task<RunSummary> RunTestAsync()
return summary;
}

private async Task DumpAggregatedSpecLogs(
RunSummary summary,
MultiNodeTestRunnerOptions options,
string testOutputDir,
IActorRef timelineCollector)
private async Task DumpAggregatedSpecLogs(RunSummary summary, IActorRef timelineCollector)
{
if (testOutputDir == null) return;
var dumpPath = Path.GetFullPath(Path.Combine(Path.Combine(Options.OutputDirectory, TestCase.DisplayName), "aggregated.txt"));
var failedSpecPath = Path.GetFullPath(Path.Combine(Options.OutputDirectory, Options.FailedSpecsDirectory, $"{TestCase.DisplayName}.txt"));

if (!Options.AppendLogOutput)
{
if(File.Exists(dumpPath))
File.Delete(dumpPath);
if(File.Exists(failedSpecPath))
File.Delete(failedSpecPath);
}

var logLines = await timelineCollector.Ask<string[]>(new TimelineLogCollectorActor.GetLog());

// Dump aggregated timeline to file for this test
var dumpPath = Path.GetFullPath(Path.Combine(testOutputDir, "aggregated.txt"));
File.AppendAllLines(dumpPath, logLines);

if (summary.Failed > 0)
{
var failedSpecPath = Path.GetFullPath(Path.Combine(options.OutputDirectory, options.FailedSpecsDirectory, $"{TestCase.DisplayName}.txt"));
Directory.CreateDirectory(Path.GetDirectoryName(failedSpecPath));

if(!Options.AppendLogOutput && File.Exists(failedSpecPath))
File.Delete(failedSpecPath);

File.AppendAllLines(failedSpecPath, logLines);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,9 @@ public async Task<RunSummary> RunAsync()
{
try
{
if(!_options.AppendLogOutput && File.Exists(logFilePath))
File.Delete(logFilePath);

File.AppendAllText(logFilePath, Output);
dumpSuccess = true;
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@ namespace Akka.MultiNode.TestAdapter.Internal.Sinks
{
internal class TimelineLogCollectorActor : ReceiveActor
{
private readonly bool _appendLogOutput;
private readonly SortedList<DateTime, HashSet<LogMessageInfo>> _timeline = new SortedList<DateTime, HashSet<LogMessageInfo>>();

public TimelineLogCollectorActor()
public TimelineLogCollectorActor(bool appendLogOutput)
{
_appendLogOutput = appendLogOutput;

Receive<LogMessage>(msg =>
{
var parsedInfo = new LogMessageInfo(msg);
Expand Down Expand Up @@ -68,6 +71,9 @@ public TimelineLogCollectorActor()
{
try
{
if(!_appendLogOutput && File.Exists(dump.FilePath))
File.Delete(dump.FilePath);
File.AppendAllLines(dump.FilePath, lines);
dumpSuccess = true;
}
Expand Down

0 comments on commit 25c3214

Please sign in to comment.