Skip to content

More test fixes #363

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

Merged
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
6 changes: 3 additions & 3 deletions GitVersionCore.Tests/Fixtures/EmptyRepositoryFixture.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System.Diagnostics;
using System.Text;
using GitVersion;
using GitVersion.Helpers;
Expand All @@ -23,13 +23,13 @@ public void DumpGraph()
@"log --graph --abbrev-commit --decorate --date=relative --all",
RepositoryPath);

Console.Write(output.ToString());
Trace.Write(output.ToString());
}

static IRepository CreateNewRepository(string path)
{
LibGit2Sharp.Repository.Init(path);
Console.WriteLine("Created git repository at '{0}'", path);
Trace.WriteLine("Created git repository at '{0}'", path);

return new Repository(path);
}
Expand Down
1 change: 0 additions & 1 deletion GitVersionCore.Tests/GitVersionContextTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ public void UsesBranchSpecificConfigOverTopLevelDefaults()
}
};
var context = new GitVersionContext(mockRepository, develop, config);
context.Configuration.VersioningMode.ShouldBe(VersioningMode.ContinuousDeployment);
context.Configuration.Tag.ShouldBe("alpha");
}

Expand Down
23 changes: 10 additions & 13 deletions GitVersionCore.Tests/GitVersionCore.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -81,20 +81,17 @@
<Compile Include="Helpers\DirectoryHelper.cs" />
<Compile Include="IntegrationTests\PullRequestScenarios.cs" />
<Compile Include="IntegrationTests\RemoteRepositoryTests.cs" />
<Compile Include="IntegrationTests\GitFlow\DevelopScenarios.cs" />
<Compile Include="IntegrationTests\GitFlow\GitFlowFeatureBranchTests.cs" />
<Compile Include="IntegrationTests\GitFlow\GitFlowSupportBranchScenarios.cs" />
<Compile Include="IntegrationTests\GitFlow\MetaDataByCommitScenarios.cs" />
<Compile Include="IntegrationTests\GitFlow\PatchScenarios.cs" />
<Compile Include="IntegrationTests\GitFlow\ReleaseBranchTests.cs" />
<Compile Include="IntegrationTests\GitFlow\SwitchingToGitFlowScenarios.cs" />
<Compile Include="IntegrationTests\GitFlow\UncycloScenarios.cs" />
<Compile Include="IntegrationTests\GitHubFlow\GitHubFlowFeatureBranchTests.cs" />
<Compile Include="IntegrationTests\GitHubFlow\OtherBranchTests.cs" />
<Compile Include="IntegrationTests\GitHubFlow\ReleaseBranchTests.cs" />
<Compile Include="IntegrationTests\DevelopScenarios.cs" />
<Compile Include="IntegrationTests\FeatureBranchTests.cs" />
<Compile Include="IntegrationTests\SupportBranchScenarios.cs" />
<Compile Include="IntegrationTests\MetaDataByCommitScenarios.cs" />
<Compile Include="IntegrationTests\PatchScenarios.cs" />
<Compile Include="IntegrationTests\ReleaseBranchTests.cs" />
<Compile Include="IntegrationTests\SwitchingToGitFlowScenarios.cs" />
<Compile Include="IntegrationTests\UncycloScenarios.cs" />
<Compile Include="IntegrationTests\OtherBranchTests.cs" />
<Compile Include="Helpers\Constants.cs" />
<Compile Include="InformationalVersionBuilderTests.cs" />
<Compile Include="IntegrationTests\GitHubFlow\GitHubFlowSupportBranchScenarios.cs" />
<Compile Include="JsonVersionBuilderTests.cs" />
<Compile Include="Mocks\MockBranch.cs" />
<Compile Include="Mocks\MockBranchCollection.cs" />
Expand All @@ -113,7 +110,7 @@
<Compile Include="Fixtures\EmptyRepositoryFixture.cs" />
<Compile Include="Helpers\GitTestExtensions.cs" />
<Compile Include="Helpers\PathHelper.cs" />
<Compile Include="IntegrationTests\GitHubFlow\MasterTests.cs" />
<Compile Include="IntegrationTests\MasterTests.cs" />
<Compile Include="ApprovalTestsConfig.cs" />
<Compile Include="Fixtures\RepositoryFixtureBase.cs" />
<Compile Include="SemanticVersionTests.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,21 @@ public void WhenDevelopBranchedFromMaster_MinorIsIncreased()
}

