Skip to content

Commit ce4d7be

Browse files
dependabot[bot]pje
andauthored
Bump xunit from 2.4.1 to 2.7.1 in /src (#3242)
* 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]>
1 parent bd7235e commit ce4d7be

10 files changed

+57
-31
lines changed

src/Test/L0/CommandLineParserL0.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public void ParsesCommands()
6868
trace.Info("Parsed");
6969

7070
trace.Info("Commands: {0}", clp.Commands.Count);
71-
Assert.True(clp.Commands.Count == 2);
71+
Assert.Equal(2, clp.Commands.Count);
7272
}
7373
}
7474

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

9090
trace.Info("Args: {0}", clp.Args.Count);
91-
Assert.True(clp.Args.Count == 2);
91+
Assert.Equal(2, clp.Args.Count);
9292
Assert.True(clp.Args.ContainsKey("arg1"));
9393
Assert.Equal("arg1val", clp.Args["arg1"]);
9494
Assert.True(clp.Args.ContainsKey("arg2"));
@@ -112,7 +112,7 @@ public void ParsesFlags()
112112
trace.Info("Parsed");
113113

114114
trace.Info("Args: {0}", clp.Flags.Count);
115-
Assert.True(clp.Flags.Count == 2);
115+
Assert.Equal(2, clp.Flags.Count);
116116
Assert.Contains("flag1", clp.Flags);
117117
Assert.Contains("flag2", clp.Flags);
118118
}

src/Test/L0/ConstantGenerationL0.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public void BuildConstantGenerateSucceed()
2424
"osx-arm64"
2525
};
2626

27-
Assert.True(BuildConstants.Source.CommitHash.Length == 40, $"CommitHash should be SHA-1 hash {BuildConstants.Source.CommitHash}");
27+
Assert.Equal(40, BuildConstants.Source.CommitHash.Length);
2828
Assert.True(validPackageNames.Contains(BuildConstants.RunnerPackage.PackageName), $"PackageName should be one of the following '{string.Join(", ", validPackageNames)}', current PackageName is '{BuildConstants.RunnerPackage.PackageName}'");
2929
}
3030
}

src/Test/L0/Listener/CommandSettingsL0.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,7 @@ public void ValidateGoodCommandline()
806806
"test runner" });
807807

808808
// Assert.
809-
Assert.True(command.Validate().Count == 0);
809+
Assert.Equal(0, command.Validate().Count);
810810
}
811811
}
812812

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

846846
// Assert.
847-
Assert.True(command.Validate().Count == 0);
847+
Assert.Equal(0, command.Validate().Count);
848848
}
849849
}
850850

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

876876
// Assert.
877-
Assert.True(command.Validate().Count == 0);
877+
Assert.Equal(0, command.Validate().Count);
878878
}
879879
}
880880

src/Test/L0/Listener/Configuration/ConfigurationManagerL0.cs

+10-10
Original file line numberDiff line numberDiff line change
@@ -190,11 +190,11 @@ public async Task CanEnsureConfigure()
190190
trace.Info("Configured, verifying all the parameter value");
191191
var s = configManager.LoadSettings();
192192
Assert.NotNull(s);
193-
Assert.True(s.ServerUrl.Equals(_expectedServerUrl));
194-
Assert.True(s.AgentName.Equals(_expectedAgentName));
195-
Assert.True(s.PoolId.Equals(_secondRunnerGroupId));
196-
Assert.True(s.WorkFolder.Equals(_expectedWorkFolder));
197-
Assert.True(s.Ephemeral.Equals(true));
193+
Assert.Equal(_expectedServerUrl, s.ServerUrl);
194+
Assert.Equal(_expectedAgentName, s.AgentName);
195+
Assert.Equal(_secondRunnerGroupId, s.PoolId);
196+
Assert.Equal(_expectedWorkFolder, s.WorkFolder);
197+
Assert.True(s.Ephemeral);
198198

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

301301
// validate GetAgentPoolsAsync gets called twice with automation pool type
302302
_runnerServer.Verify(x => x.GetAgentPoolsAsync(It.IsAny<string>(), It.Is<TaskAgentPoolType>(p => p == TaskAgentPoolType.Automation)), Times.Exactly(2));

src/Test/L0/Listener/JobDispatcherL0.cs

+4-1
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,10 @@ public async void DispatchesOneTimeJobRequest()
734734
await jobDispatcher.WaitAsync(CancellationToken.None);
735735

736736
Assert.True(jobDispatcher.RunOnceJobCompleted.Task.IsCompleted, "JobDispatcher should set task complete token for one time agent.");
737-
Assert.True(jobDispatcher.RunOnceJobCompleted.Task.Result, "JobDispatcher should set task complete token to 'TRUE' for one time agent.");
737+
if (jobDispatcher.RunOnceJobCompleted.Task.IsCompleted)
738+
{
739+
Assert.True(await jobDispatcher.RunOnceJobCompleted.Task, "JobDispatcher should set task complete token to 'TRUE' for one time agent.");
740+
}
738741
}
739742
}
740743

src/Test/L0/Listener/RunnerL0.cs

