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

Allow RealJenkinsRule controllers to know surefire.forkNumber #513

Merged
merged 1 commit into from Nov 21, 2022

Conversation

jglick
Copy link
Member

@jglick jglick commented Nov 11, 2022

This Maven property can be helpful to avoid conflicts between parallelized tests when using test services, if you cannot reliably randomize ports. Needs jenkinsci/plugin-pom#645 to ensure the property gets propagated from Maven to the Surefire booter JVM.

ProcessBuilder pb = new ProcessBuilder(argv);
System.out.println("Launching: " + pb.command());
pb.environment().put("JENKINS_HOME", home.getAbsolutePath());
Map<String, String> env = new TreeMap<>();
Copy link
Member

Choose a reason for hiding this comment

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

Nice touch to use something better than HashMap here (and consistent with hudson.EnvVars, which also uses TreeMap). It's too bad that ProcessBuilder#environment uses a HashMap internally, scrambling the order of whatever the user passes in. I wish hudson.EnvVars had extended LinkedHashMap (insertion order), because that is how libc's setenv(3) works, but that ship sailed a long time ago.

Copy link
Member Author

Choose a reason for hiding this comment

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

As far as I know the ultimate order is irrelevant, but it is much nicer to print the variables in order below.

Copy link
Member

Choose a reason for hiding this comment

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

but it is much nicer to print the variables in order below.

… which is why I wrote it was a nice touch above.

@jglick jglick marked this pull request as ready for review November 18, 2022 15:00
@jglick jglick merged commit 9e128c9 into jenkinsci:master Nov 21, 2022
@jglick jglick deleted the RealJenkinsRule-forkNumber branch November 21, 2022 12:09
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.

None yet

3 participants