Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix parallel discovery #3437

Merged
merged 15 commits into from
Apr 8, 2022
Merged

Conversation

Evangelink
Copy link
Member

@Evangelink Evangelink commented Mar 4, 2022

Description

The previously merged #3349 PR wasn't handling parallel discovery correctly for all cases.

Related issue

Fixes AB#1493062

Replaces #3435

@@ -21,13 +20,13 @@ public void AggregateShouldAggregateAbortedCorrectly()
{
var aggregator = new ParallelDiscoveryDataAggregator();

aggregator.Aggregate(totalTests: 5, isAborted: false);
aggregator.Aggregate(new(totalTests: 5, isAborted: false));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might be too tired today, but what is the change in syntax? is that going from method call with parameters to, method call that takes a single object, which has non-default constructor?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The aggregate used to take 2 args (total tests and is aborted), now it takes the event arg (that has an overload with the previous 2 args).

@Evangelink Evangelink force-pushed the fix-parallel-discovery-2 branch 2 times, most recently from a8561c8 to 0d22ead Compare March 7, 2022 12:53
@Evangelink Evangelink changed the title Fix parallel discovery 2 Fix parallel discovery Mar 7, 2022
@Evangelink Evangelink marked this pull request as ready for review March 7, 2022 12:53
@Evangelink
Copy link
Member Author

I still need to make some manual tests before we merge this PR.

@Evangelink Evangelink marked this pull request as draft March 8, 2022 08:09
@Evangelink Evangelink marked this pull request as ready for review March 8, 2022 18:16
@Evangelink Evangelink requested a review from nohwnd March 9, 2022 15:13
@Evangelink Evangelink enabled auto-merge (squash) March 15, 2022 14:51
@Evangelink Evangelink force-pushed the fix-parallel-discovery-2 branch 2 times, most recently from f2f9030 to c77fed8 Compare March 21, 2022 15:44
@@ -1,9 +1,6 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes to this file are unrelated to this PR but fixes the failing acceptance tests that were blocking this PR.

@@ -2,6 +2,7 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using System.IO;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes to this file are unrelated to this PR but fixes the failing acceptance tests that were blocking this PR.

@@ -1,13 +1,12 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes to this file are unrelated to this PR but fixes the failing acceptance tests that were blocking this PR.

@@ -8,8 +8,6 @@
using Microsoft.TestPlatform.TestUtilities;
using Microsoft.VisualStudio.TestTools.UnitTesting;

#nullable disable
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes to this file are unrelated to this PR but fixes the failing acceptance tests that were blocking this PR.

@@ -6,11 +6,12 @@
<Import Project="$(TestPlatformRoot)scripts/build/TestPlatform.Settings.targets" />
<PropertyGroup>
<AssemblyName>Microsoft.VisualStudio.TestPlatform.Common</AssemblyName>
<TargetFrameworks>netstandard2.0;netstandard1.3;net451</TargetFrameworks>
<TargetFrameworks>netstandard2.0;netstandard1.3;net451;net6.0</TargetFrameworks>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding net6.0 because I need a TFM greater or equal to netcoreapp3.0 so that we have a dll where NullableAttributes.cs is not included. Otherwise we get an error that says the attribute comes from 2 locations (system and this). I am using net6.0 because we are already targeting this for DotNetBuildFromSource.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to confirm. This is not being shipped in any of our Nugets?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have just double checked and running build.cmd locally doesn't produce the net6.0 of the dll in the artifacts folder.


namespace Microsoft.TestPlatform;

[SuppressMessage("ApiDesign", "RS0030:Do not used banned APIs", Justification = "Replacement API to allow nullable hints for compiler")]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could remove this because I haven't yet banned the other symbol but keeping it would simplify merge for later changes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep it.

namespace Microsoft.TestPlatform;

[SuppressMessage("ApiDesign", "RS0030:Do not used banned APIs", Justification = "Replacement API to allow nullable hints for compiler")]
internal static class Debug
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am always forcing this one but FYI in recent versions the system Debug.Assert methods already support it.

// This event is always raised from the client side, while the total count of tests is maintained
// only at the testhost end. In case of a discovery abort (various reasons including crash), it is
// not possible to get a list of total tests from testhost. Hence we enforce a -1 count.
Debug.Assert((!isAborted || -1 == totalTests), "If discovery request is aborted totalTest should be -1.");
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to remove this comment because we are now also using this event args inside the parallel discovery.

/// <param name="fullyDiscoveredSources">List of fully discovered sources</param>
/// <param name="partiallyDiscoveredSources">List of partially discovered sources</param>
/// <param name="notDiscoveredSources">List of not discovered sources</param>
public DiscoveryCompleteEventArgs(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cvpoienaru added a new ctor with this signature + the extensions dictionary but this public ctor is not yet released so we can just go with only one overload.

playground/TestPlatform.Playground/Program.cs Show resolved Hide resolved
@@ -6,11 +6,12 @@
<Import Project="$(TestPlatformRoot)scripts/build/TestPlatform.Settings.targets" />
<PropertyGroup>
<AssemblyName>Microsoft.VisualStudio.TestPlatform.Common</AssemblyName>
<TargetFrameworks>netstandard2.0;netstandard1.3;net451</TargetFrameworks>
<TargetFrameworks>netstandard2.0;netstandard1.3;net451;net6.0</TargetFrameworks>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to confirm. This is not being shipped in any of our Nugets?


namespace Microsoft.TestPlatform;

[SuppressMessage("ApiDesign", "RS0030:Do not used banned APIs", Justification = "Replacement API to allow nullable hints for compiler")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep it.

@Evangelink
Copy link
Member Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@Evangelink
Copy link
Member Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@Evangelink Evangelink enabled auto-merge (squash) April 8, 2022 08:14
@Evangelink Evangelink merged commit de3e066 into microsoft:main Apr 8, 2022
@Evangelink Evangelink deleted the fix-parallel-discovery-2 branch April 8, 2022 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants