You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by si...@apache.org on 2018/03/29 05:12:15 UTC
[bookkeeper] branch master updated: [DLOG] Fix
TestZKLogStreamMetadataStore
This is an automated email from the ASF dual-hosted git repository.
sijie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git
The following commit(s) were added to refs/heads/master by this push:
new c36cf2b [DLOG] Fix TestZKLogStreamMetadataStore
c36cf2b is described below
commit c36cf2b8263ccea9e1c21ac36ff0d9aebd3a88a3
Author: Sijie Guo <si...@apache.org>
AuthorDate: Wed Mar 28 22:12:08 2018 -0700
[DLOG] Fix TestZKLogStreamMetadataStore
Descriptions of the changes in this PR:
*Problem*
All test cases in `TestZKLogStreamMetadataStore` share same zookeeper cluster. so if the tests
run before `testGetMissingPathsRecursive` runs, they might create the missing path components
for `testGetMissingPathsRecursive`, which will fail the assertion in `testGetMissingPathsRecursive`
*Solution*
Add unique suffix to "/path" for each test case to avoid conflicts
Author: Sijie Guo <si...@apache.org>
Reviewers: Yiming Zang <yz...@gmail.com>, Jia Zhai <zh...@apache.org>, Philip Su <ps...@twitter.com>
This closes #1300 from sijie/fix_zk_log_stream_metadata_store
---
.../impl/metadata/TestZKLogStreamMetadataStore.java | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/stream/distributedlog/core/src/test/java/org/apache/distributedlog/impl/metadata/TestZKLogStreamMetadataStore.java b/stream/distributedlog/core/src/test/java/org/apache/distributedlog/impl/metadata/TestZKLogStreamMetadataStore.java
index 0182930..1a5d18b 100644
--- a/stream/distributedlog/core/src/test/java/org/apache/distributedlog/impl/metadata/TestZKLogStreamMetadataStore.java
+++ b/stream/distributedlog/core/src/test/java/org/apache/distributedlog/impl/metadata/TestZKLogStreamMetadataStore.java
@@ -485,25 +485,25 @@ public class TestZKLogStreamMetadataStore extends ZooKeeperClusterTestCase {
@Test(timeout = 60000)
public void testGetMissingPathsRecursive() throws Exception {
List<String> missingPaths = FutureUtils.result(
- getMissingPaths(zkc, uri, "path/to/log"));
+ getMissingPaths(zkc, uri, "path_missing/to/log"));
assertEquals(
Lists.newArrayList(
- uri.getPath() + "/path/to/log",
- uri.getPath() + "/path/to",
- uri.getPath() + "/path"
+ uri.getPath() + "/path_missing/to/log",
+ uri.getPath() + "/path_missing/to",
+ uri.getPath() + "/path_missing"
),
missingPaths);
}
@Test(timeout = 60000)
public void testGetMissingPathsRecursive2() throws Exception {
- String path = uri.getPath() + "/path/to/log";
+ String path = uri.getPath() + "/path_missing2/to/log";
ZkUtils.createFullPathOptimistic(
zkc.get(), path, EMPTY_BYTES, zkc.getDefaultACL(), CreateMode.PERSISTENT);
List<String> missingPaths = FutureUtils.result(
- getMissingPaths(zkc, uri, "path/to/log"));
+ getMissingPaths(zkc, uri, "path_missing2/to/log"));
assertEquals(
Collections.emptyList(),
@@ -523,7 +523,7 @@ public class TestZKLogStreamMetadataStore extends ZooKeeperClusterTestCase {
}).when(mockZk).exists(anyString(), anyBoolean(), any(StatCallback.class), any());
try {
- FutureUtils.result(getMissingPaths(mockZkc, uri, "path/to/log"));
+ FutureUtils.result(getMissingPaths(mockZkc, uri, "path_failure/to/log_failure"));
fail("Should fail on getting missing paths on zookeeper exceptions.");
} catch (ZKException zke) {
assertEquals(Code.BADVERSION, zke.getKeeperExceptionCode());
@@ -543,7 +543,7 @@ public class TestZKLogStreamMetadataStore extends ZooKeeperClusterTestCase {
logIdentifier,
numSegments);
- String newLogName = "path/to/new/" + logName;
+ String newLogName = "path_rename/to/new/" + logName;
FutureUtils.result(metadataStore.renameLog(uri, logName, newLogName));
}
@@ -559,7 +559,7 @@ public class TestZKLogStreamMetadataStore extends ZooKeeperClusterTestCase {
logIdentifier,
numSegments);
- String newLogName = "path/to/new/" + logName;
+ String newLogName = "path_rename_exists/to/new/" + logName;
createLog(
zkc,
uri,
@@ -587,7 +587,7 @@ public class TestZKLogStreamMetadataStore extends ZooKeeperClusterTestCase {
String lockPath = logRootPath + LOCK_PATH;
zkc.get().create(lockPath + "/test", new byte[0], Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL_SEQUENTIAL);
- String newLogName = "path/to/new/" + logName;
+ String newLogName = "path_rename_locked/to/new/" + logName;
FutureUtils.result(metadataStore.renameLog(uri, logName, newLogName));
}
--
To stop receiving notification emails like this one, please contact
sijie@apache.org.