Skip to content
Permalink
Browse files

[JENKINS-38696] - PrefetchingTest should disable JAR caching by defau…

…lt in Windows
  • Loading branch information...
oleg-nenashev committed Jul 7, 2017
1 parent 35c651a commit 40fa6a11f9eaf6826990544b1304c7ac6c9bab1c
Showing with 16 additions and 11 deletions.
  1. +16 −11 src/test/java/hudson/remoting/PrefetchingTest.java
@@ -28,11 +28,19 @@

// checksum of the jar files to force loading
private Checksum sum1,sum2;

// TODO: Rework to Rule once RmiTestBase is updated to JUnit 4/5
private boolean oldCachingValue;

@Override
protected void setUp() throws Exception {
super.setUp();

oldCachingValue = ResourceImageInJar.DISABLE_FILE_CACHING_IN_JAR_CONNECTION;
if (Launcher.isWindows()) {
// On Windows the test relies on the file locks cleanup when removing the temporary directory
ResourceImageInJar.DISABLE_FILE_CACHING_IN_JAR_CONNECTION = true;
}

URL jar1 = getClass().getClassLoader().getResource("remoting-test-client.jar");
URL jar2 = getClass().getClassLoader().getResource("remoting-test-client-tests.jar");

@@ -65,20 +73,17 @@ private File toFile(URL url) {

@Override
protected void tearDown() throws Exception {
ResourceImageInJar.DISABLE_FILE_CACHING_IN_JAR_CONNECTION = oldCachingValue;
cl.cleanup();
super.tearDown();

// because the dir is used by FIleSystemJarCache to asynchronously load stuff
// we might fail to shut it down right away
for (int i=0; ; i++) {
try {
FileUtils.deleteDirectory(dir);
return;
} catch (IOException e) {
if (i==3) throw e;
Thread.sleep(1000);
}
// TODO: Add to RMI base?
if (Boolean.getBoolean("remoting.test.interactive")) {

}

// Clenup the temporary cache and ensure we have no locked files left
FileUtils.deleteDirectory(dir);
}

/**

0 comments on commit 40fa6a1

Please sign in to comment.
You can’t perform that action at this time.