Skip to content

Commit

Permalink
Merge pull request #3960 from HHobeck/feature/enable-ignored-unit-tests
Browse files Browse the repository at this point in the history
Enable ignored unit tests
  • Loading branch information
arturcic committed Mar 15, 2024
2 parents 61bcef9 + ff3e1a2 commit 6a6687c
Show file tree
Hide file tree
Showing 27 changed files with 441 additions and 792 deletions.
23 changes: 11 additions & 12 deletions docs/input/docs/reference/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ branches:
of-merged-branch: true
when-current-commit-tagged: false
track-merge-target: false
regex: ^releases?[/-]
regex: ^releases?[/-](?<BranchName>.+)
source-branches:
- develop
- main
Expand Down Expand Up @@ -153,7 +153,7 @@ branches:
increment: Inherit
prevent-increment:
when-current-commit-tagged: false
regex: ^hotfix(es)?[/-]
regex: ^hotfix(es)?[/-](?<BranchName>.+)
source-branches:
- release
- main
Expand All @@ -168,7 +168,7 @@ branches:
prevent-increment:
of-merged-branch: true
track-merge-target: false
regex: ^support[/-]
regex: ^support[/-](?<BranchName>.+)
source-branches:
- main
is-source-branch-for: []
Expand Down Expand Up @@ -209,7 +209,6 @@ is-source-branch-for: []
tracks-release-branches: false
is-release-branch: false
is-main-branch: false
```

The supported built-in configuration for the `GitHubFlow` workflow (`workflow: GitHubFlow/v1`) looks like:
Expand Down Expand Up @@ -257,7 +256,7 @@ branches:
of-merged-branch: true
when-current-commit-tagged: false
track-merge-target: false
regex: ^releases?[/-]
regex: ^releases?[/-](?<BranchName>.+)
source-branches:
- main
- release
Expand Down Expand Up @@ -370,7 +369,7 @@ branches:
- main
pre-release-weight: 30000
pull-request:
mode: ManualDeployment
mode: ContinuousDelivery
label: PullRequest
increment: Inherit
label-number-pattern: '[/-](?<number>\d+)'
Expand All @@ -379,17 +378,16 @@ branches:
- main
pre-release-weight: 30000
unknown:
mode: ManualDeployment
increment: Inherit
increment: Patch
regex: (?<BranchName>.+)
prevent-increment:
when-current-commit-tagged: false
source-branches:
- main
- feature
- hotfix
- pull-request
pre-release-weight: 30000
ignore:
sha: []
mode: ManualDeployment
mode: ContinuousDelivery
label: '{BranchName}'
increment: Inherit
prevent-increment:
Expand All @@ -403,6 +401,7 @@ regex: ''
tracks-release-branches: false
is-release-branch: false
is-main-branch: false
```

