Skip to content

Commit

Permalink
Bump xunit from 2.4.1 to 2.7.1 in /src (#3242)
Browse files Browse the repository at this point in the history
* Bump xunit from 2.4.1 to 2.7.1 in /src

Bumps [xunit](https://github.com/xunit/xunit) from 2.4.1 to 2.7.1.
- [Commits](xunit/xunit@2.4.1...2.7.1)

---
updated-dependencies:
- dependency-name: xunit
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* Appease xunit warnings after upgrading to v2.7.1

* Appease the whitespace linter

* Appease the whitespace linter

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Patrick Ellis <[email protected]>
  • Loading branch information
dependabot[bot] and pje authored May 21, 2024
1 parent bd7235e commit ce4d7be
Show file tree
Hide file tree
Showing 10 changed files with 57 additions and 31 deletions.
6 changes: 3 additions & 3 deletions src/Test/L0/CommandLineParserL0.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public void ParsesCommands()
trace.Info("Parsed");

trace.Info("Commands: {0}", clp.Commands.Count);
Assert.True(clp.Commands.Count == 2);
Assert.Equal(2, clp.Commands.Count);
}
}

Expand All @@ -88,7 +88,7 @@ public void ParsesArgs()
trace.Info("Parsed");

trace.Info("Args: {0}", clp.Args.Count);
Assert.True(clp.Args.Count == 2);
Assert.Equal(2, clp.Args.Count);
Assert.True(clp.Args.ContainsKey("arg1"));
Assert.Equal("arg1val", clp.Args["arg1"]);
Assert.True(clp.Args.ContainsKey("arg2"));
Expand All @@ -112,7 +112,7 @@ public void ParsesFlags()
trace.Info("Parsed");

trace.Info("Args: {0}", clp.Flags.Count);
Assert.True(clp.Flags.Count == 2);
Assert.Equal(2, clp.Flags.Count);
Assert.Contains("flag1", clp.Flags);
Assert.Contains("flag2", clp.Flags);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Test/L0/ConstantGenerationL0.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public void BuildConstantGenerateSucceed()
"osx-arm64"
};

Assert.True(BuildConstants.Source.CommitHash.Length == 40, $"CommitHash should be SHA-1 hash {BuildConstants.Source.CommitHash}");
Assert.Equal(40, BuildConstants.Source.CommitHash.Length);
Assert.True(validPackageNames.Contains(BuildConstants.RunnerPackage.PackageName), $"PackageName should be one of the following '{string.Join(", ", validPackageNames)}', current PackageName is '{BuildConstants.RunnerPackage.PackageName}'");
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/Test/L0/Listener/CommandSettingsL0.cs
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,7 @@ public void ValidateGoodCommandline()
"test runner" });

// Assert.
Assert.True(command.Validate().Count == 0);
Assert.Equal(0, command.Validate().Count);
}
}

Expand Down Expand Up @@ -844,7 +844,7 @@ public void ValidateGoodFlagCommandCombination(string validCommand, string flag)
var command = new CommandSettings(hc, args: new string[] { validCommand, $"--{flag}" });

// Assert.
Assert.True(command.Validate().Count == 0);
Assert.Equal(0, command.Validate().Count);
}
}

Expand Down Expand Up @@ -874,7 +874,7 @@ public void ValidateGoodArgCommandCombination(string validCommand, string arg, s
var command = new CommandSettings(hc, args: new string[] { validCommand, $"--{arg}", argValue });

// Assert.
Assert.True(command.Validate().Count == 0);
Assert.Equal(0, command.Validate().Count);
}
}

Expand Down
20 changes: 10 additions & 10 deletions src/Test/L0/Listener/Configuration/ConfigurationManagerL0.cs
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,11 @@ public async Task CanEnsureConfigure()
trace.Info("Configured, verifying all the parameter value");
var s = configManager.LoadSettings();
Assert.NotNull(s);
Assert.True(s.ServerUrl.Equals(_expectedServerUrl));
Assert.True(s.AgentName.Equals(_expectedAgentName));
Assert.True(s.PoolId.Equals(_secondRunnerGroupId));
Assert.True(s.WorkFolder.Equals(_expectedWorkFolder));
Assert.True(s.Ephemeral.Equals(true));
Assert.Equal(_expectedServerUrl, s.ServerUrl);
Assert.Equal(_expectedAgentName, s.AgentName);
Assert.Equal(_secondRunnerGroupId, s.PoolId);
Assert.Equal(_expectedWorkFolder, s.WorkFolder);
Assert.True(s.Ephemeral);

