-
Notifications
You must be signed in to change notification settings - Fork 654
Context assigns branch configuration #339
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
Context assigns branch configuration #339
Conversation
@yannisgu thoughts? |
@nulltoken you might know better than me about this. We seem to have a race condition in commit counting. Rerunning that test which is failing sometimes fails and sometimes passes.. Could there be an issue with commits and the merge commit having the same timestamp? |
GitVersionCore.Tests.IntegrationTests.GitFlow.SupportBranchScenarios.SupportIsCalculatedCorrectly was failing until a rebuild |
@JakeGinnivan If you're referring to
I hope not. Actually relying on timestamps only would be weak. We should always account for the topology (parent/child relationships between commits). How about surrounding the test code with a tight loop in order to see if we can make it fail more frequently? We may get some more actionable results from a ton of failures. |
@nulltoken doesn't fail that often.. but is intermittent.
|
@JakeGinnivan Are you able to Console Out the result of the above method as well and see if that correlates? |
@nulltoken nothing relevant is outputted..
x100
This is the commit counting code, for some reason we sometimes get an incorrect count. Normally it returns 0, but sometimes it returns 1.. |
Progress
Extra commit! |
How does that even happen... |
@nulltoken if you are not subscribed to thread.. check above |
@nulltoken Looks like head has not properly moved when tag is applied. Or tag is creating a new commit somehow. |
Graph was produced with
|
@JakeGinnivan I'm already watching this thread 😉 So the problem isn't related to the way we count,. |
I think I got it. This is indeed a race concurrency issue, but at the git level. If, within the same second, one creates two commit, with the same parents, the same message and the same tree, they will both bear the same sha. In a real life scenario, the second graph would be the expected one (two different merge commits). If you want to enforce and make the test bulletproof (without thread.sleeping for one second), I think that adding one commit on develop at the very beginning of the test would be enough. This way the merge commits will always bear different parents. |
Magic! BaseGitFlowRepositoryFixture now creates a commit on develop after branching, test reliably passes. Tree has changed to
|
Which doesn't really look right. but think that it is git log issue. |
50247e3
to
3705f6f
Compare
Have you chased down all the potential similar issues? Maybe one way to put them under the light would be add a temporary |
Appears ok with the Thread.Sleep in there. Found another test which already fixed that race condition. Wondering if we should thread.Sleep in MergeNoFF - or somehow detect the condition which could cause it and throw or thread.sleep on demand? |
I tend to not feel at ease with Thread.Sleep() calls as they make the tests slower. Regarding the detection of the root cause condition, I'm not sure there's a magic answer. The way I've worked until now is by creating my test case by hand in git command line and then ensuring that the automated ones were reproducing the same topology. I've more than once relied on the hack of adding an additional commit on a branch (to force the merge sha to differ). Most of the time, that wasn't hacking the test per se as it often makes sense to have a |
Yeah, I put it in the GitFlow base fixture, so as long as we use those base fixtures it should be fine. |
So after all that, @yannisgu can you have a look at the PR |
Repository.MakeACommit(); | ||
} | ||
|
||
public void DumpGraph() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was only for test purpose, not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, test purposes. But is useful if we need to debug issues in the future
Ok seems good 👍 Maybe a small test would be helpfull? |
During the course of this PR tests were failing. Also planning more changes which will require tests. This was more a refactoring step. Did you see I took your PR and turned it into a branch in the main repo. This PR is targeting that. If you have further changes also submit PRs to that branch then we can build it up in pieces. |
…ration Context assigns branch configuration
OK Yes I have seen that, sounds good to me! |
No description provided.