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

Update TUnit #521

Merged
merged 11 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ Define your pipeline in .NET! Strong types, intellisense, parallelisation, and t
| ModularPipelines.WinGet | Helpers for interacting with the Windows Package Manager. | [![nuget](https://img.shields.io/nuget/v/ModularPipelines.WinGet.svg)](https://www.nuget.org/packages/ModularPipelines.WinGet/) |
| ModularPipelines.Yarn | Helpers for interacting with Yarn CLI. | [![nuget](https://img.shields.io/nuget/v/ModularPipelines.Yarn.svg)](https://www.nuget.org/packages/ModularPipelines.Yarn/) |


## Getting Started

If you want to see how to get started, or want to know more about ModularPipelines, [read the Documentation here](https://thomhurst.github.io/ModularPipelines)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ await context.DotNet().Format(new DotNetFormatOptions
Severity = "info",
}, cancellationToken);

var branchTriggeringPullRequest = context.GitHub().EnvironmentVariables.RefName!;
var branchTriggeringPullRequest = context.GitHub().EnvironmentVariables.HeadRef!;

await GitHelpers.SetUserCommitInformation(context, cancellationToken);

Expand Down
2 changes: 1 addition & 1 deletion src/ModularPipelines.Build/Modules/FormatMarkdownModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ await context.Node().Npx.ExecuteAsync(new NpxOptions
return await NothingAsync();
}

var branchTriggeringPullRequest = context.GitHub().EnvironmentVariables.RefName!;
var branchTriggeringPullRequest = context.GitHub().EnvironmentVariables.HeadRef!;

await GitHelpers.SetUserCommitInformation(context, cancellationToken);

Expand Down
1 change: 1 addition & 0 deletions src/ModularPipelines.Build/ReleaseNotes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
null
3 changes: 1 addition & 2 deletions test/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
</PropertyGroup>

<ItemGroup Condition="'$(MSBuildProjectName)' != 'ModularPipelines.TestsForTests'">
<PackageReference Include="TUnit" Version="0.1.379-alpha01" />
<PackageReference Include="Microsoft.Testing.Extensions.CodeCoverage" Version="17.10.4" />
<PackageReference Include="TUnit" Version="0.1.401-alpha01" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
<ItemGroup>
<PackageReference Include="Azure.ResourceManager" Version="1.12.0" />
<PackageReference Include="Azure.Identity" Version="1.12.0" />
<PackageReference Update="TUnit" Version="0.1.379-alpha01" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion test/ModularPipelines.UnitTests/DependsOnTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ private class DependsOnSelfModule : Module
}
}

[DependsOn(typeof(ModuleFailedException))]
[ModularPipelines.Attributes.DependsOn(typeof(ModuleFailedException))]
private class DependsOnNonModule : Module
{
protected override async Task<IDictionary<string, object>?> ExecuteAsync(IPipelineContext context, CancellationToken cancellationToken)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Testing.Extensions.TrxReport" Version="1.2.1" />
<PackageReference Include="Moq" Version="4.20.70" />
<PackageReference Include="NReco.Logging.File" Version="1.2.1" />
<PackageReference Include="RichardSzalay.MockHttp" Version="7.0.0" />
<PackageReference Update="TUnit" Version="0.1.379-alpha01" />
</ItemGroup>

<ItemGroup>
Expand Down
20 changes: 10 additions & 10 deletions test/ModularPipelines.UnitTests/NotInParallelTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class Module1 : Module<string>
{
protected override async Task<string?> ExecuteAsync(IPipelineContext context, CancellationToken cancellationToken)
{
await Task.Delay(TimeSpan.FromSeconds(2), cancellationToken);
await Task.Delay(TimeSpan.FromSeconds(5), cancellationToken);
return GetType().Name;
}
}
Expand All @@ -23,7 +23,7 @@ public class Module2 : Module<string>
{
protected override async Task<string?> ExecuteAsync(IPipelineContext context, CancellationToken cancellationToken)
{
await Task.Delay(TimeSpan.FromSeconds(2), cancellationToken);
await Task.Delay(TimeSpan.FromSeconds(5), cancellationToken);
return GetType().Name;
}
}
Expand All @@ -34,7 +34,7 @@ public class NotParallelModuleWithParallelDependency : Module<string>
{
protected override async Task<string?> ExecuteAsync(IPipelineContext context, CancellationToken cancellationToken)
{
await Task.Delay(TimeSpan.FromSeconds(2), cancellationToken);
await Task.Delay(TimeSpan.FromSeconds(5), cancellationToken);
return GetType().Name;
}
}
Expand All @@ -43,7 +43,7 @@ public class ParallelDependency : Module<string>
{
protected override async Task<string?> ExecuteAsync(IPipelineContext context, CancellationToken cancellationToken)
{
await Task.Delay(TimeSpan.FromSeconds(2), cancellationToken);
await Task.Delay(TimeSpan.FromSeconds(5), cancellationToken);
return GetType().Name;
}
}
Expand All @@ -54,7 +54,7 @@ public class NotParallelModuleWithNonParallelDependency : Module<string>
{
protected override async Task<string?> ExecuteAsync(IPipelineContext context, CancellationToken cancellationToken)
{
await Task.Delay(TimeSpan.FromSeconds(2), cancellationToken);
await Task.Delay(TimeSpan.FromSeconds(5), cancellationToken);
return GetType().Name;
}
}
Expand All @@ -70,8 +70,8 @@ public async Task NotInParallel()
var firstModule = results.Modules.MinBy(x => x.EndTime)!;
var nextModule = results.Modules.MaxBy(x => x.EndTime)!;
await Assert.That(nextModule.StartTime)
.Is.EqualToWithTolerance(firstModule.StartTime + TimeSpan.FromSeconds(2),
TimeSpan.FromMilliseconds(500));
.Is.EqualToWithTolerance(firstModule.StartTime + TimeSpan.FromSeconds(5),
TimeSpan.FromSeconds(1));
}

[Test, Retry(3)]
Expand All @@ -85,7 +85,7 @@ public async Task NotInParallel_With_ParallelDependency()
var firstModule = results.Modules.MinBy(x => x.EndTime)!;
var nextModule = results.Modules.MaxBy(x => x.EndTime)!;
await Assert.That(nextModule.StartTime)
.Is.EqualToWithTolerance(firstModule.StartTime + TimeSpan.FromSeconds(2), TimeSpan.FromMilliseconds(500));
.Is.EqualToWithTolerance(firstModule.StartTime + TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(1));
}

[Test, Retry(3)]
Expand All @@ -100,9 +100,9 @@ public async Task NotInParallel_With_NonParallelDependency()
var firstModule = results.Modules.MinBy(x => x.EndTime)!;
var nextModule = results.Modules.MaxBy(x => x.EndTime)!;

var expectedStartTime = firstModule.StartTime + TimeSpan.FromSeconds(4);
var expectedStartTime = firstModule.StartTime + TimeSpan.FromSeconds(10);

await Assert.That(nextModule.StartTime)
.Is.EqualToWithTolerance(expectedStartTime, TimeSpan.FromMilliseconds(500));
.Is.EqualToWithTolerance(expectedStartTime, TimeSpan.FromSeconds(1));
}
}
Loading