// validate GetAgentPoolsAsync gets called twice with automation pool type
_runnerServer.Verify(x => x.GetAgentPoolsAsync(It.IsAny<string>(), It.Is<TaskAgentPoolType>(p => p == TaskAgentPoolType.Automation)), Times.Exactly(2));
Expand Down Expand Up @@ -292,11 +292,11 @@ public async Task ConfigureDefaultLabelsDisabledWithCustomLabels()
trace.Info("Configured, verifying all the parameter value");
var s = configManager.LoadSettings();
Assert.NotNull(s);
Assert.True(s.ServerUrl.Equals(_expectedServerUrl));
Assert.True(s.AgentName.Equals(_expectedAgentName));
Assert.True(s.PoolId.Equals(_secondRunnerGroupId));
Assert.True(s.WorkFolder.Equals(_expectedWorkFolder));
Assert.True(s.Ephemeral.Equals(true));
Assert.Equal(_expectedServerUrl, s.ServerUrl);
Assert.Equal(_expectedAgentName, s.AgentName);
Assert.Equal(_secondRunnerGroupId, s.PoolId);
Assert.Equal(_expectedWorkFolder, s.WorkFolder);
Assert.True(s.Ephemeral);

// validate GetAgentPoolsAsync gets called twice with automation pool type
_runnerServer.Verify(x => x.GetAgentPoolsAsync(It.IsAny<string>(), It.Is<TaskAgentPoolType>(p => p == TaskAgentPoolType.Automation)), Times.Exactly(2));
Expand Down
5 changes: 4 additions & 1 deletion src/Test/L0/Listener/JobDispatcherL0.cs
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,10 @@ public async void DispatchesOneTimeJobRequest()
await jobDispatcher.WaitAsync(CancellationToken.None);

Assert.True(jobDispatcher.RunOnceJobCompleted.Task.IsCompleted, "JobDispatcher should set task complete token for one time agent.");
Assert.True(jobDispatcher.RunOnceJobCompleted.Task.Result, "JobDispatcher should set task complete token to 'TRUE' for one time agent.");
if (jobDispatcher.RunOnceJobCompleted.Task.IsCompleted)
{
Assert.True(await jobDispatcher.RunOnceJobCompleted.Task, "JobDispatcher should set task complete token to 'TRUE' for one time agent.");
}
}
}

Expand Down
19 changes: 14 additions & 5 deletions src/Test/L0/Listener/RunnerL0.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public async void TestRunAsync()
//wait for the runner to run one job
if (!await signalWorkerComplete.WaitAsync(2000))
{
Assert.True(false, $"{nameof(_messageListener.Object.GetNextMessageAsync)} was not invoked.");
Assert.Fail($"{nameof(_messageListener.Object.GetNextMessageAsync)} was not invoked.");
}
else
{
Expand Down Expand Up @@ -305,8 +305,11 @@ public async void TestRunOnce()
await Task.WhenAny(runnerTask, Task.Delay(30000));

Assert.True(runnerTask.IsCompleted, $"{nameof(runner.ExecuteCommand)} timed out.");
Assert.True(!runnerTask.IsFaulted, runnerTask.Exception?.ToString());
Assert.True(runnerTask.Result == Constants.Runner.ReturnCode.Success);
Assert.False(runnerTask.IsFaulted, runnerTask.Exception?.ToString());
if (runnerTask.IsCompleted)
{
Assert.Equal(Constants.Runner.ReturnCode.Success, await runnerTask);
}

_jobDispatcher.Verify(x => x.Run(It.IsAny<Pipelines.AgentJobRequestMessage>(), true), Times.Once(),
$"{nameof(_jobDispatcher.Object.Run)} was not invoked.");
Expand Down Expand Up @@ -406,7 +409,10 @@ public async void TestRunOnceOnlyTakeOneJobMessage()

Assert.True(runnerTask.IsCompleted, $"{nameof(runner.ExecuteCommand)} timed out.");
Assert.True(!runnerTask.IsFaulted, runnerTask.Exception?.ToString());
Assert.True(runnerTask.Result == Constants.Runner.ReturnCode.Success);
if (runnerTask.IsCompleted)
{
Assert.Equal(Constants.Runner.ReturnCode.Success, await runnerTask);
}

_jobDispatcher.Verify(x => x.Run(It.IsAny<Pipelines.AgentJobRequestMessage>(), true), Times.Once(),
$"{nameof(_jobDispatcher.Object.Run)} was not invoked.");
Expand Down Expand Up @@ -492,7 +498,10 @@ public async void TestRunOnceHandleUpdateMessage()

Assert.True(runnerTask.IsCompleted, $"{nameof(runner.ExecuteCommand)} timed out.");
Assert.True(!runnerTask.IsFaulted, runnerTask.Exception?.ToString());
Assert.True(runnerTask.Result == Constants.Runner.ReturnCode.RunOnceRunnerUpdating);
if (runnerTask.IsCompleted)
{
Assert.Equal(Constants.Runner.ReturnCode.RunOnceRunnerUpdating, await runnerTask);
}

_updater.Verify(x => x.SelfUpdate(It.IsAny<AgentRefreshMessage>(), It.IsAny<IJobDispatcher>(), false, It.IsAny<CancellationToken>()), Times.Once);
_jobDispatcher.Verify(x => x.Run(It.IsAny<Pipelines.AgentJobRequestMessage>(), true), Times.Never());
Expand Down
2 changes: 1 addition & 1 deletion src/Test/L0/ProcessExtensionL0.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public async Task SuccessReadProcessEnv()
trace.Error(ex);
}

