Skip to content

Added test for issue #1046 & fix proposition #1136

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 5 commits into from
Feb 25, 2017

Conversation

czesiu
Copy link
Contributor

@czesiu czesiu commented Jan 12, 2017

Hi,

I tried to fix issue #1046. I added test for it and I did some investigation.

Here's image describing structure of commits in this test:

f86dfbe4-cddf-11e6-9a1a-c33859516b6a

I did fix for this, but after my changes two tests was failing: ReleaseBranchScenarios.WhenReleaseBranchIsMergedIntoMasterHighestVersionIsTakenWithIt and DevelopScenarios.InheritVersionFromReleaseBranch.

I changed asserts in failing tests, because looks like this tests had same issue as described in #1046. I don't know if it is proper solution. I didn't find this in documentation. Looks like corner cases.

Could someone check this is ok?

Short description of problem:

var findMergeBase = this.Repository.ObjectDatabase.FindMergeBase(commit, commitToFindCommonBase);

This line returned release 2 commit for arguments: release after merge and develop after merge.

var second = commitToFindCommonBase.Parents.First();
var mergeBase = this.Repository.ObjectDatabase.FindMergeBase(commit, second);

Then calculated parent for develop after merge was Merge branch 'release-2.0.0' into develop. This commits have same merge base - returned mergeBase was also release 2 (look at image).

if (mergeBase == findMergeBase)
{
   break;
}

Because findMergeBase equals mergeBase, then loop stopped executing. It shouldn't stop because mergeBaseWasForwardMerge condition was still met.

Solution

commitToFindCommonBase should be moved up until there is no other merge bases with commit (current branch tip).

@czesiu czesiu changed the title Added tests for issue #1046 & fix proposition Added test for issue #1046 & fix proposition Jan 12, 2017
@czesiu
Copy link
Contributor Author

czesiu commented Jan 26, 2017

There was problem with very long version calculating after my change, so I optimized this fix. Now calculation time is similiar to beta009 version.

@JakeGinnivan
Copy link
Contributor

This all looks pretty reasonable to me, nice investigation and work!

@JakeGinnivan
Copy link
Contributor

Investigating build failure..

Errors, Failures and Warnings
1) Error : C:\projects\gitversion\src\GitVersionTask.Tests\bin\Release\GitVersionTask.Tests.dll
Object reference not set to an instance of an object.
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at NUnit.Engine.Services.TestAgency.LaunchAgentProcess(TestPackage package)
   at NUnit.Engine.Services.TestAgency.CreateRemoteAgent(TestPackage package, Int32 waitTime)
   at NUnit.Engine.Runners.ProcessRunner.CreateAgentAndRunner()
   at NUnit.Engine.Runners.ProcessRunner.RunTests(ITestEventListener listener, TestFilter filter)
Run Settings
    DisposeRunners: True
    WorkDirectory: C:\projects\gitversion
    ImageRuntimeVersion: 4.0.30319
    ImageTargetFrameworkName: .NETFramework,Version=v4.5
    ImageRequiresX86: False
    ImageRequiresDefaultAppDomainAssemblyResolver: False
    NumberOfTestWorkers: 2
Test Run Summary
  Overall result: Failed
  Test Count: 430, Passed: 430, Failed: 0, Warnings: 0, Inconclusive: 0, Skipped: 0
  Start time: 2017-02-24 23:51:55Z
    End time: 2017-02-24 23:52:44Z
    Duration: 49.502 seconds
Results (nunit3) saved as TestResult.xml
Cake.exe : An error occurred when executing task 'Run-NUnit-Tests'.
At line:1 char:1
+ & "C:\projects\gitversion\tools\Cake\Cake.exe" "build.cake" -target=" ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (An error occurr...n-NUnit-Tests'.:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError
 
Error: 
NUnit3: Unexpected error (exit code -100).
Command executed with exception: 

and