The details of the available options are as follows:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ branches:
of-merged-branch: true
when-current-commit-tagged: false
track-merge-target: false
regex: ^releases?[/-]
regex: ^releases?[/-](?<BranchName>.+)
source-branches:
- develop
- main
Expand Down Expand Up @@ -102,7 +102,7 @@ branches:
increment: Inherit
prevent-increment:
when-current-commit-tagged: false
regex: ^hotfix(es)?[/-]
regex: ^hotfix(es)?[/-](?<BranchName>.+)
source-branches:
- release
- main
Expand All @@ -117,7 +117,7 @@ branches:
prevent-increment:
of-merged-branch: true
track-merge-target: false
regex: ^support[/-]
regex: ^support[/-](?<BranchName>.+)
source-branches:
- main
is-source-branch-for: []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ branches:
of-merged-branch: true
when-current-commit-tagged: false
track-merge-target: false
regex: ^releases?[/-]
regex: ^releases?[/-](?<BranchName>.+)
source-branches:
- develop
- main
Expand Down Expand Up @@ -102,7 +102,7 @@ branches:
increment: Inherit
prevent-increment:
when-current-commit-tagged: false
regex: ^hotfix(es)?[/-]
regex: ^hotfix(es)?[/-](?<BranchName>.+)
source-branches:
- release
- main
Expand All @@ -117,7 +117,7 @@ branches:
prevent-increment:
of-merged-branch: true
track-merge-target: false
regex: ^support[/-]
regex: ^support[/-](?<BranchName>.+)
source-branches:
- main
is-source-branch-for: []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ branches:
of-merged-branch: true
when-current-commit-tagged: false
track-merge-target: false
regex: ^releases?[/-]
regex: ^releases?[/-](?<BranchName>.+)
source-branches:
- main
- release
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ branches:
- main
pre-release-weight: 30000
pull-request:
mode: ManualDeployment
mode: ContinuousDelivery
label: PullRequest
increment: Inherit
label-number-pattern: '[/-](?<number>\d+)'
Expand All @@ -54,17 +54,16 @@ branches:
- main
pre-release-weight: 30000
unknown:
mode: ManualDeployment
increment: Inherit
increment: Patch
regex: (?<BranchName>.+)
prevent-increment:
when-current-commit-tagged: false
source-branches:
- main
- feature
- hotfix
- pull-request
pre-release-weight: 30000
ignore:
sha: []
mode: ManualDeployment
mode: ContinuousDelivery
label: '{BranchName}'
increment: Inherit
prevent-increment:
Expand Down
18 changes: 10 additions & 8 deletions src/GitVersion.Configuration/TrunkBasedConfigurationBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ private TrunkBasedConfigurationBuilder()
VersionInBranchPattern = ConfigurationConstants.DefaultVersionInBranchPattern,
TagPreReleaseWeight = ConfigurationConstants.DefaultTagPreReleaseWeight,
UpdateBuildNumber = ConfigurationConstants.DefaultUpdateBuildNumber,
DeploymentMode = DeploymentMode.ManualDeployment,
DeploymentMode = DeploymentMode.ContinuousDelivery,
RegularExpression = string.Empty,
Label = ConfigurationConstants.BranchNamePlaceholder,
Increment = IncrementStrategy.Inherit,
Expand Down Expand Up @@ -96,7 +96,7 @@ private TrunkBasedConfigurationBuilder()
{
Increment = IncrementStrategy.Inherit,
RegularExpression = PullRequestBranch.RegexPattern,
DeploymentMode = DeploymentMode.ManualDeployment,
DeploymentMode = DeploymentMode.ContinuousDelivery,
SourceBranches =
[
this.MainBranch.Name
Expand All @@ -108,15 +108,17 @@ private TrunkBasedConfigurationBuilder()

WithBranch(UnknownBranch.Name).WithConfiguration(new BranchConfiguration
{
Increment = IncrementStrategy.Patch,
RegularExpression = UnknownBranch.RegexPattern,
DeploymentMode = DeploymentMode.ManualDeployment,
Increment = IncrementStrategy.Inherit,
SourceBranches =
[
this.MainBranch.Name,
this.FeatureBranch.Name,
this.PullRequestBranch.Name
]
this.MainBranch.Name
],
PreventIncrement = new PreventIncrementConfiguration()
{
WhenCurrentCommitTagged = false
},
PreReleaseWeight = 30000
});
}
}
1 change: 0 additions & 1 deletion src/GitVersion.Core.Tests/Core/RepositoryStoreTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ public void GetBranchesContainingCommitThrowsDirectlyOnNullCommit()
}

[Test]
[Ignore("Needs more investigations.")]
public void FindCommitBranchWasBranchedFromShouldReturnNullIfTheRemoteIsTheOnlySource()
{
using var fixture = new RemoteRepositoryFixture();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -452,17 +452,20 @@ public void CommitBeetweenMergeReleaseToDevelopShouldNotResetCount()
}

