Skip to content

Commit

Permalink
Merge pull request #834 from jglick/setNoUsageStatistics
Browse files Browse the repository at this point in the history
Avoid calling `Jenkins.setNoUsageStatistics` unless necessary
  • Loading branch information
jglick authored Sep 18, 2024
2 parents 5db817b + 0285c18 commit 0ad306e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/java/org/jvnet/hudson/test/RealJenkinsRule.java
Original file line number Diff line number Diff line change
Expand Up @@ -1345,7 +1345,9 @@ public static final class CustomJenkinsRule extends JenkinsRule implements AutoC
public CustomJenkinsRule(URL url) throws Exception {
this.jenkins = Jenkins.get();
this.url = url;
jenkins.setNoUsageStatistics(true); // cannot use JenkinsRule._configureJenkinsForTest earlier because it tries to save config before loaded
if (jenkins.isUsageStatisticsCollected()) {
jenkins.setNoUsageStatistics(true); // cannot use JenkinsRule._configureJenkinsForTest earlier because it tries to save config before loaded
}
if (JenkinsLocationConfiguration.get().getUrl() == null) {
JenkinsLocationConfiguration.get().setUrl(url.toExternalForm());
}
Expand Down

0 comments on commit 0ad306e

Please sign in to comment.