Last active
July 15, 2017 17:00
-
-
Save jimmycuadra/e4f251bb77e7acdafc009d487437aa8d to your computer and use it in GitHub Desktop.
Async version of https://github.com/jimmycuadra/rust-etcd/blob/9635f3c123e5b9864a9b314b8d70360b981732d2/tests/client_test.rs#L100
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
#[test] | |
fn create_in_order() { | |
let core = Core::new().unwrap(); | |
let mut client = TestClient::new(core); | |
let requests: Vec<FutureKeySpaceInfo> = (1..4).map(|_| { | |
kv::create_in_order( &client, "/test/foo", "bar", None) | |
}).collect(); | |
let work = join_all(requests).and_then(|mut ksis: Vec<KeySpaceInfo>| { | |
ksis.sort_by_key(|ksi| ksi.node.as_ref().unwrap().modified_index.unwrap()); | |
let keys: Vec<String> = ksis | |
.into_iter() | |
.map(|ksi| ksi.node.unwrap().key.unwrap()) | |
.collect(); | |
assert!(keys[0] < keys[1]); | |
assert!(keys[1] < keys[2]); | |
Ok(()) | |
}); | |
assert!(client.run(work).is_ok()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment