jiexray commented on code in PR #21410:
URL: https://github.com/apache/flink/pull/21410#discussion_r1094683643
##########
flink-state-backends/flink-statebackend-rocksdb/src/test/java/org/apache/flink/contrib/streaming/state/EmbeddedRocksDBStateBackendTest.java:
##########
@@ -148,13 +145,16 @@ public static List<Object[]> modes() {
private final RocksDBResourceContainer optionsContainer = new
RocksDBResourceContainer();
public void prepareRocksDB() throws Exception {
- String dbPath = new File(TEMP_FOLDER.newFolder(),
DB_INSTANCE_DIR_STRING).getAbsolutePath();
+ File dbPath = new File(tmpDbPath, DB_INSTANCE_DIR_STRING);
+ if (!dbPath.exists()) {
+ dbPath.mkdirs();
Review Comment:
Thank you for pointing it out. In fact, this "manually creating path" is not
required. The root problem is caused by the wrong "static" definition for field
`tmpDbPath`.
Some background: "Static" in JUnit5 `@TempDir` has special meaning. Static
field means that the temporary directory is shared among **ALL** test methods.
In contrast, non-static field means each test would use its own temporary
directory.
In this utcase, each test should have an exclusive temporary directory for
db. Thus, I change `tmpDbPath` to non-static field, and remove the "manually
creating path". Every test is passed.
By the way, the checkpoint path (`tmpCheckpointPath`) is shared by all tests.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]