-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #65 from tgockel/issue/58/watch-on-close
client: Change connection_zk to deliver watch callbacks on close.
- Loading branch information
Showing
5 changed files
with
304 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#include <zk/server/server_tests.hpp> | ||
|
||
#include "client.hpp" | ||
|
||
namespace zk | ||
{ | ||
|
||
class client_tests : | ||
public server::single_server_fixture | ||
{ }; | ||
|
||
GTEST_TEST_F(client_tests, watch_close) | ||
{ | ||
client c = get_connected_client(); | ||
auto watch = c.watch("/").get(); | ||
|
||
c.close(); | ||
|
||
// watch should be triggered with session closed | ||
auto ev = watch.next().get(); | ||
CHECK_EQ(ev.type(), event_type::session); | ||
CHECK_EQ(ev.state(), state::closed); | ||
} | ||
|
||
class stopping_client_tests : | ||
public server::server_fixture | ||
{ }; | ||
|
||
GTEST_TEST_F(stopping_client_tests, watch_server_stop) | ||
{ | ||
client c = get_connected_client(); | ||
auto watch = c.watch("/").get(); | ||
|
||
this->stop_server(true); | ||
|
||
auto ev = watch.next().get(); | ||
CHECK_EQ(ev.type(), event_type::session); | ||
} | ||
|
||
} |
Oops, something went wrong.