Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[JENKINS-38696] - huson.remoting.UtilTest#mkdirs() should not try cre…
…ating global paths on Windows.

On Windows you CAN create such directories.
But it does not mean we should try it even in tests.

Ideally the test needs to be rewritten or removed at all.
  • Loading branch information
oleg-nenashev committed Nov 13, 2017
1 parent 239f635 commit f238814
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/test/java/hudson/remoting/UtilTest.java
Expand Up @@ -161,13 +161,15 @@ public void mkdirs() throws IOException {
assertTrue(file.exists());
assertTrue(file.isFile());

// Fail to create aloud
try {
File forbidden = new File("/proc/nonono");
Util.mkdirs(forbidden);
fail();
} catch (IOException ex) {
// Expected
// Fail to create aloud, do not try on Windows
if (!Launcher.isWindows()) {
try {
File forbidden = new File("/proc/nonono");
Util.mkdirs(forbidden);
fail("The directory has been created when it should not: " + forbidden);
} catch (IOException ex) {
// Expected
}
}
}
}

0 comments on commit f238814

Please sign in to comment.