An effort to fix transient error in BrokerServerViewTest

This commit is contained in:
Bingkun Guo 2015-12-09 10:45:49 -06:00
parent 788acdbd1c
commit 161c4ce288
1 changed files with 11 additions and 2 deletions

View File

@ -371,15 +371,24 @@ public class BrokerServerViewTest extends CuratorTestBase
private void setupZNodeForServer(DruidServer server) throws Exception
{
final String zNodePathAnnounce = ZKPaths.makePath(announcementsPath, server.getHost());
final String zNodePathSegment = ZKPaths.makePath(inventoryPath, server.getHost());
if (curator.checkExists().forPath(zNodePathAnnounce) != null) {
curator.delete().guaranteed().forPath(zNodePathAnnounce);
}
if (curator.checkExists().forPath(zNodePathSegment) != null) {
curator.delete().guaranteed().forPath(zNodePathSegment);
}
curator.create()
.creatingParentsIfNeeded()
.forPath(
ZKPaths.makePath(announcementsPath, server.getHost()),
zNodePathAnnounce,
jsonMapper.writeValueAsBytes(server.getMetadata())
);
curator.create()
.creatingParentsIfNeeded()
.forPath(ZKPaths.makePath(inventoryPath, server.getHost()));
.forPath(zNodePathSegment);
}
private DataSegment dataSegmentWithIntervalAndVersion(String intervalStr, String version)