diff options
author | Enrico Olivelli <eolivelli@apache.org> | 2023-02-13 16:26:27 +0100 |
---|---|---|
committer | Enrico Olivelli <eolivelli@apache.org> | 2023-02-13 16:26:57 +0100 |
commit | d495c0efcb652d4b2080d1a86c507f66ee4d5810 (patch) | |
tree | ad21ec2ec73d8f6d51c62dd910904d3fea08f6c7 | |
parent | 90a6344fd68dffc6c3e3bce7ceb227f782af2813 (diff) | |
download | zookeeper-d495c0efcb652d4b2080d1a86c507f66ee4d5810.tar.gz |
[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)
-rw-r--r-- | zookeeper-client/zookeeper-client-c/tests/TestReadOnlyClient.cc | 18 |
1 files changed, 18 insertions, 0 deletions
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() { |