diff options
Diffstat (limited to 'tests/parse_es_requests.rs')
-rw-r--r-- | tests/parse_es_requests.rs | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/tests/parse_es_requests.rs b/tests/parse_es_requests.rs index a55e461..c8081c7 100644 --- a/tests/parse_es_requests.rs +++ b/tests/parse_es_requests.rs @@ -1,8 +1,7 @@ - -use std::fs; -use std::ffi::OsStr; use es_public_proxy::parse::{ScrollBody, SearchBody}; -use es_public_proxy::{ProxyConfig, filter_request}; +use es_public_proxy::{filter_request, ProxyConfig}; +use std::ffi::OsStr; +use std::fs; mod common; @@ -15,13 +14,12 @@ fn basic_load() { #[test] fn parse_search_bodies() { - let file_paths = fs::read_dir("tests/files/search").unwrap(); for path in file_paths { let path = path.unwrap().path(); if path.extension() != Some(OsStr::new("txt")) { - continue + continue; } let parts = common::load_parts(&path); if let Some(body) = parts.body { @@ -36,13 +34,12 @@ fn parse_search_bodies() { #[test] fn parse_scroll_bodies() { - 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 + continue; } let parts = common::load_parts(&path); if let Some(body) = parts.body { @@ -55,7 +52,6 @@ fn parse_scroll_bodies() { #[test] fn filter_search_requests() { - let file_paths = fs::read_dir("tests/files/search").unwrap(); let mut config = ProxyConfig::default(); config.allow_all_indices = Some(true); @@ -64,7 +60,7 @@ fn filter_search_requests() { for path in file_paths { let path = path.unwrap().path(); if path.extension() != Some(OsStr::new("txt")) { - continue + continue; } println!(" filtering: {}", path.display()); let req = common::load_request(&path); @@ -74,7 +70,6 @@ fn filter_search_requests() { #[test] fn filter_scroll_requests() { - let file_paths = fs::read_dir("tests/files/scroll").unwrap(); let mut config = ProxyConfig::default(); config.allow_all_indices = Some(true); @@ -83,7 +78,7 @@ fn filter_scroll_requests() { for path in file_paths { let path = path.unwrap().path(); if path.extension() != Some(OsStr::new("txt")) { - continue + continue; } println!(" filtering: {}", path.display()); let req = common::load_request(&path); @@ -93,7 +88,6 @@ fn filter_scroll_requests() { #[test] fn filter_failures() { - let file_paths = fs::read_dir("tests/files/search_fail").unwrap(); let mut config = ProxyConfig::default(); config.allow_all_indices = Some(true); @@ -102,7 +96,7 @@ fn filter_failures() { for path in file_paths { let path = path.unwrap().path(); if path.extension() != Some(OsStr::new("txt")) { - continue + continue; } println!(" filtering: {}", path.display()); let req = common::load_request(&path); @@ -115,7 +109,7 @@ fn filter_failures() { for path in file_paths { let path = path.unwrap().path(); if path.extension() != Some(OsStr::new("txt")) { - continue + continue; } println!(" filtering: {}", path.display()); let req = common::load_request(&path); |