Skip to content

Commit

Permalink
more fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Gcaya committed Oct 21, 2024
1 parent 2a9ed34 commit 2edd7af
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 33 deletions.
File renamed without changes.
12 changes: 6 additions & 6 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"sdk": {
"version": "8.0.303",
"rollForward": "latestMinor",
"allowPrerelease": false
}
}
"sdk": {
"version": "8.0.303",
"rollForward": "latestMinor",
"allowPrerelease": false
}
}
111 changes: 84 additions & 27 deletions tests/SystemTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public async Task Given_Various_Updates_When_No_AutoMerges_Then_Opens_PRs()
{
await using var testContext = await TestContext.CreateAsync(testOutputHelper);

testContext.AddSuccessfulWorkflowFileToSatisfyBranchPolicy();
testContext.AddFile("global.json", /*lang=json*/"""{"sdk": {"version": "6.0.100"}}""");

testContext.AddFile("Dockerfile",
Expand Down Expand Up @@ -85,6 +86,13 @@ await testContext.AssertPullRequests(
- Package: mcr.microsoft.com/dotnet/sdk
Type: stage
Update: major
- Title: fix(deps): update dependency @squide/core to redacted
Labels:
- renovate
PackageUpdatesInfos:
- Package: @squide/core
Type: dependencies
Update: minor
""");
}

Expand Down Expand Up @@ -136,18 +144,40 @@ public async Task Given_Various_Updates_When_AutoMerge_Enabled_Then_Only_Major_P

await testContext.AssertPullRequests(
"""
- Title: Update dependency dotnet-sdk to redacted
Labels:
- renovate
PackageUpdatesInfos:
- Package: dotnet-sdk
Type: dotnet-sdk
Update: major
- Title: Update dependency System.Text.Json to redacted[SECURITY]
Labels: []
Labels:
- renovate
PackageUpdatesInfos:
- Package: System.Text.Json
Type: nuget
Update: major
- Title: Update mcr.microsoft.com/dotnet/aspnet Docker tag to redacted
Labels:
- renovate
PackageUpdatesInfos:
- Package: mcr.microsoft.com/dotnet/aspnet
Type: final
Update: major
- Title: Update mcr.microsoft.com/dotnet/sdk Docker tag to redacted
Labels:
- renovate
PackageUpdatesInfos:
- Package: mcr.microsoft.com/dotnet/sdk
Type: stage
Update: major
""");

await testContext.AssertCommits(
"""
- Message: chore(deps): update dependency workleap.extensions.configuration.substitution to redacted
- Message: chore(deps): update dependency microsoft.extensions.logging.abstractions to redacted
- Message: Update dependency dotnet-sdk to redacted
- Message: Update dependency Workleap.Extensions.Mongo to redacted
- Message: IDP ScaffoldIt automated test
""");
}
Expand Down Expand Up @@ -198,9 +228,10 @@ await testContext.AssertPullRequests(
}

[Fact]
public async Task Given_MongoDB_Updates_Then_AutoMerges_Minor_Updates_In_Single_PR()
public async Task Given_Dotnet_ThirdParty_Dependencies_Updates_Then_AutoMerges_Minor_Updates()
{
await using var testContext = await TestContext.CreateAsync(testOutputHelper);
testContext.UseRenovateFile("dotnet-trusted-thirdparty-dependencies-automerge.json");

testContext.AddSuccessfulWorkflowFileToSatisfyBranchPolicy();

Expand All @@ -211,6 +242,11 @@ public async Task Given_MongoDB_Updates_Then_AutoMerges_Minor_Updates_In_Single_
<PackageReference Include="MongoDB.Bson" Version="2.27.0" />
<PackageReference Include="MongoDB.Driver" Version="2.27.0" />
<PackageReference Include="MongoDB.Driver.Core" Version="2.27.0" />
<PackageReference Include="coverlet.collector" Version="3.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="xunit" Version="1.9.1" />
</ItemGroup>
</Project>
""");
Expand All @@ -222,9 +258,29 @@ public async Task Given_MongoDB_Updates_Then_AutoMerges_Minor_Updates_In_Single_
await testContext.WaitForBranchPolicyChecksToSucceed();
await testContext.RunRenovate();

await testContext.AssertPullRequests(
"""
- Title: Update microsoft (major)
Labels:
- renovate
PackageUpdatesInfos:
- Package: coverlet.collector
Type: nuget
Update: major
- Package: MongoDB.Bson
Type: nuget
Update: major
- Package: MongoDB.Driver
Type: nuget
Update: major
- Package: xunit
Type: nuget
Update: major
""");

await testContext.AssertCommits(
"""
- Message: chore(deps): update mongodb monorepo to redacted
- Message: Update microsoft
- Message: IDP ScaffoldIt automated test
""");
}
Expand Down Expand Up @@ -306,14 +362,14 @@ public async Task Given_Microsoft_Dependencies_Updates_Then_Opens_Major_PR_And_A

await testContext.AssertPullRequests(
"""
- Title: chore(deps): update dependency system.text.json to redacted[security]
- Title: Update dependency System.Text.Json to redacted[SECURITY]
Labels:
- security
- renovate
PackageUpdatesInfos:
- Package: System.Text.Json
Type: nuget
Update: major
- Title: chore(deps): update microsoft (major)
- Title: Update microsoft (major)
Labels:
- renovate
PackageUpdatesInfos:
Expand All @@ -330,7 +386,7 @@ await testContext.AssertPullRequests(

await testContext.AssertCommits(
"""
- Message: chore(deps): update microsoft
- Message: Update microsoft
- Message: IDP ScaffoldIt automated test
""");
}
Expand Down Expand Up @@ -364,7 +420,7 @@ public async Task Given_Workleap_Dependencies_Updates_Then_Opens_Major_PR_And_Au

await testContext.AssertPullRequests(
"""
- Title: chore(deps): update workleap (major)
- Title: Update workleap (major)
Labels:
- renovate
PackageUpdatesInfos:
Expand All @@ -378,7 +434,7 @@ await testContext.AssertPullRequests(

await testContext.AssertCommits(
"""
- Message: chore(deps): update dependency workleap.domaineventpropagation.abstractions to redacted
- Message: Update workleap
- Message: IDP ScaffoldIt automated test
""");
}
Expand Down Expand Up @@ -412,7 +468,7 @@ public async Task Given_Microsoft_Minor_Dependencies_Update_When_CI_Succeed_Then

await testContext.AssertCommits(
"""
- Message: chore(deps): update dependency system.text.json to redacted[security]
- Message: Update dependency System.Text.Json to redacted[SECURITY]
- Message: IDP ScaffoldIt automated test
""");
}
Expand Down Expand Up @@ -446,9 +502,9 @@ public async Task Given_Microsoft_Minor_Dependencies_Update_When_CI_Fail_Then_Ab

await testContext.AssertPullRequests(
"""
- Title: chore(deps): update dependency system.text.json to redacted[security]
- Title: Update dependency System.Text.Json to redacted[SECURITY]
Labels:
- security
- renovate
PackageUpdatesInfos:
- Package: System.Text.Json
Type: nuget
Expand All @@ -461,7 +517,7 @@ await testContext.AssertPullRequests(
public async Task Given_Workleap_Minor_Dependencies_Update_When_CI_Fail_Then_Abort_AutoMerge_And_Fallback_To_Create_PR()
{
await using var testContext = await TestContext.CreateAsync(testOutputHelper);
testContext.UseRenovateFile("microsoft-automerge.json");
testContext.UseRenovateFile("workleap-automerge.json");

testContext.AddFailingWorklowFileToSatisfyBranchPolicy();

Expand All @@ -486,13 +542,14 @@ public async Task Given_Workleap_Minor_Dependencies_Update_When_CI_Fail_Then_Abo

await testContext.AssertPullRequests(
"""
- Title: chore(deps): update dependency workleap.extensions.mongo to redacted
- Title: Update dependency Workleap.Extensions.Mongo to redacted
Labels:
- renovate
PackageUpdatesInfos:
- Package: Workleap.Extensions.Mongo
Type: nuget
Update: patch
IsAutoMergeEnabled: true
""");
}

Expand Down Expand Up @@ -537,38 +594,38 @@ public async Task Given_Various_Dependencies_Updates_When_CI_Fail_Then_Abort_Aut

await testContext.AssertPullRequests(
"""
- Title: chore(deps): update dependency hangfire.netcore to redacted
- Title: Update dependency @squide/core to redacted
Labels:
- renovate
PackageUpdatesInfos:
- Package: @squide/core
Type: dependencies
Update: minor
IsAutoMergeEnabled: true
- Title: Update dependency Hangfire.NetCore to redacted
Labels:
- renovate
PackageUpdatesInfos:
- Package: Hangfire.NetCore
Type: nuget
Update: minor
IsAutoMergeEnabled: true
- Title: chore(deps): update dependency microsoft.extensions.logging.abstractions to redacted
- Title: Update dependency Microsoft.Extensions.Logging.Abstractions to redacted
Labels:
- renovate
PackageUpdatesInfos:
- Package: Microsoft.Extensions.Logging.Abstractions
Type: nuget
Update: patch
IsAutoMergeEnabled: true
- Title: chore(deps): update dependency workleap.extensions.configuration.substitution to redacted
- Title: Update dependency Workleap.Extensions.Configuration.Substitution to redacted
Labels:
- renovate
PackageUpdatesInfos:
- Package: Workleap.Extensions.Configuration.Substitution
Type: nuget
Update: patch
IsAutoMergeEnabled: true
- Title: fix(deps): update dependency @squide/core to redacted
Labels:
- renovate
PackageUpdatesInfos:
- Package: @squide/core
Type: dependencies
Update: minor
IsAutoMergeEnabled: true
""");
}

Expand Down
4 changes: 4 additions & 0 deletions tests/TestContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ await ExecuteCommand(
"-e", "RENOVATE_PRINT_CONFIG=true",
"-e", $"RENOVATE_TOKEN={token}",
"-e", "RENOVATE_RECREATE_WHEN=always",
"-e", "RENOVATE_PR_HOURLY_LIMIT=0",
"-e", "RENOVATE_PR_CONCURRENT_LIMIT=0",
"-e", "RENOVATE_BRANCH_CONCURRENT_LIMIT=0",
"-e", "RENOVATE_LABELS=[\"renovate\"]",
"-e", "RENOVATE_INHERIT_CONFIG_FILE_NAME=not-renovate.json",
"-e", "RENOVATE_REPOSITORIES=[\"https://github.com/gsoft-inc/renovate-config-test\"]",
"--pull", "always",
Expand Down

0 comments on commit 2edd7af

Please sign in to comment.