Skip to content
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

dedupe the list of jar files from test param files #388

Merged
merged 1 commit into from
Jan 4, 2022

Conversation

plaird
Copy link
Contributor

@plaird plaird commented Jan 4, 2022

There is a pause in between the time the user first launches the JUnit tests, and when the tests actually start running. For smaller packages this isn't that noticeable. But for larger projects this is a big problem. This is a partial fix for #381

One package internally has tests in 100 test classes, and the pause to launch them before this change was 6 minutes. This PR reduces that by 25%.

The fix here is to dedupe the list of jar files that come from the Bazel param files (e.g. src/test/java/com/foo/apple/AppleTest_deploy.jar-0.params) which list the classpath for each test class. The internal package has 300 jars on classpath for each test classpath, so the total set of jars we were returning was 30,000 (300x100). Since the classpath was identical for each test class, this fix now correctly returns just 300 jar files as the combined classpath.

Why writing the test for this, I found I had to refactor to make it testable. I discovered that the core logic could be moved from BEF Core to the Bazel SDK.

for (String jarPath : jarPaths) {
// it is important to use a Set for allPaths, as the jarPaths will contain many dupes
// across ParamFiles and we only want each one listed once
allPaths.add(jarPath);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously, we were aggregating all the jar paths using a List not a Set.

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.

1 participant