Skip to content

Commit

Permalink
Added timeout to ZookeeperCacheTest tests (apache#1339)
Browse files Browse the repository at this point in the history
  • Loading branch information
merlimat authored Mar 5, 2018
1 parent b701925 commit 81935b5
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ void classTeardown() throws Exception {
}


@Test
@Test(timeOut = 10000)
void testSimpleCache() throws Exception {

ZooKeeperCache zkCacheService = new LocalZooKeeperCache(zkClient, executor, scheduledExecutor);
Expand Down Expand Up @@ -123,7 +123,7 @@ public String deserialize(String key, byte[] content) throws Exception {
}
}

@Test
@Test(timeOut = 10000)
void testChildrenCache() throws Exception {
zkClient.create("/test", new byte[0], null, null);

Expand Down Expand Up @@ -175,7 +175,7 @@ void testChildrenCache() throws Exception {
assertEquals(notificationCount.get(), 3);
}

@Test
@Test(timeOut = 10000)
void testExistsCache() throws Exception {
// Check existence after creation of the node
zkClient.create("/test", new byte[0], null, null);
Expand All @@ -191,7 +191,7 @@ void testExistsCache() throws Exception {
Assert.assertFalse(shouldNotExist, "/test should not exist in the cache");
}

@Test
@Test(timeOut = 10000)
void testInvalidateCache() throws Exception {
zkClient.create("/test", new byte[0], null, null);
zkClient.create("/test/c1", new byte[0], null, null);
Expand Down Expand Up @@ -224,7 +224,7 @@ void testInvalidateCache() throws Exception {
assertNull(zkCacheService.getChildrenIfPresent("/test"));
}

@Test
@Test(timeOut = 10000)
void testGlobalZooKeeperCache() throws Exception {
MockZooKeeper zkc = MockZooKeeper.newInstance();
ZooKeeperClientFactory zkClientfactory = new ZooKeeperClientFactory() {
Expand Down Expand Up @@ -381,7 +381,7 @@ public String deserialize(String key, byte[] content) throws Exception {
*
* @throws Exception
*/
@Test
@Test(timeOut = 10000)
public void testInvalidateCacheOnFailure() throws Exception {
ExecutorService zkExecutor = Executors.newSingleThreadExecutor(new DefaultThreadFactory("mockZk"));
// add readOpDelayMs so, main thread will not serve zkCacahe-returned future and let zkExecutor-thread handle
Expand Down

0 comments on commit 81935b5

Please sign in to comment.