Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
7efc5c2
v1
jakubch1 May 7, 2020
8e88dea
Merging v1
jakubch1 May 19, 2020
3851666
Merge branch 'master' into dev/jachocho/1114286_merging
jakubch1 May 21, 2020
1cae4c5
Rename to MultiTestRunsFinalization
jakubch1 May 21, 2020
04aac62
New version
jakubch1 May 21, 2020
91c8785
More changes
jakubch1 May 21, 2020
d799be6
More changes
jakubch1 May 21, 2020
872bbcc
Next changes
jakubch1 May 22, 2020
69340a5
Fix
jakubch1 May 22, 2020
e23d24d
test
jakubch1 May 25, 2020
6189eb0
More changes
jakubch1 Jun 2, 2020
4870e7c
Merge branch 'master' into dev/jachocho/1114286_merging
jakubch1 Jun 4, 2020
97ab178
Dmc chagnes
jakubch1 Jun 9, 2020
2314550
next
jakubch1 Jun 9, 2020
e7b839f
small changes
jakubch1 Jun 10, 2020
6aa2912
compiled
jakubch1 Jun 10, 2020
29d618d
More changes
jakubch1 Jun 10, 2020
44c5fdc
acceptance tests green
jakubch1 Jun 10, 2020
39f3f84
Review comments #1
jakubch1 Jun 11, 2020
d56baf6
Resolving more comments
jakubch1 Jun 11, 2020
c5a7134
Tests for design mode client
jakubch1 Jun 11, 2020
daaef85
Tests for events handler
jakubch1 Jun 11, 2020
7d7d8a1
revert not related changes
jakubch1 Jun 11, 2020
5ae0b3a
More changes
jakubch1 Jun 12, 2020
a9eee9c
Compiling OK, tests OK
jakubch1 Jun 12, 2020
08b646a
Unit tests for manager
jakubch1 Jun 15, 2020
e16e3ad
More changes
jakubch1 Jun 15, 2020
cbca05a
More tests
jakubch1 Jun 16, 2020
3176175
tests for reqeust sender
jakubch1 Jun 16, 2020
89f7eed
more tests
jakubch1 Jun 16, 2020
3c3c631
Tests for cancelling
jakubch1 Jun 16, 2020
eeb7963
Acceptance tests done
jakubch1 Jun 16, 2020
bbb2244
Remove not used stuff
jakubch1 Jun 16, 2020
4d61a92
Fix comments
jakubch1 Jun 16, 2020
74f971f
Merge branch 'master' into dev/jachocho/1114286_merging
jakubch1 Jun 16, 2020
1190895
Fix race condition in test
jakubch1 Jun 16, 2020
82bb3de
Fix another race condition
jakubch1 Jun 16, 2020
9376adb
Fix converting to xml
jakubch1 Jun 16, 2020
be9537b
fix next test
jakubch1 Jun 16, 2020
f157e24
fix test
jakubch1 Jun 16, 2020
b25a64e
Next changes
jakubch1 Jun 17, 2020
fc7a1c0
Review changes #1
jakubch1 Jun 19, 2020
bcd0673
Fixing multi test finalization manager tests
jakubch1 Jun 19, 2020
147f23e
Fixes
jakubch1 Jun 19, 2020
5d18566
Fix last unit test
jakubch1 Jun 19, 2020
f4c121a
Fix acceptance tests
jakubch1 Jun 19, 2020
1b56b78
Progress feature, compiling + unit tests
jakubch1 Jun 22, 2020
6c308b5
acceptance tests changes
jakubch1 Jun 22, 2020
4f1ede1
More changes
jakubch1 Jun 22, 2020
e635ec5
Fixing resources accesability
jakubch1 Jun 22, 2020
303cee8
Fix test
jakubch1 Jun 22, 2020
676c02b
Fix race conditions in acceptance tests
jakubch1 Jun 23, 2020
25849e9
Merge remote-tracking branch 'upstream/master' into dev/jachocho/1114…
jakubch1 Jun 30, 2020
571028e
RFC changes merged
jakubch1 Jun 30, 2020
2afcc44
Log warning in case of unexpected message id
jakubch1 Jul 1, 2020
ebf1a79
Fix spelling
jakubch1 Jul 1, 2020
e37a6f7
Additional comment
jakubch1 Jul 1, 2020
5e51a03
Restore some stuff in interfaces
jakubch1 Jul 1, 2020
1267291
Big renaming
jakubch1 Jul 1, 2020
1aee79f
Added processingSettings
jakubch1 Jul 1, 2020
74cb25e
Fix naming
jakubch1 Jul 1, 2020
8468ec0
Move explanation to <remarks>
jakubch1 Jul 2, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Unit tests for manager
  • Loading branch information
jakubch1 committed Jun 15, 2020
commit 08b646a75eec6b3b5d6a42815553bb3a94a8daaa
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Threading;
using System.Threading.Tasks;

