flink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ches...@apache.org
Subject [1/4] flink git commit: [FLINK-8200][tests] Use TemporaryFolder in RocksDBAsyncSnapshotTest
Date Mon, 08 Jan 2018 21:39:54 GMT
Repository: flink
Updated Branches:
  refs/heads/release-1.4 74135c9db -> 6f50ed256


[FLINK-8200][tests] Use TemporaryFolder in RocksDBAsyncSnapshotTest

This closes #5122.


Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/78e3405b
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/78e3405b
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/78e3405b

Branch: refs/heads/release-1.4
Commit: 78e3405becb13ec74d6edd4624727f7fd40fea07
Parents: 74135c9
Author: wenlong.lwl <wenlong.lwl@alibaba-inc.com>
Authored: Tue Dec 5 15:16:32 2017 +0800
Committer: zentol <chesnay@apache.org>
Committed: Mon Jan 8 20:26:02 2018 +0100

----------------------------------------------------------------------
 .../streaming/state/RocksDBAsyncSnapshotTest.java   | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/78e3405b/flink-contrib/flink-statebackend-rocksdb/src/test/java/org/apache/flink/contrib/streaming/state/RocksDBAsyncSnapshotTest.java
----------------------------------------------------------------------
diff --git a/flink-contrib/flink-statebackend-rocksdb/src/test/java/org/apache/flink/contrib/streaming/state/RocksDBAsyncSnapshotTest.java
b/flink-contrib/flink-statebackend-rocksdb/src/test/java/org/apache/flink/contrib/streaming/state/RocksDBAsyncSnapshotTest.java
index 2ba0494..71c5e77 100644
--- a/flink-contrib/flink-statebackend-rocksdb/src/test/java/org/apache/flink/contrib/streaming/state/RocksDBAsyncSnapshotTest.java
+++ b/flink-contrib/flink-statebackend-rocksdb/src/test/java/org/apache/flink/contrib/streaming/state/RocksDBAsyncSnapshotTest.java
@@ -25,7 +25,6 @@ import org.apache.flink.api.common.typeinfo.BasicTypeInfo;
 import org.apache.flink.api.common.typeutils.base.StringSerializer;
 import org.apache.flink.api.common.typeutils.base.VoidSerializer;
 import org.apache.flink.api.java.functions.KeySelector;
-import org.apache.flink.configuration.ConfigConstants;
 import org.apache.flink.core.testutils.OneShotLatch;
 import org.apache.flink.runtime.checkpoint.CheckpointMetaData;
 import org.apache.flink.runtime.checkpoint.CheckpointMetrics;
@@ -60,7 +59,9 @@ import org.apache.flink.util.IOUtils;
 import org.apache.flink.util.TestLogger;
 
 import org.junit.Assert;
+import org.junit.Rule;
 import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
 import org.junit.runner.RunWith;
 import org.powermock.core.classloader.annotations.PowerMockIgnore;
 import org.powermock.modules.junit4.PowerMockRunner;
@@ -70,7 +71,6 @@ import java.io.IOException;
 import java.lang.reflect.Field;
 import java.util.Arrays;
 import java.util.Map;
-import java.util.UUID;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.RunnableFuture;
@@ -96,6 +96,12 @@ import static org.mockito.Mockito.verify;
 public class RocksDBAsyncSnapshotTest extends TestLogger {
 
 	/**
+	 * Temporary fold for test.
+	 */
+	@Rule
+	public TemporaryFolder temporaryFolder = new TemporaryFolder();
+
+	/**
 	 * This ensures that asynchronous state handles are actually materialized asynchronously.
 	 *
 	 * <p>We use latches to block at various stages and see if the code still continues
through
@@ -119,7 +125,7 @@ public class RocksDBAsyncSnapshotTest extends TestLogger {
 
 		StreamConfig streamConfig = testHarness.getStreamConfig();
 
-		File dbDir = new File(new File(ConfigConstants.DEFAULT_TASK_MANAGER_TMP_PATH, UUID.randomUUID().toString()),
"state");
+		File dbDir = temporaryFolder.newFolder();
 
 		RocksDBStateBackend backend = new RocksDBStateBackend(new MemoryStateBackend());
 		backend.setDbStoragePath(dbDir.getAbsolutePath());
@@ -225,7 +231,7 @@ public class RocksDBAsyncSnapshotTest extends TestLogger {
 
 		StreamConfig streamConfig = testHarness.getStreamConfig();
 
-		File dbDir = new File(new File(ConfigConstants.DEFAULT_TASK_MANAGER_TMP_PATH, UUID.randomUUID().toString()),
"state");
+		File dbDir = temporaryFolder.newFolder();
 
 		BlockingStreamMemoryStateBackend memoryStateBackend = new BlockingStreamMemoryStateBackend();
 
@@ -333,7 +339,7 @@ public class RocksDBAsyncSnapshotTest extends TestLogger {
 
 		RocksDBStateBackend backend = new RocksDBStateBackend(stateBackend);
 
-		backend.setDbStoragePath("file:///tmp/foobar");
+		backend.setDbStoragePath(temporaryFolder.newFolder().toURI().toString());
 
 		AbstractKeyedStateBackend<Void> keyedStateBackend = backend.createKeyedStateBackend(
 			env,


Mime
View raw message