Skip to content

Commit

Permalink
Enable ignored unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
HHobeck committed Mar 15, 2024
1 parent 61bcef9 commit fe27454
Show file tree
Hide file tree
Showing 21 changed files with 426 additions and 756 deletions.
14 changes: 7 additions & 7 deletions docs/input/docs/reference/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,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 +379,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 +402,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 @@ -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
20 changes: 11 additions & 9 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 @@ -80,7 +80,7 @@ private TrunkBasedConfigurationBuilder()
WithBranch(HotfixBranch.Name).WithConfiguration(new BranchConfiguration()
{
Increment = IncrementStrategy.Patch,
RegularExpression = HotfixBranch.RegexPattern,
RegularExpression = "^hotfix(es)?[/-](?<BranchName>.+)",
SourceBranches =
[
this.MainBranch.Name
Expand All @@ -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 @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,10 @@ 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-bar")]
[TestCase(IncrementStrategy.Patch, null, ExpectedResult = "0.0.0-bar")]
[TestCase(IncrementStrategy.Minor, null, ExpectedResult = "0.0.0-bar")]
[TestCase(IncrementStrategy.Major, null, ExpectedResult = "0.0.0-bar")]
[TestCase(IncrementStrategy.None, null, ExpectedResult = "0.0.0-bar+0")]
[TestCase(IncrementStrategy.Patch, null, ExpectedResult = "0.0.0-bar+0")]
[TestCase(IncrementStrategy.Minor, null, ExpectedResult = "0.0.0-bar+0")]
[TestCase(IncrementStrategy.Major, null, ExpectedResult = "0.0.0-bar+0")]

[TestCase(IncrementStrategy.None, "", ExpectedResult = "0.0.0-1+1")]
[TestCase(IncrementStrategy.Patch, "", ExpectedResult = "0.0.1-1+1")]
Expand All @@ -74,14 +73,14 @@ public string GetVersion(IncrementStrategy increment, string? label)
[TestCase(IncrementStrategy.Minor, "foo", ExpectedResult = "0.1.0-foo.1+1")]
[TestCase(IncrementStrategy.Major, "foo", ExpectedResult = "1.0.0-foo.1+1")]

[TestCase(IncrementStrategy.None, "bar", ExpectedResult = "0.0.0-bar")]
[TestCase(IncrementStrategy.Patch, "bar", ExpectedResult = "0.0.0-bar")]
[TestCase(IncrementStrategy.Minor, "bar", ExpectedResult = "0.0.0-bar")]
[TestCase(IncrementStrategy.Major, "bar", ExpectedResult = "0.0.0-bar")]
public string GetVersionWithTakeAlwaysIncrementedVersion(IncrementStrategy increment, string? label)
[TestCase(IncrementStrategy.None, "bar", ExpectedResult = "0.0.0-bar+0")]
[TestCase(IncrementStrategy.Patch, "bar", ExpectedResult = "0.0.0-bar+0")]
[TestCase(IncrementStrategy.Minor, "bar", ExpectedResult = "0.0.0-bar+0")]
[TestCase(IncrementStrategy.Major, "bar", ExpectedResult = "0.0.0-bar+0")]
public string GetVersionWithPreventIncrementWhenCurrentCommitTaggedFalse(IncrementStrategy increment, string? label)
{
IGitVersionConfiguration trunkBased = TrunkBasedBuilder
//.WithTakeIncrementedVersion(TakeIncrementedVersion.TakeAlwaysIncrementedVersion)
.WithPreventIncrementWhenCurrentCommitTagged(false)
.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-foo.5+0")]
[TestCase(IncrementStrategy.Patch, null, ExpectedResult = "0.0.0-foo.5+0")]
[TestCase(IncrementStrategy.Minor, null, ExpectedResult = "0.0.0-foo.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
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-1+0")]
[TestCase(IncrementStrategy.Patch, null, ExpectedResult = "0.0.1-1+0")]
[TestCase(IncrementStrategy.Minor, null, ExpectedResult = "0.1.0-1+0")]
Expand All @@ -78,10 +77,10 @@ public string GetVersion(IncrementStrategy increment, string? label)
[TestCase(IncrementStrategy.Patch, "bar", ExpectedResult = "0.0.1-bar.1+0")]
[TestCase(IncrementStrategy.Minor, "bar", ExpectedResult = "0.1.0-bar.1+0")]
[TestCase(IncrementStrategy.Major, "bar", ExpectedResult = "1.0.0-bar.1+0")]
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 fe27454

Please sign in to comment.