Author: phunt
Date: Tue Nov 18 17:28:16 2008
New Revision: 718832

URL: http://svn.apache.org/viewvc?rev=718832&view=rev
Log:
ZOOKEEPER-211 Not all Mock tests are working

Modified:
    hadoop/zookeeper/trunk/CHANGES.txt
    hadoop/zookeeper/trunk/src/c/tests/TestOperations.cc
    hadoop/zookeeper/trunk/src/c/tests/TestWatchers.cc
    hadoop/zookeeper/trunk/src/c/tests/TestZookeeperClose.cc
    hadoop/zookeeper/trunk/src/c/tests/ZKMocks.cc

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=718832&r1=718831&r2=718832&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Tue Nov 18 17:28:16 2008
@@ -5,16 +5,18 @@
 Backward compatibile changes:
 
 BUGFIXES: 
-   ZOOKEEPER-223. change default level in root logger to INFO. (pat via
-mahadev) 
+   ZOOKEEPER-211 Not all Mock tests are working (ben via phunt)
+
+   ZOOKEEPER-223. change default level in root logger to INFO.
+   (pat via mahadev) 
    
    ZOOKEEPER-212. fix the snapshot to be asynchronous. (mahadev and ben)
 
    ZOOKEEPER-213. fix programmer guide C api docs to be  in sync with latest
-zookeeper.h (pat via mahadev)
+   zookeeper.h (pat via mahadev)
 
-   ZOOKEEPER-219. fix events.poll timeout in watcher test to be longer. (pat
-via mahadev)
+   ZOOKEEPER-219. fix events.poll timeout in watcher test to be longer.
+   (pat via mahadev)
    
    ZOOKEEPER-217. Fix errors in config to be thrown as Exceptions. (mahadev)
 

Modified: hadoop/zookeeper/trunk/src/c/tests/TestOperations.cc
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/c/tests/TestOperations.cc?rev=718832&r1=718831&r2=718832&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/c/tests/TestOperations.cc (original)
+++ hadoop/zookeeper/trunk/src/c/tests/TestOperations.cc Tue Nov 18 17:28:16 
2008
@@ -32,10 +32,10 @@
     CPPUNIT_TEST(testTimeoutCausedByWatches1);
     CPPUNIT_TEST(testTimeoutCausedByWatches2);
 #else    
-    //CPPUNIT_TEST(testAsyncWatcher1);
+    CPPUNIT_TEST(testAsyncWatcher1);
     CPPUNIT_TEST(testAsyncGetOperation);
 #endif
-    //CPPUNIT_TEST(testOperationsAndDisconnectConcurrently1);
+    CPPUNIT_TEST(testOperationsAndDisconnectConcurrently1);
     CPPUNIT_TEST(testOperationsAndDisconnectConcurrently2);
     CPPUNIT_TEST(testConcurrentOperations1);
     CPPUNIT_TEST_SUITE_END();
@@ -380,6 +380,12 @@
             for(i=0;i<reps_;i++){
                 char buf;
                 int size=sizeof(buf);
+
+                if (i % 10 == 0) {
+                    // We need to pause every once in a while so we don't
+                    // get too far ahead and finish before the disconnect
+                   millisleep(1);
+                }
                 svr_->addOperationResponse(new ZooGetResponse("1",1));
                 rc_=zoo_get(zh_,"/x/y/z",0,&buf,&size,0);
                 if(rc_!=ZOK){
@@ -535,7 +541,8 @@
             
             TestJobManager 
jmgr(TestConcurrentOpWithDisconnectJob(&zkServer,zh),10);
             jmgr.startJobsImmediately();
-            millisleep(1);
+            // let everything startup before we shutdown the server
+            millisleep(4);
             // reconnect attempts will start failing immediately 
             zkServer.setServerDown(0);
             // next recv call will return 0

Modified: hadoop/zookeeper/trunk/src/c/tests/TestWatchers.cc
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/c/tests/TestWatchers.cc?rev=718832&r1=718831&r2=718832&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/c/tests/TestWatchers.cc (original)
+++ hadoop/zookeeper/trunk/src/c/tests/TestWatchers.cc Tue Nov 18 17:28:16 2008
@@ -27,11 +27,11 @@
     CPPUNIT_TEST_SUITE(Zookeeper_watchers);
     CPPUNIT_TEST(testDefaultSessionWatcher1);
     CPPUNIT_TEST(testDefaultSessionWatcher2);
-    //CPPUNIT_TEST(testObjectSessionWatcher1);
+    CPPUNIT_TEST(testObjectSessionWatcher1);
     CPPUNIT_TEST(testObjectSessionWatcher2);
     CPPUNIT_TEST(testNodeWatcher1);
     CPPUNIT_TEST(testChildWatcher1);
-    //CPPUNIT_TEST(testChildWatcher2);
+    CPPUNIT_TEST(testChildWatcher2);
     CPPUNIT_TEST_SUITE_END();
 
     static void watcher(zhandle_t *, int, int, const char *,void*){}

Modified: hadoop/zookeeper/trunk/src/c/tests/TestZookeeperClose.cc
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/c/tests/TestZookeeperClose.cc?rev=718832&r1=718831&r2=718832&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/c/tests/TestZookeeperClose.cc (original)
+++ hadoop/zookeeper/trunk/src/c/tests/TestZookeeperClose.cc Tue Nov 18 
17:28:16 2008
@@ -34,7 +34,7 @@
 #endif
     CPPUNIT_TEST(testCloseUnconnected);
     CPPUNIT_TEST(testCloseUnconnected1);
-    //CPPUNIT_TEST(testCloseConnected1);
+    CPPUNIT_TEST(testCloseConnected1);
     CPPUNIT_TEST(testCloseFromWatcher1);
     CPPUNIT_TEST_SUITE_END();
     zhandle_t *zh;

Modified: hadoop/zookeeper/trunk/src/c/tests/ZKMocks.cc
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/c/tests/ZKMocks.cc?rev=718832&r1=718831&r2=718832&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/c/tests/ZKMocks.cc (original)
+++ hadoop/zookeeper/trunk/src/c/tests/ZKMocks.cc Tue Nov 18 17:28:16 2008
@@ -468,9 +468,6 @@
             int64_t sessId=sessionExpired?req->sessionId+1:req->sessionId;
             sessionExpired=false;
             addRecvResponse(new HandshakeResponse(sessId));            
-            Element e = Element(new ZooStatResponse,0);
-            e.first->setXID(-8);
-            addRecvResponse(e);
             return;
         }
         // not a connect request -- fall thru
@@ -480,7 +477,15 @@
     RequestHeader rh;
     deserialize_RequestHeader(ia,"hdr",&rh);
     // notify the "server" a client request has arrived
-    onMessageReceived(rh,ia);
+    if (rh.xid == -8) {
+        Element e = Element(new ZooStatResponse,0);
+        e.first->setXID(-8);
+        addRecvResponse(e);
+        close_buffer_iarchive(&ia);
+        return;
+    } else {
+        onMessageReceived(rh,ia);
+    }
     close_buffer_iarchive(&ia);
     if(rh.type==CLOSE_OP){
         ++closeSent;


Reply via email to