Skip to content

Commit

Permalink
Add a sleep hack to get the watch_recursive test passing.
Browse files Browse the repository at this point in the history
Refs #23.
  • Loading branch information
jimmycuadra committed Dec 15, 2018
1 parent 0169eb6 commit 7cfc98c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tests/kv_test.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::thread::spawn;
use std::thread::{sleep, spawn};
use std::time::Duration;

use etcd::kv::{self, Action, GetOptions, KeyValueInfo, WatchError, WatchOptions};
Expand Down Expand Up @@ -692,7 +692,11 @@ fn watch_recursive() {
let mut client = TestClient::no_destructor(core);
let inner_client = client.clone();

let work = rx.then(|_| kv::set(&inner_client, "/test/foo/bar", "baz", None));
let work = rx.then(|_| {
let duration = Duration::from_millis(100);
sleep(duration);
kv::set(&inner_client, "/test/foo/bar", "baz", None)
});

assert!(client.run(work).is_ok());
});
Expand All @@ -707,6 +711,7 @@ fn watch_recursive() {
"/test",
WatchOptions {
recursive: true,
timeout: Some(Duration::from_millis(1000)),
..Default::default()
},
)
Expand Down

0 comments on commit 7cfc98c

Please sign in to comment.