Expand All @@ -14,11 +15,19 @@ namespace Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine
internal interface IMultiTestRunFinalizationManager
{
/// <summary>
/// Finalizes multi test run
/// Finalizes multi test run and provides results through handler
/// </summary>
/// <param name="attachments">Attachments</param>
/// <param name="eventHandler">EventHandler for handling multi test run finalization events from Engine</param>
/// <param name="cancellationToken">Cancellation token</param>
Task FinalizeMultiTestRunAsync(ICollection<AttachmentSet> attachments, IMultiTestRunFinalizationEventsHandler eventHandler, CancellationToken cancellationToken);

/// <summary>
/// Finalizes multi test
/// </summary>
/// <param name="attachments">Attachments</param>
/// <param name="eventHandler">EventHandler for handling multi test run finalization events from Engine</param>
/// <param name="cancellationToken">Cancellation token</param>
Task<Collection<AttachmentSet>> FinalizeMultiTestRunAsync(ICollection<AttachmentSet> attachments, CancellationToken cancellationToken);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
namespace Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.DataCollection
{
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Threading;
using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities;
using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.Interfaces;
Expand Down Expand Up @@ -58,13 +59,13 @@ public override void HandleTestRunComplete(

if (parallelRunComplete)
{
finalizationManager.FinalizeMultiTestRunAsync(runDataAggregator.RunContextAttachments, null, cancellationToken).Wait();
Collection<AttachmentSet> attachments = finalizationManager.FinalizeMultiTestRunAsync(runDataAggregator.RunContextAttachments, cancellationToken).Result;

var completedArgs = new TestRunCompleteEventArgs(this.runDataAggregator.GetAggregatedRunStats(),
this.runDataAggregator.IsCanceled,
this.runDataAggregator.IsAborted,
this.runDataAggregator.GetAggregatedException(),
this.runDataAggregator.RunContextAttachments,
attachments,
this.runDataAggregator.ElapsedTime);

// Add Metrics from Test Host
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,25 @@ public MultiTestRunFinalizationManager(ITestPlatformEventSource testPlatformEven
this.dataCollectorAttachmentsHandlers = dataCollectorAttachmentsHandlers ?? throw new ArgumentNullException(nameof(dataCollectorAttachmentsHandlers));
}

/// <summary>
/// Finalizes multi test run
/// </summary>
/// <param name="attachments">Attachments</param>
/// <param name="eventHandler">EventHandler for handling multi test run finalization events from Engine</param>
/// <param name="cancellationToken">Cancellation token</param>
/// <inheritdoc/>
public async Task FinalizeMultiTestRunAsync(ICollection<AttachmentSet> attachments, IMultiTestRunFinalizationEventsHandler eventHandler, CancellationToken cancellationToken)
{
await InternalFinalizeMultiTestRunAsync(new Collection<AttachmentSet>(attachments.ToList()), eventHandler, cancellationToken);
}

/// <inheritdoc/>
public Task<Collection<AttachmentSet>> FinalizeMultiTestRunAsync(ICollection<AttachmentSet> attachments, CancellationToken cancellationToken)
{
return InternalFinalizeMultiTestRunAsync(new Collection<AttachmentSet>(attachments.ToList()), null, cancellationToken);
}

private async Task<Collection<AttachmentSet>> InternalFinalizeMultiTestRunAsync(Collection<AttachmentSet> attachments, IMultiTestRunFinalizationEventsHandler eventHandler, CancellationToken cancellationToken)
{
try
{
cancellationToken.ThrowIfCancellationRequested();
testPlatformEventSource.MultiTestRunFinalizationStart(attachments?.Count ?? 0);

testPlatformEventSource.MultiTestRunFinalizationStart(attachments.Count);
cancellationToken.ThrowIfCancellationRequested();

var taskCompletionSource = new TaskCompletionSource<object>();
cancellationToken.Register(() =>
Expand All @@ -54,21 +60,26 @@ public async Task FinalizeMultiTestRunAsync(ICollection<AttachmentSet> attachmen

Task task = Task.Run(() =>
{
HandleAttachements(attachments, cancellationToken);
HandleAttachements(attachments, cancellationToken);
});

var completedTask = await Task.WhenAny(task, taskCompletionSource.Task);

if (completedTask == task)
{
await task;
eventHandler?.HandleMultiTestRunFinalizationComplete(attachments);
testPlatformEventSource.MultiTestRunFinalizationStop(attachments.Count);
return attachments;
}
else
{
eventHandler?.HandleLogMessage(ObjectModel.Logging.TestMessageLevel.Informational, "Finalization was cancelled.");
eventHandler?.HandleMultiTestRunFinalizationComplete(null);
testPlatformEventSource.MultiTestRunFinalizationStop(0);
testPlatformEventSource.MultiTestRunFinalizationStop(0);
}

return null;
}
catch (Exception e)
{
Expand All @@ -77,6 +88,7 @@ public async Task FinalizeMultiTestRunAsync(ICollection<AttachmentSet> attachmen
eventHandler?.HandleLogMessage(ObjectModel.Logging.TestMessageLevel.Error, e.Message);
eventHandler?.HandleMultiTestRunFinalizationComplete(null);
testPlatformEventSource.MultiTestRunFinalizationStop(0);
return null;
}
}

Expand Down
Loading