Skip to content

Commit

Permalink
fix ZooBasedConfigIT for config node changes (#3030)
Browse files Browse the repository at this point in the history
  • Loading branch information
EdColeman authored Oct 18, 2022
1 parent af958fa commit 78142d7
Showing 1 changed file with 7 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,30 +116,22 @@ public static void shutdownZK() throws Exception {
@BeforeEach
public void initPaths() {
context = createMock(ServerContext.class);
testZk.initPaths(ZooUtil.getRoot(INSTANCE_ID) + Constants.ZCONFIG);
testZk.initPaths(ZooUtil.getRoot(INSTANCE_ID));

try {
zooKeeper.create(ZooUtil.getRoot(INSTANCE_ID) + Constants.ZTABLES, new byte[0],
ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);

zooKeeper.create(ZooUtil.getRoot(INSTANCE_ID) + Constants.ZTABLES + "/" + tidA.canonical(),
new byte[0], ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
zooKeeper.create(
ZooUtil.getRoot(INSTANCE_ID) + Constants.ZTABLES + "/" + tidA.canonical() + "/conf",
new byte[0], ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);

zooKeeper.create(ZooUtil.getRoot(INSTANCE_ID) + Constants.ZTABLES + "/" + tidB.canonical(),
new byte[0], ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
zooKeeper.create(
ZooUtil.getRoot(INSTANCE_ID) + Constants.ZTABLES + "/" + tidB.canonical() + "/conf",
new byte[0], ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);

zooKeeper.create(ZooUtil.getRoot(INSTANCE_ID) + Constants.ZNAMESPACES, new byte[0],
ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
zooKeeper.create(
ZooUtil.getRoot(INSTANCE_ID) + Constants.ZNAMESPACES + "/" + nsId.canonical(),
new byte[0], ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
zooKeeper.create(
ZooUtil.getRoot(INSTANCE_ID) + Constants.ZNAMESPACES + "/" + nsId.canonical() + "/conf",
new byte[0], ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);

} catch (KeeperException ex) {
log.trace("Issue during zk initialization, skipping", ex);
Expand Down Expand Up @@ -191,8 +183,11 @@ public void cleanupZnodes() {
* node should be created.
*/
@Test
public void upgradeSysTestNoProps() {
public void upgradeSysTestNoProps() throws Exception {
replay(context);
// force create empty sys config node.
zooKeeper.create(ZooUtil.getRoot(INSTANCE_ID) + Constants.ZCONFIG, new byte[0],
ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
var propKey = SystemPropKey.of(INSTANCE_ID);
ZooBasedConfiguration zbc = new SystemConfiguration(context, propKey, parent);
assertNotNull(zbc);
Expand Down

0 comments on commit 78142d7

Please sign in to comment.