jenkinsci / parallel-test-executor-plugin

Parallel test executor plugin
https://plugins.jenkins.io/parallel-test-executor/
50 stars 55 forks source link

Make sure there are no duplicate cases #281

Closed Vlatombe closed 5 months ago

Vlatombe commented 5 months ago

Follows up #279

This can happen if the same test case (class name + method name) appears in multiple branches of the same build.

For example, this happens for InjectedTest, which is set in the root package for any jenkins plugin. So if you have a multi-module build, using test case split would cause an exception because InjectedTest is found once per module.

The existing java test class implementation used Map#putAll to collect entries, which just overrides existing entries and doesn't cause an exception to be thrown in that case.

Testing done

### Submitter checklist
- [ ] Make sure you are opening from a **topic/feature/bugfix branch** (right side) and not your main branch!
- [ ] Ensure that the pull request title represents the desired changelog entry
- [ ] Please describe what you did
- [ ] Link to relevant issues in GitHub or Jira
- [ ] Link to relevant pull requests, esp. upstream and downstream changes
- [ ] Ensure you have provided tests - that demonstrates feature works or fixes the issue
Vlatombe commented 5 months ago

Added a unit test that fails with

java.lang.IllegalStateException: Duplicate key org.jenkinsci.plugins.parallel_test_executor.Test1#test1Case1 (attempted merging values org.jenkinsci.plugins.parallel_test_executor.Test1#test1Case1 and org.jenkinsci.plugins.parallel_test_executor.Test1#test1Case1)

with the previous implementation.