Browse Source

ZOOKEEPER-3222: Flaky: multiple intermittent segfaults in C++ tests

1. Removed the failing test case: client cannot be validated after closing.
2. Explicitly close the client before creating new.

Author: Andor Molnar <andor@cloudera.com>

Reviewers: fangmin@apache.org, andor@apache.org

Closes #740 from anmolnar/ZOOKEEPER-3222
Andor Molnar 6 years ago
parent
commit
f644f3d63e
1 changed files with 4 additions and 11 deletions
  1. 4 11
      zookeeper-client/zookeeper-client-c/tests/TestClient.cc

+ 4 - 11
zookeeper-client/zookeeper-client-c/tests/TestClient.cc

@@ -669,15 +669,6 @@ public:
         CPPUNIT_ASSERT(count == 1);
         count  = 0;
         CPPUNIT_ASSERT_EQUAL((int) ZOK, zookeeper_close(zk_auth));
-        
-        // [ZOOKEEPER-800] zoo_add_auth should return ZINVALIDSTATE if
-        // the connection is closed. 
-        zhandle_t *zk2 = zookeeper_init(hostPorts, NULL, 10000, 0, NULL, 0);
-        sleep(1);
-        CPPUNIT_ASSERT_EQUAL((int) ZOK, zookeeper_close(zk2));
-        CPPUNIT_ASSERT_EQUAL(0, zoo_state(zk2)); // 0 ==> ZOO_CLOSED_STATE
-        rc = zoo_add_auth(zk2, "digest", "pat:passwd", 10, voidCompletion, (void*)ZOK);
-        CPPUNIT_ASSERT_EQUAL((int) ZINVALIDSTATE, rc);
 
         struct sockaddr addr;
         socklen_t addr_len = sizeof(addr);
@@ -1351,9 +1342,9 @@ public:
       int blen = sizeof(buf);		
       int rc;
       watchctx_t ctx;
-			zhandle_t *zk;
+      zhandle_t *zk;
 
-			/* setup path */
+      /* setup path */
       zk = createClient(&ctx);
       CPPUNIT_ASSERT(zk);
 
@@ -1409,6 +1400,8 @@ public:
                                watcher_rw, NULL, 0);
       CPPUNIT_ASSERT_EQUAL((int)ZCONNECTIONLOSS, rc);
 
+      zookeeper_close(zk);
+
       /* bring the server back */
       startServer();
       zk = createClient(&ctx);