You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zookeeper.apache.org by eo...@apache.org on 2023/02/13 15:27:04 UTC

[zookeeper] branch branch-3.7 updated: [ZOOKEEPER-4674] TestReadOnlyClient.cc: Stop/start "normal" server in test setUp/tearDown (#1983)

This is an automated email from the ASF dual-hosted git repository.

eolivelli pushed a commit to branch branch-3.7
in repository https://gitbox.apache.org/repos/asf/zookeeper.git


The following commit(s) were added to refs/heads/branch-3.7 by this push:
     new d495c0efc [ZOOKEEPER-4674] TestReadOnlyClient.cc: Stop/start "normal" server in test setUp/tearDown (#1983)
d495c0efc is described below

commit d495c0efcb652d4b2080d1a86c507f66ee4d5810
Author: Enrico Olivelli <eo...@apache.org>
AuthorDate: Mon Feb 13 16:26:27 2023 +0100

    [ZOOKEEPER-4674] TestReadOnlyClient.cc: Stop/start "normal" server in test setUp/tearDown (#1983)
    
    Co-authored-by: Damien Diederen <dd...@crosstwine.com>
    (cherry picked from commit 2d1bac7e077f49a7149d3fb878a2c73b9e627f6e)
---
 .../zookeeper-client-c/tests/TestReadOnlyClient.cc     | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/zookeeper-client/zookeeper-client-c/tests/TestReadOnlyClient.cc b/zookeeper-client/zookeeper-client-c/tests/TestReadOnlyClient.cc
index 0d4d579f4..e864ef266 100644
--- a/zookeeper-client/zookeeper-client-c/tests/TestReadOnlyClient.cc
+++ b/zookeeper-client/zookeeper-client-c/tests/TestReadOnlyClient.cc
@@ -71,6 +71,24 @@ public:
     void setUp() {
         zoo_set_log_stream(logfile);
         zoo_set_debug_level(ZOO_LOG_LEVEL_DEBUG);
+        stopServer();
+    }
+
+    void tearDown()
+    {
+        startServer();
+    }
+
+    void startServer() {
+        char cmd[1024];
+        sprintf(cmd, "%s start %s", ZKSERVER_CMD, "127.0.0.1:22181");
+        CPPUNIT_ASSERT(system(cmd) == 0);
+    }
+
+    void stopServer() {
+        char cmd[1024];
+        sprintf(cmd, "%s stop %s", ZKSERVER_CMD, "127.0.0.1:22181");
+        CPPUNIT_ASSERT(system(cmd) == 0);
     }
 
     void startReadOnly() {