Assert.True(false, "Fail to retrive process environment variable.");
Assert.Fail("Failed to retrieve process environment variable.");
}
finally
{
Expand Down
18 changes: 16 additions & 2 deletions src/Test/L0/RunnerWebProxyL0.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,14 @@ public void IsNotUseRawHttpClientHandler()
}
}

Assert.True(badCode.Count == 0, $"The following code is using Raw HttpClientHandler() which will not follow the proxy setting agent have. Please use HostContext.CreateHttpClientHandler() instead.\n {string.Join("\n", badCode)}");
if (badCode.Count > 0)
{
Assert.Fail($"The following code is using Raw HttpClientHandler() which will not follow the proxy setting agent have. Please use HostContext.CreateHttpClientHandler() instead.\n {string.Join("\n", badCode)}");
}
else
{
Assert.True(true);
}
}

[Fact]
Expand Down Expand Up @@ -112,7 +119,14 @@ public void IsNotUseRawHttpClient()
}
}

Assert.True(badCode.Count == 0, $"The following code is using Raw HttpClient() which will not follow the proxy setting agent have. Please use New HttpClient(HostContext.CreateHttpClientHandler()) instead.\n {string.Join("\n", badCode)}");
if (badCode.Count > 0)
{
Assert.Fail($"The following code is using Raw HttpClient() which will not follow the proxy setting agent have. Please use New HttpClient(HostContext.CreateHttpClientHandler()) instead.\n {string.Join("\n", badCode)}");
}
else
{
Assert.True(true);
}
}

[Fact]
Expand Down
8 changes: 4 additions & 4 deletions src/Test/L0/Worker/ActionManagerL0.cs
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ public async void PrepareActions_SkipDownloadActionForSelfRepo()
//Act
var steps = (await _actionManager.PrepareActionsAsync(_ec.Object, actions)).ContainerSetupSteps;

Assert.True(steps.Count == 0);
Assert.Equal(0, steps.Count);
}
finally
{
Expand Down Expand Up @@ -915,7 +915,7 @@ public async void PrepareActions_RepositoryActionWithActionfile_Node()
var steps = (await _actionManager.PrepareActionsAsync(_ec.Object, actions)).ContainerSetupSteps;

// node.js based action doesn't need any extra steps to build/pull containers.
Assert.True(steps.Count == 0);
Assert.Equal(0, steps.Count);
}
finally
{
Expand Down Expand Up @@ -1051,7 +1051,7 @@ public async void PrepareActions_CompositeActionWithActionfile_Node()
var steps = (await _actionManager.PrepareActionsAsync(_ec.Object, actions)).ContainerSetupSteps;

// node.js based action doesn't need any extra steps to build/pull containers.
Assert.True(steps.Count == 0);
Assert.Equal(0, steps.Count);
var watermarkFile = Path.Combine(_hc.GetDirectory(WellKnownDirectory.Actions), "TingluoHuang/runner_L0", "CompositeBasic.completed");
Assert.True(File.Exists(watermarkFile));
// Comes from the composite action
Expand Down Expand Up @@ -1245,7 +1245,7 @@ public void LoadsScriptActionDefinition()
// Assert.
Assert.NotNull(definition);
Assert.NotNull(definition.Data);
Assert.True(definition.Data.Execution.ExecutionType == ActionExecutionType.Script);
Assert.Equal(ActionExecutionType.Script, definition.Data.Execution.ExecutionType);
}
finally
{
Expand Down
2 changes: 1 addition & 1 deletion src/Test/Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.2.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit" Version="2.7.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
<PackageReference Include="System.Buffers" Version="4.5.1" />
<PackageReference Include="System.Reflection.TypeExtensions" Version="4.4.0" />
Expand Down

0 comments on commit ce4d7be

Please sign in to comment.