Skip to content

Commit

Permalink
Avoid calling Jenkins.setNoUsageStatistics unless necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
jglick committed Sep 18, 2024
1 parent 5db817b commit 0285c18
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 0285c18

Please sign in to comment.