[Test]
[Ignore("Needs investigation")]
public void ReleaseBranchShouldUseBranchNameVersionDespiteBumpInPreviousCommit()
{
var configuration = GitFlowConfigurationBuilder.New
.WithSemanticVersionFormat(SemanticVersionFormat.Loose)
.Build();

using var fixture = new EmptyRepositoryFixture();
fixture.Repository.MakeATaggedCommit("1.0");
fixture.Repository.MakeACommit("+semver:major");
fixture.Repository.MakeACommit();

fixture.BranchTo("release/2.0");

fixture.AssertFullSemver("2.0.0-beta.1+2");
fixture.AssertFullSemver("2.0.0-beta.1+2", configuration);
}

[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,27 +36,6 @@ private static GitFlowConfigurationBuilder GetConfigurationBuilder() => GitFlowC
.WithSourceBranches("main")
);

[Test]
[Ignore("Support of multiple tunks are not implemented at the moment.")]
public void VerifyNonMainMainlineVersionIdenticalAsMain()
{
var configuration = GetConfigurationBuilder().Build();

using var fixture = new EmptyRepositoryFixture();
fixture.Repository.MakeACommit("1");

fixture.BranchTo("feature/foo", "foo");
fixture.MakeACommit("2 +semver: major");
fixture.Checkout(MainBranch);
fixture.MergeNoFF("feature/foo");

fixture.AssertFullSemver("1.0.0", configuration);

fixture.BranchTo("support/1.0", "support");

fixture.AssertFullSemver("1.0.0", configuration);
}

[Test]
public void MergedFeatureBranchesToMainImpliesRelease()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ public string GetVersionWithNoLabelOnMain(
return fixture!.GetVersion(trunkBased).FullSemVer;
}