1) Error : /home/travis/build/GitTools/GitVersion/src/GitVersionExe.Tests/bin/Release/GitVersionExe.Tests.dll
The object with ID 2 implements the IObjectReference interface for which all dependencies cannot be resolved. The likely cause is two instances of IObjectReference that have a mutual dependency on each other.
Server stack trace: 
  at System.Runtime.Serialization.ObjectManager.GetCompletionInfo (System.Runtime.Serialization.FixupHolder fixup, System.Runtime.Serialization.ObjectHolder& holder, System.Object& member, System.Boolean bThrowIfMissing) [0x000c9] in <f712f98eb8e445c8918edaf595bbe465>:0 
  at System.Runtime.Serialization.ObjectManager.CompleteObject (System.Runtime.Serialization.ObjectHolder holder, System.Boolean bObjectFullyComplete) [0x00159] in <f712f98eb8e445c8918edaf595bbe465>:0 
  at System.Runtime.Serialization.ObjectManager.DoFixups () [0x0011d] in <f712f98eb8e445c8918edaf595bbe465>:0 
  at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize (System.Runtime.Remoting.Messaging.HeaderHandler handler, System.Runtime.Serialization.Formatters.Binary.__BinaryParser serParser, System.Boolean fCheck, System.Boolean isCrossAppDomain, System.Runtime.Remoting.Messaging.IMethodCallMessage methodCallMessage) [0x0007d] in <f712f98eb8e445c8918edaf595bbe465>:0 
  at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize (System.IO.Stream serializationStream, System.Runtime.Remoting.Messaging.HeaderHandler handler, System.Boolean fCheck, System.Boolean isCrossAppDomain, System.Runtime.Remoting.Messaging.IMethodCallMessage methodCallMessage) [0x000ad] in <f712f98eb8e445c8918edaf595bbe465>:0 
  at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize (System.IO.Stream serializationStream, System.Runtime.Remoting.Messaging.HeaderHandler handler, System.Boolean fCheck, System.Runtime.Remoting.Messaging.IMethodCallMessage methodCallMessage) [0x00000] in <f712f98eb8e445c8918edaf595bbe465>:0 
  at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize (System.IO.Stream serializationStream, System.Runtime.Remoting.Messaging.HeaderHandler handler, System.Boolean fCheck) [0x00000] in <f712f98eb8e445c8918edaf595bbe465>:0 
  at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize (System.IO.Stream serializationStream, System.Runtime.Remoting.Messaging.HeaderHandler handler) [0x00000] in <f712f98eb8e445c8918edaf595bbe465>:0 
  at System.Runtime.Remoting.Channels.BinaryServerFormatterSink.ProcessMessage (System.Runtime.Remoting.Channels.IServerChannelSinkStack sinkStack, System.Runtime.Remoting.Messaging.IMessage requestMsg, System.Runtime.Remoting.Channels.ITransportHeaders requestHeaders, System.IO.Stream requestStream, System.Runtime.Remoting.Messaging.IMessage& responseMsg, System.Runtime.Remoting.Channels.ITransportHeaders& responseHeaders, System.IO.Stream& responseStream) [0x000ac] in <84ead97930f6435a826728701893f056>:0 
Exception rethrown at [0]: 
  at (wrapper managed-to-native) System.Object:__icall_wrapper_mono_remoting_wrapper (intptr,intptr)
  at (wrapper remoting-invoke) NUnit.Engine.Agents.RemoteTestAgent:Run (NUnit.Engine.ITestEventListener,NUnit.Engine.TestFilter)
  at NUnit.Engine.Runners.ProcessRunner.RunTests (NUnit.Engine.ITestEventListener listener, NUnit.Engine.TestFilter filter) [0x00025] in <f6948bd2223a41cc9ef1546388fbcb5e>:0 

0_o

@JakeGinnivan JakeGinnivan merged commit 2a54485 into GitTools:master Feb 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants