zookeeper-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [zookeeper] hanm commented on a change in pull request #971: ZOOKEEPER-3418: Improve quorum throughput through eager ACL checks of requests on local servers.
Date Tue, 02 Jul 2019 19:58:36 GMT
hanm commented on a change in pull request #971: ZOOKEEPER-3418: Improve quorum throughput
through eager ACL checks of requests on local servers.
URL: https://github.com/apache/zookeeper/pull/971#discussion_r299659600
 
 

 ##########
 File path: zookeeper-server/src/test/java/org/apache/zookeeper/server/quorum/EagerACLFilterTest.java
 ##########
 @@ -0,0 +1,297 @@
+/**
+ * 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.quorum;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.zookeeper.AsyncCallback.VoidCallback;
+import org.apache.zookeeper.CreateMode;
+import org.apache.zookeeper.KeeperException;
+import org.apache.zookeeper.TestableZooKeeper;
+import org.apache.zookeeper.ZooDefs.Ids;
+import org.apache.zookeeper.server.ZooKeeperServer;
+import org.apache.zookeeper.server.quorum.QuorumPeer.ServerState;
+import org.apache.zookeeper.test.QuorumBase;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+@RunWith(Parameterized.class)
+public class EagerACLFilterTest extends QuorumBase {
+    protected boolean checkEnabled;
+    protected ServerState serverState;
+    protected final CountDownLatch callComplete = new CountDownLatch(1);
+    protected boolean complete = false;
+    protected final static String PARENT_PATH = "/foo";
+    protected final static String CHILD_PATH = "/foo/bar";
+    protected final static String AUTH_PROVIDER = "digest";
+    protected final static byte[] AUTH = "hello".getBytes();
+    protected final static byte[] AUTHB = "goodbye".getBytes();
+    protected final static byte[] DATA = "Hint Water".getBytes();
+    protected TestableZooKeeper zkClient;
+    protected TestableZooKeeper zkClientB;
+    protected QuorumPeer zkLeader;
+    protected ZooKeeperServer connectedServer;
+
+    @Parameterized.Parameters
+    public static Collection<Object[]> data() {
+        return Arrays.asList(
+                new Object[][] {
+                        {ServerState.LEADING, true},
+                        {ServerState.LEADING, false},
+                        {ServerState.FOLLOWING, true},
+                        {ServerState.FOLLOWING, false},
+                        {ServerState.OBSERVING, true},
+                        {ServerState.OBSERVING, false}});
+    }
+
+    public EagerACLFilterTest(ServerState state, boolean checkEnabled) {
+        this.serverState = state;
+        this.checkEnabled = checkEnabled;
+    }
+
+    @Before
+    public void setUp() throws Exception {
+        ensureCheck(checkEnabled);
+        CountdownWatcher clientWatch = new CountdownWatcher();
+        CountdownWatcher clientWatchB = new CountdownWatcher();
+        super.setUp(true);
+
+        String hostPort = getPeersMatching(serverState).split(",")[0];
+        int clientPort = Integer.parseInt(hostPort.split(":")[1]);
+
+        zkLeader = getPeerList().get(getLeaderIndex());
+        connectedServer = getPeerByClientPort(clientPort).getActiveServer();
+
+        zkClient = createClient(clientWatch, hostPort);
+        zkClientB = createClient(clientWatchB, hostPort);
+        zkClient.addAuthInfo(AUTH_PROVIDER, AUTH);
+        zkClientB.addAuthInfo(AUTH_PROVIDER, AUTHB);
+        clientWatch.waitForConnected(CONNECTION_TIMEOUT);
+        clientWatchB.waitForConnected(CONNECTION_TIMEOUT);
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        zkClient.close();
 
 Review comment:
   done.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message