[Ignore("Enable if WithTakeIncrementedVersion(TakeIncrementedVersion.TakeAlwaysIncrementedVersion) feature has been implemented!")]
[TestCase(IncrementStrategy.None, IncrementStrategy.None, null, ExpectedResult = "0.0.0-1+0")]
[TestCase(IncrementStrategy.None, IncrementStrategy.Patch, null, ExpectedResult = "0.0.1-1+0")]
[TestCase(IncrementStrategy.None, IncrementStrategy.Minor, null, ExpectedResult = "0.1.0-1+0")]
Expand Down Expand Up @@ -232,11 +231,11 @@ public string GetVersionWithNoLabelOnMain(
[TestCase(IncrementStrategy.Major, IncrementStrategy.Patch, "{BranchName}", ExpectedResult = "0.0.1-foo.1+0")]
[TestCase(IncrementStrategy.Major, IncrementStrategy.Minor, "{BranchName}", ExpectedResult = "0.1.0-foo.1+0")]
[TestCase(IncrementStrategy.Major, IncrementStrategy.Major, "{BranchName}", ExpectedResult = "1.0.0-foo.1+0")]
public string GetVersionWithNoLabelOnMainAndTakeAlwaysIncrementedVersion(
public string GetVersionWithNoLabelAndPreventIncrementWhenCurrentCommitTaggedFalseOnMain(
IncrementStrategy incrementOnMain, IncrementStrategy increment, string? label)
{
IGitVersionConfiguration trunkBased = TrunkBasedBuilder
//.WithTakeIncrementedVersion(TakeIncrementedVersion.TakeAlwaysIncrementedVersion)
.WithPreventIncrementWhenCurrentCommitTagged(false)
.WithBranch("main", _ => _.WithIncrement(incrementOnMain).WithLabel(null))
.WithBranch("feature", _ => _.WithIncrement(increment).WithLabel(label))
.Build();
Expand Down Expand Up @@ -358,7 +357,6 @@ public string GetVersionWithEmptyLabelOnMain(
return fixture!.GetVersion(trunkBased).FullSemVer;
}

[Ignore("Enable if WithTakeIncrementedVersion(TakeIncrementedVersion.TakeAlwaysIncrementedVersion) feature has been implemented!")]
[TestCase(IncrementStrategy.None, IncrementStrategy.None, null, ExpectedResult = "0.0.0-1+0")]
[TestCase(IncrementStrategy.None, IncrementStrategy.Patch, null, ExpectedResult = "0.0.1-1+0")]
[TestCase(IncrementStrategy.None, IncrementStrategy.Minor, null, ExpectedResult = "0.1.0-1+0")]
Expand Down Expand Up @@ -442,11 +440,11 @@ public string GetVersionWithEmptyLabelOnMain(
[TestCase(IncrementStrategy.Major, IncrementStrategy.Patch, "{BranchName}", ExpectedResult = "0.0.1-foo.1+0")]
[TestCase(IncrementStrategy.Major, IncrementStrategy.Minor, "{BranchName}", ExpectedResult = "0.1.0-foo.1+0")]
[TestCase(IncrementStrategy.Major, IncrementStrategy.Major, "{BranchName}", ExpectedResult = "1.0.0-foo.1+0")]
public string GetVersionWithEmptyLabelOnMainAndTakeAlwaysIncrementedVersion(
public string GetVersionWithEmptyLabelAndPreventIncrementWhenCurrentCommitTaggedFalseOnMain(
IncrementStrategy incrementOnMain, IncrementStrategy increment, string? label)
{
IGitVersionConfiguration trunkBased = TrunkBasedBuilder
//.WithTakeIncrementedVersion(TakeIncrementedVersion.TakeAlwaysIncrementedVersion)
.WithPreventIncrementWhenCurrentCommitTagged(false)
.WithBranch("main", _ => _.WithIncrement(incrementOnMain).WithLabel(string.Empty))
.WithBranch("feature", _ => _.WithIncrement(increment).WithLabel(label))
.Build();
Expand Down Expand Up @@ -568,7 +566,6 @@ public string GetVersionWithLabelFooOnMain(
return fixture!.GetVersion(trunkBased).FullSemVer;
}

[Ignore("Enable if WithTakeIncrementedVersion(TakeIncrementedVersion.TakeAlwaysIncrementedVersion) feature has been implemented!")]
[TestCase(IncrementStrategy.None, IncrementStrategy.None, null, ExpectedResult = "0.0.0-1+0")]
[TestCase(IncrementStrategy.None, IncrementStrategy.Patch, null, ExpectedResult = "0.0.1-1+0")]
[TestCase(IncrementStrategy.None, IncrementStrategy.Minor, null, ExpectedResult = "0.1.0-1+0")]
Expand Down Expand Up @@ -652,11 +649,11 @@ public string GetVersionWithLabelFooOnMain(
[TestCase(IncrementStrategy.Major, IncrementStrategy.Patch, "{BranchName}", ExpectedResult = "0.0.1-foo.1+0")]
[TestCase(IncrementStrategy.Major, IncrementStrategy.Minor, "{BranchName}", ExpectedResult = "0.1.0-foo.1+0")]
[TestCase(IncrementStrategy.Major, IncrementStrategy.Major, "{BranchName}", ExpectedResult = "1.0.0-foo.1+0")]
public string GetVersionWithLabelFooOnMainAndTakeAlwaysIncrementedVersion(
public string GetVersionWithLabelFooAndPreventIncrementWhenCurrentCommitTaggedFalseOnMain(
IncrementStrategy incrementOnMain, IncrementStrategy increment, string? label)
{
IGitVersionConfiguration trunkBased = TrunkBasedBuilder
//.WithTakeIncrementedVersion(TakeIncrementedVersion.TakeAlwaysIncrementedVersion)
.WithPreventIncrementWhenCurrentCommitTagged(false)
.WithBranch("main", _ => _.WithIncrement(incrementOnMain).WithLabel("foo"))
.WithBranch("feature", _ => _.WithIncrement(increment).WithLabel(label))
.Build();
Expand Down Expand Up @@ -778,7 +775,6 @@ public string GetVersionWithLabelBarOnMain(
return fixture!.GetVersion(trunkBased).FullSemVer;
}

[Ignore("Enable if WithTakeIncrementedVersion(TakeIncrementedVersion.TakeAlwaysIncrementedVersion) feature has been implemented!")]
[TestCase(IncrementStrategy.None, IncrementStrategy.None, null, ExpectedResult = "0.0.0-1+0")]
[TestCase(IncrementStrategy.None, IncrementStrategy.Patch, null, ExpectedResult = "0.0.1-1+0")]
[TestCase(IncrementStrategy.None, IncrementStrategy.Minor, null, ExpectedResult = "0.1.0-1+0")]
Expand Down Expand Up @@ -862,11 +858,11 @@ public string GetVersionWithLabelBarOnMain(
[TestCase(IncrementStrategy.Major, IncrementStrategy.Patch, "{BranchName}", ExpectedResult = "0.0.1-foo.1+0")]
[TestCase(IncrementStrategy.Major, IncrementStrategy.Minor, "{BranchName}", ExpectedResult = "0.1.0-foo.1+0")]
[TestCase(IncrementStrategy.Major, IncrementStrategy.Major, "{BranchName}", ExpectedResult = "1.0.0-foo.1+0")]
public string GetVersionWithLabelBarOnMainAndTakeAlwaysIncrementedVersion(
public string GetVersionWithLabelBarAndPreventIncrementWhenCurrentCommitTaggedFalseOnMain(
IncrementStrategy incrementOnMain, IncrementStrategy increment, string? label)
{
IGitVersionConfiguration trunkBased = TrunkBasedBuilder
//.WithTakeIncrementedVersion(TakeIncrementedVersion.TakeAlwaysIncrementedVersion)
.WithPreventIncrementWhenCurrentCommitTagged(false)
.WithBranch("main", _ => _.WithIncrement(incrementOnMain).WithLabel("bar"))
.WithBranch("feature", _ => _.WithIncrement(increment).WithLabel(label))
.Build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ public string GetVersion(IncrementStrategy increment, string? label)
return fixture!.GetVersion(trunkBased).FullSemVer;
}

[Ignore("Enable if WithTakeIncrementedVersion(TakeIncrementedVersion.TakeAlwaysIncrementedVersion) feature has been implemented!")]
[TestCase(IncrementStrategy.None, null, ExpectedResult = "0.0.0-5+0")]
[TestCase(IncrementStrategy.Patch, null, ExpectedResult = "0.0.0-5+0")]
[TestCase(IncrementStrategy.Minor, null, ExpectedResult = "0.0.0-5+0")]
Expand All @@ -78,10 +77,10 @@ public string GetVersion(IncrementStrategy increment, string? label)
[TestCase(IncrementStrategy.Patch, "bar", ExpectedResult = "0.0.1-bar.1+1")]
[TestCase(IncrementStrategy.Minor, "bar", ExpectedResult = "0.1.0-bar.1+1")]
[TestCase(IncrementStrategy.Major, "bar", ExpectedResult = "1.0.0-bar.1+1")]
public string GetVersionWithTakeAlwaysIncrementedVersion(IncrementStrategy increment, string? label)
public string GetVersionWithPreventIncrementWhenCurrentCommitTaggedFalse(IncrementStrategy increment, string? label)
{
IGitVersionConfiguration trunkBased = TrunkBasedBuilder
//.WithTakeIncrementedVersion(TakeIncrementedVersion.TakeAlwaysIncrementedVersion)
.WithPreventIncrementWhenCurrentCommitTagged(false)
.WithBranch("feature", _ => _.WithIncrement(increment).WithLabel(label))
.Build();

Expand Down
Loading

0 comments on commit 6a6687c

Please sign in to comment.