From 780ca2a819a6d1c931580c8e8e31657072971876 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Mon, 24 Aug 2020 14:13:56 -0700 Subject: more progress and tests --- tests/files/DELETE_scroll_body.txt | 4 ---- tests/files/DELETE_scroll_path.txt | 1 - tests/files/POST_scroll_continue.txt | 5 ----- tests/files/scroll/DELETE_scroll_body.txt | 4 ++++ tests/files/scroll/DELETE_scroll_path.txt | 1 + tests/files/scroll/POST_scroll_continue.txt | 5 +++++ tests/parse_es_requests.rs | 23 +++++++++++++++++++++-- 7 files changed, 31 insertions(+), 12 deletions(-) delete mode 100644 tests/files/DELETE_scroll_body.txt delete mode 100644 tests/files/DELETE_scroll_path.txt delete mode 100644 tests/files/POST_scroll_continue.txt create mode 100644 tests/files/scroll/DELETE_scroll_body.txt create mode 100644 tests/files/scroll/DELETE_scroll_path.txt create mode 100644 tests/files/scroll/POST_scroll_continue.txt (limited to 'tests') diff --git a/tests/files/DELETE_scroll_body.txt b/tests/files/DELETE_scroll_body.txt deleted file mode 100644 index 26960a9..0000000 --- a/tests/files/DELETE_scroll_body.txt +++ /dev/null @@ -1,4 +0,0 @@ -DELETE /_search/scroll -{ - "scroll_id" : "DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==" -} diff --git a/tests/files/DELETE_scroll_path.txt b/tests/files/DELETE_scroll_path.txt deleted file mode 100644 index 7910ed8..0000000 --- a/tests/files/DELETE_scroll_path.txt +++ /dev/null @@ -1 +0,0 @@ -DELETE /_search/scroll/DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ== diff --git a/tests/files/POST_scroll_continue.txt b/tests/files/POST_scroll_continue.txt deleted file mode 100644 index 9aef4d3..0000000 --- a/tests/files/POST_scroll_continue.txt +++ /dev/null @@ -1,5 +0,0 @@ -POST /_search/scroll -{ - "scroll" : "1m", - "scroll_id" : "DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==" -} diff --git a/tests/files/scroll/DELETE_scroll_body.txt b/tests/files/scroll/DELETE_scroll_body.txt new file mode 100644 index 0000000..26960a9 --- /dev/null +++ b/tests/files/scroll/DELETE_scroll_body.txt @@ -0,0 +1,4 @@ +DELETE /_search/scroll +{ + "scroll_id" : "DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==" +} diff --git a/tests/files/scroll/DELETE_scroll_path.txt b/tests/files/scroll/DELETE_scroll_path.txt new file mode 100644 index 0000000..7910ed8 --- /dev/null +++ b/tests/files/scroll/DELETE_scroll_path.txt @@ -0,0 +1 @@ +DELETE /_search/scroll/DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ== diff --git a/tests/files/scroll/POST_scroll_continue.txt b/tests/files/scroll/POST_scroll_continue.txt new file mode 100644 index 0000000..9aef4d3 --- /dev/null +++ b/tests/files/scroll/POST_scroll_continue.txt @@ -0,0 +1,5 @@ +POST /_search/scroll +{ + "scroll" : "1m", + "scroll_id" : "DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==" +} diff --git a/tests/parse_es_requests.rs b/tests/parse_es_requests.rs index 57be06a..a4950c0 100644 --- a/tests/parse_es_requests.rs +++ b/tests/parse_es_requests.rs @@ -1,7 +1,7 @@ use std::fs; use std::ffi::OsStr; -use es_public_proxy::SearchBody; +use es_public_proxy::{ScrollBody, SearchBody}; mod common; @@ -22,7 +22,7 @@ fn basic_parse() { } #[test] -fn parse_all_requests() { +fn parse_search_requests() { let file_paths = fs::read_dir("tests/files").unwrap(); @@ -39,3 +39,22 @@ fn parse_all_requests() { } } } + +#[test] +fn parse_scroll_requests() { + + let file_paths = fs::read_dir("tests/files/scroll").unwrap(); + + for path in file_paths { + let path = path.unwrap().path(); + if path.extension() != Some(OsStr::new("txt")) { + continue + } + let request = common::load_request(&path); + if let Some(body) = request.body { + println!("parsing: {}", path.display()); + println!("BODY: {}", body); + let _parsed: ScrollBody = serde_json::from_str(&body).unwrap(); + } + } +} -- cgit v1.2.3