+14-5
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public async void TestRunAsync()
126126
//wait for the runner to run one job
127127
if (!await signalWorkerComplete.WaitAsync(2000))
128128
{
129-
Assert.True(false, $"{nameof(_messageListener.Object.GetNextMessageAsync)} was not invoked.");
129+
Assert.Fail($"{nameof(_messageListener.Object.GetNextMessageAsync)} was not invoked.");
130130
}
131131
else
132132
{
@@ -305,8 +305,11 @@ public async void TestRunOnce()
305305
await Task.WhenAny(runnerTask, Task.Delay(30000));
306306

307307
Assert.True(runnerTask.IsCompleted, $"{nameof(runner.ExecuteCommand)} timed out.");
308-
Assert.True(!runnerTask.IsFaulted, runnerTask.Exception?.ToString());
309-
Assert.True(runnerTask.Result == Constants.Runner.ReturnCode.Success);
308+
Assert.False(runnerTask.IsFaulted, runnerTask.Exception?.ToString());
309+
if (runnerTask.IsCompleted)
310+
{
311+
Assert.Equal(Constants.Runner.ReturnCode.Success, await runnerTask);
312+
}
310313

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

407410
Assert.True(runnerTask.IsCompleted, $"{nameof(runner.ExecuteCommand)} timed out.");
408411
Assert.True(!runnerTask.IsFaulted, runnerTask.Exception?.ToString());
409-
Assert.True(runnerTask.Result == Constants.Runner.ReturnCode.Success);
412+
if (runnerTask.IsCompleted)
413+
{
414+
Assert.Equal(Constants.Runner.ReturnCode.Success, await runnerTask);
415+
}
410416

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

493499
Assert.True(runnerTask.IsCompleted, $"{nameof(runner.ExecuteCommand)} timed out.");
494500
Assert.True(!runnerTask.IsFaulted, runnerTask.Exception?.ToString());
495-
Assert.True(runnerTask.Result == Constants.Runner.ReturnCode.RunOnceRunnerUpdating);
501+
if (runnerTask.IsCompleted)
502+
{
503+
Assert.Equal(Constants.Runner.ReturnCode.RunOnceRunnerUpdating, await runnerTask);
504+
}
496505

497506
_updater.Verify(x => x.SelfUpdate(It.IsAny<AgentRefreshMessage>(), It.IsAny<IJobDispatcher>(), false, It.IsAny<CancellationToken>()), Times.Once);
498507
_jobDispatcher.Verify(x => x.Run(It.IsAny<Pipelines.AgentJobRequestMessage>(), true), Times.Never());

src/Test/L0/ProcessExtensionL0.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public async Task SuccessReadProcessEnv()
5858
trace.Error(ex);
5959
}
6060

61-
Assert.True(false, "Fail to retrive process environment variable.");
61+
Assert.Fail("Failed to retrieve process environment variable.");
6262
}
6363
finally
6464
{

src/Test/L0/RunnerWebProxyL0.cs

+16-2
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,14 @@ public void IsNotUseRawHttpClientHandler()
6565
}
6666
}
6767

68-
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)}");
68+
if (badCode.Count > 0)
69+
{
70+
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)}");
71+
}
72+
else
73+
{
74+
Assert.True(true);
75+
}
6976
}
7077

7178
[Fact]
@@ -112,7 +119,14 @@ public void IsNotUseRawHttpClient()
112119
}
113120
}
114121

115-
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)}");
122+
if (badCode.Count > 0)
123+
{
124+
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)}");
125+
}
126+
else
127+
{
128+
Assert.True(true);
129+
}
116130
}
117131

118132
[Fact]

src/Test/L0/Worker/ActionManagerL0.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ public async void PrepareActions_SkipDownloadActionForSelfRepo()
460460
//Act
461461
var steps = (await _actionManager.PrepareActionsAsync(_ec.Object, actions)).ContainerSetupSteps;
462462

463-
Assert.True(steps.Count == 0);
463+
Assert.Equal(0, steps.Count);
464464
}
465465
finally
466466
{
@@ -915,7 +915,7 @@ public async void PrepareActions_RepositoryActionWithActionfile_Node()
915915
var steps = (await _actionManager.PrepareActionsAsync(_ec.Object, actions)).ContainerSetupSteps;
916916

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

10531053
// node.js based action doesn't need any extra steps to build/pull containers.
1054-
Assert.True(steps.Count == 0);
1054+
Assert.Equal(0, steps.Count);
10551055
var watermarkFile = Path.Combine(_hc.GetDirectory(WellKnownDirectory.Actions), "TingluoHuang/runner_L0", "CompositeBasic.completed");
10561056
Assert.True(File.Exists(watermarkFile));
10571057
// Comes from the composite action
@@ -1245,7 +1245,7 @@ public void LoadsScriptActionDefinition()
12451245
// Assert.
12461246
Assert.NotNull(definition);
12471247
Assert.NotNull(definition.Data);
1248-
Assert.True(definition.Data.Execution.ExecutionType == ActionExecutionType.Script);
1248+
Assert.Equal(ActionExecutionType.Script, definition.Data.Execution.ExecutionType);
12491249
}
12501250
finally
12511251
{

src/Test/Test.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
<ItemGroup>
1818
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.2.0" />
19-
<PackageReference Include="xunit" Version="2.4.1" />
19+
<PackageReference Include="xunit" Version="2.7.1" />
2020
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
2121
<PackageReference Include="System.Buffers" Version="4.5.1" />
2222
<PackageReference Include="System.Reflection.TypeExtensions" Version="4.4.0" />

0 commit comments

Comments
 (0)