Skip to content

Parallelize unit tests #1584

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 4 commits into from
Feb 20, 2019

Conversation

asbjornu
Copy link
Member

@asbjornu asbjornu commented Feb 15, 2019

This is a rebase of #1384 to see if the failing tests can be fixed somehow. Resolves #1384.

@asbjornu asbjornu force-pushed the feature/parallelize-unit-tests branch 6 times, most recently from f031ded to 63cb9f1 Compare February 20, 2019 12:04
jkingry and others added 4 commits February 20, 2019 13:07
# Conflicts:
#	src/GitVersionCore.Tests/AssemblyInfoFileUpdaterTests.cs
#	src/GitVersionCore.Tests/GitVersionCore.Tests.csproj
#	src/GitVersionCore.Tests/GitVersionInformationGeneratorTests.cs
#	src/GitVersionExe.Tests/GitVersionExe.Tests.csproj
#	src/GitVersionTask.Tests/GitVersionTask.Tests.csproj
Add length check for log indent level to avoid exceptions like this:

Error Message:
 System.ArgumentOutOfRangeException : Length cannot be less than zero.
Parameter name: length
Stack Trace:
  at System.String.Substring (System.Int32 startIndex, System.Int32 length) [0x0004a] in <f3f2aa82c3a04d48845485ce37124803>:0
  at GitVersion.Logger+<>c__DisplayClass19_0.<IndentLog>b__0 () [0x00010] in <05fc21618d444a47be7b45d99fa1d3c6>:0
  at GitVersion.Logger+ActionDisposable.Dispose () [0x00000] in <05fc21618d444a47be7b45d99fa1d3c6>:0
  at GitVersion.VersionCalculation.BaseVersionCalculator.GetBaseVersion (GitVersion.GitVersionContext context) [0x00211] in
<05fc21618d444a47be7b45d99fa1d3c6>:0
  at GitVersion.VersionCalculation.NextVersionCalculator.FindVersion (GitVersion.GitVersionContext context) [0x0003f] in
<05fc21618d444a47be7b45d99fa1d3c6>:0
  at GitVersion.GitVersionFinder.FindVersion (GitVersion.GitVersionContext context) [0x000a1] in <05fc21618d444a47be7b45d99fa1d3c6>:0
  at GitVersionCore.Tests.GitToolsTestingExtensions.ExecuteGitVersion (GitVersion.GitVersionContext context) [0x00007] in
<e141d799e05748d0bf9753d21cdcadd7>:0
  at GitVersionCore.Tests.GitToolsTestingExtensions.GetVersion (GitTools.Testing.RepositoryFixtureBase fixture, GitVersion.Config configuration,
LibGit2Sharp.IRepository repository, System.String commitId, System.Boolean isForTrackedBranchOnly, System.String targetBranch) [0x00030] in
<e141d799e05748d0bf9753d21cdcadd7>:0
  at GitVersionCore.Tests.GitToolsTestingExtensions.AssertFullSemver (GitTools.Testing.RepositoryFixtureBase fixture, GitVersion.Config
configuration, System.String fullSemver, LibGit2Sharp.IRepository repository, System.String commitId, System.Boolean isForTrackedBranchOnly,
System.String targetBranch) [0x00050] in <e141d799e05748d0bf9753d21cdcadd7>:0
  at GitVersionCore.Tests.GitToolsTestingExtensions.AssertFullSemver (GitTools.Testing.RepositoryFixtureBase fixture, System.String fullSemver,
LibGit2Sharp.IRepository repository, System.String commitId, System.Boolean isForTrackedBranchOnly, System.String targetBranch) [0x00007] in
<e141d799e05748d0bf9753d21cdcadd7>:0
  at DocumentationSamples.GitFlowFeatureBranch () [0x000a2] in <e141d799e05748d0bf9753d21cdcadd7>:0
  at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder,
System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in <f3f2aa82c3a04d48845485ce37124803>:0

https://dev.azure.com/GitTools/GitVersion/_build/results?buildId=191&view=logs&jobId=a5e52b91-c83f-5429-4a68-c246fc63a4f7&taskId=d6b35a2b-3a7d-590e-76eb-a415813199f6&lineStart=225&lineEnd=226&colStart=1&colEnd=1
Add try/catch around teardown code to avoid errors like this:

An error occurred in a custom teardown action.
Teardown error: System.InvalidOperationException: The context data has not been setup.
   at Cake.Core.CakeDataService.Get[TData]() in C:\projects\cake\src\Cake.Core\CakeDataService.cs:line 32
   at Cake.Core.CakeEngineActions.<>c__DisplayClass21_0`1.<RegisterTeardown>b__0(ITeardownContext context) in
C:\projects\cake\src\Cake.Core\CakeEngineActions.cs:line 64
   at Cake.Core.CakeEngine.PerformTeardown(IExecutionStrategy strategy, ICakeContext context, Stopwatch stopWatch, CakeReport report, Boolean
exceptionWasThrown, Exception thrownException) in C:\projects\cake\src\Cake.Core\CakeEngine.cs:line 493

https://travis-ci.org/GitTools/GitVersion/jobs/495911487#L1914
@arturcic
Copy link
Member

@asbjornu can you squash the commits as one commit?

@asbjornu
Copy link
Member Author

@arturcic: I'm personally not a fan of squashing commits, since we loose the thought process and meaning behind many of the code changes. I find the commit messages in 9d00191, 4c4c08d and 63cb9f1 valuable in the case similar problems surface in the future. If we squash, those messages go away or get attached to a single large commit that also deals with other stuff, so the intent becomes unclear.

I'm all for rebasing a PR to get rid of merge-commits (updates) from master, though.

@arturcic
Copy link
Member

Agree with the point, but in this particular case it's about testing the CI if the build fails, that's why I thought better to have one commit that represents the actual change to the code base that improves it

@asbjornu asbjornu merged commit 9f6fbbd into GitTools:master Feb 20, 2019
@asbjornu asbjornu deleted the feature/parallelize-unit-tests branch February 20, 2019 13:38
@arturcic arturcic added this to the 5.0.0 milestone Feb 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants