|
78 | 78 | import org.jvnet.hudson.test.JenkinsRule; |
79 | 79 |
|
80 | 80 | import static org.junit.Assert.*; |
| 81 | +import org.junit.After; |
81 | 82 | import org.junit.Before; |
82 | 83 | import org.junit.BeforeClass; |
83 | 84 |
|
@@ -122,6 +123,13 @@ public void enableSystemCredentialsProvider() throws Exception { |
122 | 123 | assertThat("The system credentials provider is enabled", store, notNullValue()); |
123 | 124 | } |
124 | 125 |
|
| 126 | + @After |
| 127 | + public void waitForJenkinsIdle() throws Exception { |
| 128 | + if (cleanupIsUnreliable()) { |
| 129 | + rule.waitUntilNoActivityUpTo(5001); |
| 130 | + } |
| 131 | + } |
| 132 | + |
125 | 133 | private StandardCredentials getInvalidCredential() { |
126 | 134 | String username = "bad-user"; |
127 | 135 | String password = "bad-password"; |
@@ -1274,7 +1282,6 @@ public void testSubmoduleFixup() throws Exception { |
1274 | 1282 |
|
1275 | 1283 |
|
1276 | 1284 | FreeStyleBuild ub = rule.assertBuildStatusSuccess(u.scheduleBuild2(0)); |
1277 | | - System.out.println(ub.getLog()); |
1278 | 1285 | for (int i=0; (d.getLastBuild()==null || d.getLastBuild().isBuilding()) && i<100; i++) // wait only up to 10 sec to avoid infinite loop |
1279 | 1286 | Thread.sleep(100); |
1280 | 1287 |
|
@@ -2771,4 +2778,15 @@ public void buildEnvironmentFor(Run run, EnvVars envs, TaskListener listener) { |
2771 | 2778 | } |
2772 | 2779 | } |
2773 | 2780 |
|
| 2781 | + /** Returns true if test cleanup is not reliable */ |
| 2782 | + private boolean cleanupIsUnreliable() { |
| 2783 | + // Windows cleanup is unreliable on ci.jenkins.io |
| 2784 | + String jobUrl = System.getenv("JOB_URL"); |
| 2785 | + return isWindows() && jobUrl != null && jobUrl.contains("ci.jenkins.io"); |
| 2786 | + } |
| 2787 | + |
| 2788 | + /** inline ${@link hudson.Functions#isWindows()} to prevent a transient remote classloader issue */ |
| 2789 | + private boolean isWindows() { |
| 2790 | + return java.io.File.pathSeparatorChar==';'; |
| 2791 | + } |
2774 | 2792 | } |
0 commit comments