This is an automated email from the ASF dual-hosted git repository.

sewen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git

commit 3820bdd364a86f2acebe54577a36c01499dfe326
Author: Stephan Ewen <se...@apache.org>
AuthorDate: Mon Dec 9 19:09:26 2019 +0100

    [hotfix][tests] Ensure RocksDB native library is loaded into temp directory
    
    This moves the loading code from one specific test method into a the 
initialization phase.
    That way the extraction happens into the target location also in cases 
where other test methods execute first.
---
 .../streaming/state/RocksDBResourceContainerTest.java    | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git 
a/flink-state-backends/flink-statebackend-rocksdb/src/test/java/org/apache/flink/contrib/streaming/state/RocksDBResourceContainerTest.java
 
b/flink-state-backends/flink-statebackend-rocksdb/src/test/java/org/apache/flink/contrib/streaming/state/RocksDBResourceContainerTest.java
index f72dd1a..5ec3c04 100644
--- 
a/flink-state-backends/flink-statebackend-rocksdb/src/test/java/org/apache/flink/contrib/streaming/state/RocksDBResourceContainerTest.java
+++ 
b/flink-state-backends/flink-statebackend-rocksdb/src/test/java/org/apache/flink/contrib/streaming/state/RocksDBResourceContainerTest.java
@@ -21,7 +21,8 @@ package org.apache.flink.contrib.streaming.state;
 import org.apache.flink.runtime.memory.OpaqueMemoryResource;
 import org.apache.flink.util.function.ThrowingRunnable;
 
-import org.junit.Rule;
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
 import org.junit.Test;
 import org.junit.rules.TemporaryFolder;
 import org.rocksdb.ColumnFamilyOptions;
@@ -30,6 +31,7 @@ import org.rocksdb.LRUCache;
 import org.rocksdb.NativeLibraryLoader;
 import org.rocksdb.WriteBufferManager;
 
+import java.io.IOException;
 import java.util.ArrayList;
 
 import static org.hamcrest.CoreMatchers.is;
@@ -40,8 +42,15 @@ import static org.hamcrest.MatcherAssert.assertThat;
  */
 public class RocksDBResourceContainerTest {
 
-       @Rule
-       public final TemporaryFolder tmp = new TemporaryFolder();
+       @ClassRule
+       public static final TemporaryFolder TMP_FOLDER = new TemporaryFolder();
+
+       @BeforeClass
+       public static void ensureRocksDbNativeLibraryLoaded() throws 
IOException {
+               
NativeLibraryLoader.getInstance().loadLibrary(TMP_FOLDER.newFolder().getAbsolutePath());
+       }
+
+       // 
------------------------------------------------------------------------
 
        @Test
        public void testFreeDBOptionsAfterClose() throws Exception {
@@ -108,7 +117,6 @@ public class RocksDBResourceContainerTest {
 
        @Test
        public void testFreeSharedResourcesAfterClose() throws Exception {
-               
NativeLibraryLoader.getInstance().loadLibrary(tmp.newFolder().getAbsolutePath());
                RocksDBResourceContainer container = new 
RocksDBResourceContainer();
                LRUCache cache = new LRUCache(1024L);
                WriteBufferManager wbm = new WriteBufferManager(1024L, cache);

Reply via email to