aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jsir...@apache.org
Subject aurora git commit: Add a test for invalid member nodes.
Date Tue, 12 Apr 2016 17:20:09 GMT
Repository: aurora
Updated Branches:
  refs/heads/master efe57de88 -> 71c9e674c


Add a test for invalid member nodes.

Bugs closed: AURORA-1468

Reviewed at https://reviews.apache.org/r/46069/


Project: http://git-wip-us.apache.org/repos/asf/aurora/repo
Commit: http://git-wip-us.apache.org/repos/asf/aurora/commit/71c9e674
Tree: http://git-wip-us.apache.org/repos/asf/aurora/tree/71c9e674
Diff: http://git-wip-us.apache.org/repos/asf/aurora/diff/71c9e674

Branch: refs/heads/master
Commit: 71c9e674c36d8ecf4aa51673e62d597085b196b2
Parents: efe57de
Author: John Sirois <jsirois@apache.org>
Authored: Tue Apr 12 11:20:06 2016 -0600
Committer: John Sirois <john.sirois@gmail.com>
Committed: Tue Apr 12 11:20:06 2016 -0600

----------------------------------------------------------------------
 .../CuratorServiceGroupMonitorTest.java         | 24 +++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/aurora/blob/71c9e674/src/test/java/org/apache/aurora/scheduler/discovery/CuratorServiceGroupMonitorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/discovery/CuratorServiceGroupMonitorTest.java
b/src/test/java/org/apache/aurora/scheduler/discovery/CuratorServiceGroupMonitorTest.java
index 0879c2e..5598389 100644
--- a/src/test/java/org/apache/aurora/scheduler/discovery/CuratorServiceGroupMonitorTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/discovery/CuratorServiceGroupMonitorTest.java
@@ -22,6 +22,7 @@ import java.util.function.Predicate;
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.ImmutableSet;
 
+import org.apache.aurora.codec.ThriftBinaryCodec;
 import org.apache.aurora.common.thrift.Endpoint;
 import org.apache.aurora.common.thrift.ServiceInstance;
 import org.apache.aurora.common.thrift.Status;
@@ -146,6 +147,19 @@ public class CuratorServiceGroupMonitorTest extends BaseZooKeeperTest
{
   }
 
   @Test
+  public void testInvalidMemberNode() throws Exception {
+    startGroupMonitor();
+
+    createMember(ThriftBinaryCodec.encode(serviceInstance("invalid")));
+
+    ServiceInstance member = serviceInstance("member");
+    createMember(member);
+
+    // Invalid member should be ignored.
+    assertEquals(ImmutableSet.of(member), groupMonitor.get());
+  }
+
+  @Test
   public void testStartBlocksOnInitialMembership() throws Exception {
     ServiceInstance one = serviceInstance("one");
     createMember(one, false /* waitForGroupEvent */);
@@ -172,10 +186,18 @@ public class CuratorServiceGroupMonitorTest extends BaseZooKeeperTest
{
   private String createMember(ServiceInstance serviceInstance, boolean waitForGroupEvent)
       throws Exception {
 
+    return createMember(serialize(serviceInstance), waitForGroupEvent);
+  }
+
+  private String createMember(byte[] nodeData) throws Exception {
+    return createMember(nodeData, true /* waitForGroupEvent */);
+  }
+
+  private String createMember(byte[] nodeData, boolean waitForGroupEvent) throws Exception
{
     String path = client.create()
         .creatingParentsIfNeeded()
         .withMode(CreateMode.EPHEMERAL_SEQUENTIAL)
-        .forPath(ZKPaths.makePath(GROUP_PATH, MEMBER_TOKEN), serialize(serviceInstance));
+        .forPath(ZKPaths.makePath(GROUP_PATH, MEMBER_TOKEN), nodeData);
     if (waitForGroupEvent) {
       expectGroupEvent(PathChildrenCacheEvent.Type.CHILD_ADDED);
     }


Mime
View raw message