From 3af7d02d1d2606ffc2a672b40218a2dfedecef9f Mon Sep 17 00:00:00 2001 From: OrDTesters Date: Sun, 11 Nov 2018 13:13:44 -0600 Subject: [PATCH] HBASE-21467 Fix flaky test TestCoprocessorClassLoader.testCleanupOldJars --- .../apache/hadoop/hbase/util/TestCoprocessorClassLoader.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hbase-common/src/test/java/org/apache/hadoop/hbase/util/TestCoprocessorClassLoader.java b/hbase-common/src/test/java/org/apache/hadoop/hbase/util/TestCoprocessorClassLoader.java index 94cf37db67ae..f32972f5a5ce 100644 --- a/hbase-common/src/test/java/org/apache/hadoop/hbase/util/TestCoprocessorClassLoader.java +++ b/hbase-common/src/test/java/org/apache/hadoop/hbase/util/TestCoprocessorClassLoader.java @@ -62,11 +62,12 @@ public void testCleanupOldJars() throws Exception { File tmpJarFile = new File(jarFile.getParent(), "/tmp/" + className + ".test.jar"); if (tmpJarFile.exists()) tmpJarFile.delete(); assertFalse("tmp jar file should not exist", tmpJarFile.exists()); + ClassLoader parent = TestCoprocessorClassLoader.class.getClassLoader(); + CoprocessorClassLoader.getClassLoader(new Path(jarFile.getParent()), parent, "112", conf); IOUtils.copyBytes(new FileInputStream(jarFile), new FileOutputStream(tmpJarFile), conf, true); assertTrue("tmp jar file should be created", tmpJarFile.exists()); Path path = new Path(jarFile.getAbsolutePath()); - ClassLoader parent = TestCoprocessorClassLoader.class.getClassLoader(); CoprocessorClassLoader.parentDirLockSet.clear(); // So that clean up can be triggered ClassLoader classLoader = CoprocessorClassLoader.getClassLoader(path, parent, "111", conf); assertNotNull("Classloader should be created", classLoader);