Fix race in telemetry msbuild arg tests
This commit is contained in:
parent
62c3798679
commit
3de5eb96c2
1 changed files with 6 additions and 1 deletions
|
@ -7,6 +7,7 @@ using System.Linq.Expressions;
|
|||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using FluentAssertions;
|
||||
using Microsoft.DotNet.Cli;
|
||||
using Microsoft.DotNet.Configurer;
|
||||
using Microsoft.DotNet.Tools.MSBuild;
|
||||
using Microsoft.DotNet.Tools.Test.Utilities;
|
||||
|
@ -17,6 +18,9 @@ using MSBuildCommand = Microsoft.DotNet.Tools.Test.Utilities.MSBuildCommand;
|
|||
using System.Diagnostics;
|
||||
using System.Threading;
|
||||
|
||||
// There are tests which modify static Telemetry.CurrentSessionId and they cannot run in parallel
|
||||
[assembly: CollectionBehavior(DisableTestParallelization = true)]
|
||||
|
||||
namespace Microsoft.DotNet.Cli.MSBuild.Tests
|
||||
{
|
||||
public class GivenDotnetMSBuildBuildsProjects : TestBase
|
||||
|
@ -127,7 +131,7 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests
|
|||
{
|
||||
Telemetry telemetry;
|
||||
string[] allArgs = GetArgsForMSBuild(() => true, out telemetry);
|
||||
// telemetry will still be disabled if environmental variable is set
|
||||
// telemetry will still be disabled if environment variable is set
|
||||
if (telemetry.Enabled)
|
||||
{
|
||||
allArgs.Should().NotBeNull();
|
||||
|
@ -158,6 +162,7 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests
|
|||
|
||||
private string[] GetArgsForMSBuild(Func<bool> sentinelExists, out Telemetry telemetry)
|
||||
{
|
||||
Telemetry.CurrentSessionId = null; // reset static session id modified by telemetry constructor
|
||||
telemetry = new Telemetry(new MockNuGetCacheSentinel(sentinelExists));
|
||||
|
||||
MSBuildForwardingApp msBuildForwardingApp = new MSBuildForwardingApp(Enumerable.Empty<string>());
|
||||
|
|
Loading…
Add table
Reference in a new issue