zookeeper-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hanm <...@git.apache.org>
Subject [GitHub] zookeeper pull request #195: ZOOKEEPER-2725: Promote local session to global...
Date Sun, 19 Mar 2017 03:41:47 GMT
Github user hanm commented on a diff in the pull request:

    https://github.com/apache/zookeeper/pull/195#discussion_r106797340
  
    --- Diff: src/java/test/org/apache/zookeeper/server/MultiOpSessionUpgradeTest.java ---
    @@ -0,0 +1,87 @@
    +/**
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.zookeeper.server;
    +
    +import org.apache.zookeeper.CreateMode;
    +import org.apache.zookeeper.KeeperException;
    +import org.apache.zookeeper.Op;
    +import org.apache.zookeeper.OpResult;
    +import org.apache.zookeeper.ZooDefs;
    +import org.apache.zookeeper.ZooKeeper;
    +import org.apache.zookeeper.test.ClientBase;
    +import org.apache.zookeeper.test.QuorumBase;
    +import org.junit.Assert;
    +import org.junit.Test;
    +import org.slf4j.Logger;
    +import org.slf4j.LoggerFactory;
    +
    +import java.io.IOException;
    +import java.util.Arrays;
    +import java.util.List;
    +
    +public class MultiOpSessionUpgradeTest extends QuorumBase {
    +    protected static final Logger LOG = LoggerFactory.getLogger(MultiOpSessionUpgradeTest.class);
    +
    +    @Override
    +    public void setUp() throws Exception {
    +        localSessionsEnabled = true;
    +        localSessionsUpgradingEnabled = true;
    +        super.setUp();
    +    }
    +
    +    @Test
    +    public void ephemeralCreateMultiOpTest() throws KeeperException, InterruptedException,
IOException {
    +        final ZooKeeper zk = createClient();
    +        waitForClient(zk, ZooKeeper.States.CONNECTED);
    --- End diff --
    
    Right, there is no need for this check (which use polling which is not recommended.).
createClient already ensures that zk is in connected state via watchers. The only benefit
of additional check here might be that in case of flaky test environment, a zk might loss
connection to server right after createClient, but in that case we might want to wrap the
subsequent test code (i.e. create) using retry with timeout logic.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message