[Test]
public void MergingReleaseBranchBackIntoDevelopWithoutMergingToMaster_DoesNotBumpDevelopVersion()
public void MergingReleaseBranchBackIntoDevelopWithMergingToMaster_DoesBumpDevelopVersion()
{
using (var fixture = new EmptyRepositoryFixture(new Config()))
{
fixture.Repository.MakeATaggedCommit("1.0.0");
fixture.Repository.CreateBranch("develop").Checkout();
fixture.Repository.MakeACommit();
fixture.Repository.CreateBranch("release-2.0.0").Checkout();
fixture.AssertFullSemver("2.0.0-beta.1+0");
fixture.Repository.MakeACommit();
fixture.Repository.Checkout("master");
fixture.Repository.MergeNoFF("release-2.0.0", Constants.SignatureNow());

fixture.Repository.Checkout("develop");
fixture.AssertFullSemver("1.1.0-unstable.1+1");
fixture.Repository.MergeNoFF("release-2.0.0", Constants.SignatureNow());
fixture.AssertFullSemver("1.1.0-unstable.1+1");
fixture.AssertFullSemver("2.1.0-unstable.1+0");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,26 @@
using NUnit.Framework;

[TestFixture]
public class GitHubFlowFeatureBranchTests
public class FeatureBranchTests
{
[Test]
public void ShouldNotUseNumberInFeatureBranchAsPreReleaseNumber()
public void ShouldNotUseNumberInFeatureBranchAsPreReleaseNumberOffDevelop()
{
using (var fixture = new EmptyRepositoryFixture(new Config()))
{
fixture.Repository.MakeATaggedCommit("1.0.0");
fixture.Repository.CreateBranch("develop");
fixture.Repository.Checkout("develop");
fixture.Repository.CreateBranch("feature/JIRA-123");
fixture.Repository.Checkout("feature/JIRA-123");
fixture.Repository.MakeCommits(5);

fixture.AssertFullSemver("1.1.0-JIRA-123.1+5");
}
}

[Test]
public void ShouldNotUseNumberInFeatureBranchAsPreReleaseNumberOffMaster()
{
using (var fixture = new EmptyRepositoryFixture(new Config()))
{
Expand Down

This file was deleted.

This file was deleted.

117 changes: 0 additions & 117 deletions GitVersionCore.Tests/IntegrationTests/GitHubFlow/ReleaseBranchTests.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public void GivenARepositoryWithTagAndNextVersionInConfig_VersionShouldMatchVers
[Test]
public void GivenARepositoryWithTagAndANextVersionTxtFileAndNoCommits_VersionShouldBeTag()
{
const string ExpectedNextVersion = "1.1.0";
const string ExpectedNextVersion = "1.1.0";
using (var fixture = new EmptyRepositoryFixture(new Config { NextVersion = ExpectedNextVersion }))
{
const string TaggedVersion = "1.0.3";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public void CanTakeVersionFromReleaseBranch()
fixture.Repository.CreateBranch("alpha-2.0.0");
fixture.Repository.Checkout("alpha-2.0.0");

fixture.AssertFullSemver("2.0.0-alpha.1+5");
fixture.AssertFullSemver("2.0.0-alpha.1+0");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,26 @@ public void PatchLatestReleaseExample()
fixture.Repository.MakeACommit();
fixture.AssertFullSemver("1.2.1-beta.1+1");
fixture.Repository.ApplyTag("1.2.1-beta.1");
fixture.AssertFullSemver("1.2.1-beta.1+0");
fixture.AssertFullSemver("1.2.1-beta.1+1");
fixture.Repository.MakeACommit();
fixture.AssertFullSemver("1.2.1-beta.2+1");
fixture.AssertFullSemver("1.2.1-beta.2+2");

// Merge hotfix branch to master
fixture.Repository.Checkout("master");


fixture.Repository.MergeNoFF("hotfix-1.2.1", Constants.SignatureNow());
fixture.AssertFullSemver("1.2.1");
fixture.AssertFullSemver("1.2.1+0");

fixture.Repository.ApplyTag("1.2.1");
fixture.AssertFullSemver("1.2.1");
fixture.AssertFullSemver("1.2.1+0");

// Verify develop version
fixture.Repository.Checkout("develop");
fixture.AssertFullSemver("1.3.0-unstable.0+0");
fixture.AssertFullSemver("1.3.0-unstable.1+1");

fixture.Repository.MergeNoFF("hotfix-1.2.1", Constants.SignatureNow());
fixture.AssertFullSemver("1.3.0-unstable.1+1");
fixture.AssertFullSemver("1.3.0-unstable.1+0");
}
}

Expand All @@ -50,22 +50,23 @@ public void PatchOlderReleaseExample()
r.MakeATaggedCommit("1.2.0");
}))
{
var targetCommit = ((Commit) fixture.Repository.Tags.Single(t => t.Name == "1.1.0").Target);
// create hotfix branch
fixture.Repository.CreateBranch("hotfix-1.1.1", (Commit) fixture.Repository.Tags.Single(t => t.Name == "1.1.0").Target).Checkout();
fixture.Repository.CreateBranch("hotfix-1.1.1", targetCommit).Checkout();

fixture.AssertFullSemver("1.1.1-beta.1+0");
fixture.Repository.MakeACommit();
fixture.AssertFullSemver("1.1.1-beta.1+1");

// Merge hotfix branch to support
fixture.Repository.CreateBranch("support-1.2", (Commit) fixture.Repository.Tags.Single(t => t.Name == "1.1.0").Target).Checkout();
fixture.AssertFullSemver("1.1.0");
fixture.Repository.CreateBranch("support-1.1", (Commit) fixture.Repository.Tags.Single(t => t.Name == "1.1.0").Target).Checkout();
fixture.AssertFullSemver("1.1.0+0");

fixture.Repository.MergeNoFF("hotfix-1.1.1", Constants.SignatureNow());
fixture.AssertFullSemver("1.1.1");
fixture.AssertFullSemver("1.1.1+0");

fixture.Repository.ApplyTag("1.1.1");
fixture.AssertFullSemver("1.1.1");
fixture.AssertFullSemver("1.1.1+0");

// Verify develop version
fixture.Repository.Checkout("develop");
Expand Down
Loading