diff --git a/CHANGELOG.md b/CHANGELOG.md index 37b722fe..0fedf753 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - introduce `pretty` log format for `--error-format`, `--debug-format`, `--request-format`, and `--task-format` - clippy cleanups: don't borrow references that are immediately dereferenced by the compiler: https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow - consistently report users simulated, target host(s), start and end times, and total duration of test both in text metrics and html report + - updated httpmock dev dependency to [`0.6`](https://github.com/alexliesenfeld/httpmock/blob/master/CHANGELOG.md) ## 0.13.0 July 19, 2021 - enable [`gzip`](https://docs.rs/reqwest/*/reqwest/struct.ClientBuilder.html#method.gzip) support and set Accept-Encoding header by default in the client; disable with `--no-gzip` or `GooseDefault::NoGzip` diff --git a/Cargo.toml b/Cargo.toml index f39d2027..88f2d431 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -62,7 +62,7 @@ rustls-tls = ["reqwest/rustls-tls", "tokio-tungstenite/rustls-tls"] rustc_version = "0.4" [dev-dependencies] -httpmock = "0.5" +httpmock = "0.6" serial_test = "0.5" native-tls = "0.2" rustls = "0.19" diff --git a/tests/closure.rs b/tests/closure.rs index 2d51d009..7f22a8e9 100644 --- a/tests/closure.rs +++ b/tests/closure.rs @@ -1,4 +1,4 @@ -use httpmock::{Method::GET, MockRef, MockServer}; +use httpmock::{Method::GET, Mock, MockServer}; use std::sync::Arc; mod common; @@ -51,7 +51,7 @@ fn configure_mock_endpoints<'a>() -> Vec> { } // All tests in this file run against common endpoints. -fn setup_mock_server_endpoints(server: &MockServer) -> Vec { +fn setup_mock_server_endpoints(server: &MockServer) -> Vec { // Get common configuration for building endpoints and the load test itself. let test_endpoints = configure_mock_endpoints(); @@ -144,7 +144,7 @@ fn build_taskset() -> GooseTaskSet { // Common validation for the load tests in this file. fn validate_closer_test( - mock_endpoints: &[MockRef], + mock_endpoints: &[Mock], goose_metrics: &GooseMetrics, configuration: &GooseConfiguration, ) { diff --git a/tests/controller.rs b/tests/controller.rs index 3f592d09..d5885d14 100644 --- a/tests/controller.rs +++ b/tests/controller.rs @@ -1,5 +1,5 @@ use gumdrop::Options; -use httpmock::{Method::GET, MockRef, MockServer}; +use httpmock::{Method::GET, Mock, MockServer}; use std::io::{Read, Write}; use std::net::TcpStream; use std::{str, thread, time}; @@ -77,7 +77,7 @@ pub async fn get_about(user: &GooseUser) -> GooseTaskResult { } // All tests in this file run against the following common endpoints. -fn setup_mock_server_endpoints(server: &MockServer) -> Vec { +fn setup_mock_server_endpoints(server: &MockServer) -> Vec { vec![ // First set up INDEX_PATH, store in vector at INDEX_KEY. server.mock(|when, then| { @@ -111,7 +111,7 @@ fn common_build_configuration(_server: &MockServer, custom: &mut Vec<&str>) -> G // Helper to confirm all variations generate appropriate results. fn validate_one_taskset( goose_metrics: &GooseMetrics, - mock_endpoints: &[MockRef], + mock_endpoints: &[Mock], configuration: &GooseConfiguration, _test_type: TestType, ) { diff --git a/tests/defaults.rs b/tests/defaults.rs index 6eb749de..8a7cff3e 100644 --- a/tests/defaults.rs +++ b/tests/defaults.rs @@ -1,4 +1,4 @@ -use httpmock::{Method::GET, MockRef, MockServer}; +use httpmock::{Method::GET, Mock, MockServer}; use serial_test::serial; mod common; @@ -49,7 +49,7 @@ pub async fn get_about(user: &GooseUser) -> GooseTaskResult { } // All tests in this file run against common endpoints. -fn setup_mock_server_endpoints(server: &MockServer) -> Vec { +fn setup_mock_server_endpoints(server: &MockServer) -> Vec { vec![ // First, set up INDEX_PATH, store in vector at INDEX_KEY. server.mock(|when, then| { @@ -67,7 +67,7 @@ fn setup_mock_server_endpoints(server: &MockServer) -> Vec { // Helper to confirm all variations generate appropriate results. fn validate_test( goose_metrics: GooseMetrics, - mock_endpoints: &[MockRef], + mock_endpoints: &[Mock], requests_files: &[String], debug_files: &[String], ) { diff --git a/tests/error.rs b/tests/error.rs index 29c6b280..d90aa0ad 100644 --- a/tests/error.rs +++ b/tests/error.rs @@ -1,4 +1,4 @@ -use httpmock::{Method::GET, MockRef, MockServer}; +use httpmock::{Method::GET, Mock, MockServer}; use serial_test::serial; mod common; @@ -40,7 +40,7 @@ pub async fn get_404_path(user: &GooseUser) -> GooseTaskResult { } // All tests in this file run against common endpoints. -fn setup_mock_server_endpoints(server: &MockServer) -> Vec { +fn setup_mock_server_endpoints(server: &MockServer) -> Vec { vec![ // First set up INDEX_PATH, store in vector at INDEX_KEY. server.mock(|when, then| { @@ -78,7 +78,7 @@ fn common_build_configuration(server: &MockServer, custom: &mut Vec<&str>) -> Go // Helper to confirm all variations generate appropriate results. fn validate_error( goose_metrics: &GooseMetrics, - mock_endpoints: &[MockRef], + mock_endpoints: &[Mock], configuration: &GooseConfiguration, test_type: TestType, ) { diff --git a/tests/logs.rs b/tests/logs.rs index d7630b88..a612bfb4 100644 --- a/tests/logs.rs +++ b/tests/logs.rs @@ -1,4 +1,4 @@ -use httpmock::{Method::GET, MockRef, MockServer}; +use httpmock::{Method::GET, Mock, MockServer}; use serial_test::serial; use std::fmt; @@ -79,7 +79,7 @@ pub async fn get_error(user: &GooseUser) -> GooseTaskResult { } // All tests in this file run against common endpoints. -fn setup_mock_server_endpoints(server: &MockServer) -> Vec { +fn setup_mock_server_endpoints(server: &MockServer) -> Vec { vec![ // First, set up INDEX_PATH, store in vector at INDEX_KEY. server.mock(|when, then| { @@ -104,7 +104,7 @@ fn get_tasks() -> GooseTaskSet { // Helper to confirm all variations generate appropriate results. fn validate_test( goose_metrics: GooseMetrics, - mock_endpoints: &[MockRef], + mock_endpoints: &[Mock], test_type: &TestType, log_files: &LogFiles, ) { diff --git a/tests/no_normal_tasks.rs b/tests/no_normal_tasks.rs index 7609a06f..186e3720 100644 --- a/tests/no_normal_tasks.rs +++ b/tests/no_normal_tasks.rs @@ -1,6 +1,6 @@ use httpmock::{ Method::{GET, POST}, - MockRef, MockServer, + Mock, MockServer, }; mod common; @@ -37,7 +37,7 @@ pub async fn logout(user: &GooseUser) -> GooseTaskResult { } // All tests in this file run against common endpoints. -fn setup_mock_server_endpoints(server: &MockServer) -> Vec { +fn setup_mock_server_endpoints(server: &MockServer) -> Vec { vec![ // First set up LOGIN_PATH, store in vector at LOGIN_KEY. server.mock(|when, then| { @@ -93,7 +93,7 @@ fn common_build_configuration( } // Helper to confirm all variations generate appropriate results. -fn validate_test(mock_endpoints: &[MockRef]) { +fn validate_test(mock_endpoints: &[Mock]) { // Confirm that the on_start and on_exit tasks actually ran once per GooseUser. mock_endpoints[LOGIN_KEY].assert_hits(USERS); mock_endpoints[LOGOUT_KEY].assert_hits(USERS); diff --git a/tests/one_taskset.rs b/tests/one_taskset.rs index f04dbee9..f25b56a1 100644 --- a/tests/one_taskset.rs +++ b/tests/one_taskset.rs @@ -1,4 +1,4 @@ -use httpmock::{Method::GET, MockRef, MockServer}; +use httpmock::{Method::GET, Mock, MockServer}; use serial_test::serial; mod common; @@ -40,7 +40,7 @@ pub async fn get_about(user: &GooseUser) -> GooseTaskResult { } // All tests in this file run against common endpoints. -fn setup_mock_server_endpoints(server: &MockServer) -> Vec { +fn setup_mock_server_endpoints(server: &MockServer) -> Vec { vec![ // First set up INDEX_PATH, store in vector at INDEX_KEY. server.mock(|when, then| { @@ -78,7 +78,7 @@ fn common_build_configuration(server: &MockServer, custom: &mut Vec<&str>) -> Go // Helper to confirm all variations generate appropriate results. fn validate_one_taskset( goose_metrics: &GooseMetrics, - mock_endpoints: &[MockRef], + mock_endpoints: &[Mock], configuration: &GooseConfiguration, test_type: TestType, ) { diff --git a/tests/redirect.rs b/tests/redirect.rs index ee04270a..830daed3 100644 --- a/tests/redirect.rs +++ b/tests/redirect.rs @@ -1,4 +1,4 @@ -use httpmock::{Method::GET, MockRef, MockServer}; +use httpmock::{Method::GET, Mock, MockServer}; use serial_test::serial; mod common; @@ -96,7 +96,7 @@ fn setup_mock_server_endpoints<'a>( test_type: &TestType, server: &'a MockServer, server2: Option<&'a MockServer>, -) -> Vec> { +) -> Vec> { match test_type { TestType::Chain => { vec![ @@ -233,7 +233,7 @@ fn common_build_configuration( } // Helper to confirm all variations generate appropriate results. -fn validate_redirect(test_type: &TestType, mock_endpoints: &[MockRef]) { +fn validate_redirect(test_type: &TestType, mock_endpoints: &[Mock]) { match test_type { TestType::Chain => { // Confirm that all pages are loaded, even those not requested directly but diff --git a/tests/scheduler.rs b/tests/scheduler.rs index 7fea531e..416f097f 100644 --- a/tests/scheduler.rs +++ b/tests/scheduler.rs @@ -1,4 +1,4 @@ -use httpmock::{Method::GET, MockRef, MockServer}; +use httpmock::{Method::GET, Mock, MockServer}; use serial_test::serial; use tokio::time::{sleep, Duration}; @@ -82,7 +82,7 @@ pub async fn stop_one(user: &GooseUser) -> GooseTaskResult { } // All tests in this file run against common endpoints. -fn setup_mock_server_endpoints(server: &MockServer) -> Vec { +fn setup_mock_server_endpoints(server: &MockServer) -> Vec { vec![ // First set up ONE_PATH, store in vector at ONE_KEY. server.mock(|when, then| { @@ -153,7 +153,7 @@ fn common_build_configuration( } // Helper to confirm all variations generate appropriate results. -fn validate_test(test_type: &TestType, scheduler: &GooseScheduler, mock_endpoints: &[MockRef]) { +fn validate_test(test_type: &TestType, scheduler: &GooseScheduler, mock_endpoints: &[Mock]) { // START_ONE_PATH is loaded one and only one time on all variations. mock_endpoints[START_ONE_KEY].assert_hits(1); diff --git a/tests/sequence.rs b/tests/sequence.rs index edbc5d50..0588aa8b 100644 --- a/tests/sequence.rs +++ b/tests/sequence.rs @@ -1,4 +1,4 @@ -use httpmock::{Method::GET, MockRef, MockServer}; +use httpmock::{Method::GET, Mock, MockServer}; use serial_test::serial; use tokio::time::{sleep, Duration}; @@ -78,7 +78,7 @@ pub async fn stop_one(user: &GooseUser) -> GooseTaskResult { } // All tests in this file run against common endpoints. -fn setup_mock_server_endpoints(server: &MockServer) -> Vec { +fn setup_mock_server_endpoints(server: &MockServer) -> Vec { vec![ // First set up ONE_PATH, store in vector at ONE_KEY. server.mock(|when, then| { @@ -149,7 +149,7 @@ fn common_build_configuration( } // Helper to confirm all variations generate appropriate results. -fn validate_test(test_type: &TestType, mock_endpoints: &[MockRef]) { +fn validate_test(test_type: &TestType, mock_endpoints: &[Mock]) { // START_ONE_PATH is loaded one and only one time on all variations. mock_endpoints[START_ONE_KEY].assert_hits(1); diff --git a/tests/setup_teardown.rs b/tests/setup_teardown.rs index 422ef961..ca70ee46 100644 --- a/tests/setup_teardown.rs +++ b/tests/setup_teardown.rs @@ -1,6 +1,6 @@ use httpmock::{ Method::{GET, POST}, - MockRef, MockServer, + Mock, MockServer, }; use serial_test::serial; @@ -55,7 +55,7 @@ pub async fn get_index(user: &GooseUser) -> GooseTaskResult { } // All tests in this file run against common endpoints. -fn setup_mock_server_endpoints(server: &MockServer) -> Vec { +fn setup_mock_server_endpoints(server: &MockServer) -> Vec { vec![ // First set up INDEX_PATH, store in vector at INDEX_KEY. server.mock(|when, then| { @@ -102,7 +102,7 @@ fn common_build_configuration( } // Helper to confirm all variations generate appropriate results. -fn validate_test(test_type: &TestType, mock_endpoints: &[MockRef]) { +fn validate_test(test_type: &TestType, mock_endpoints: &[Mock]) { // Confirm the load test ran. assert!(mock_endpoints[INDEX_KEY].hits() > 0); diff --git a/tests/throttle.rs b/tests/throttle.rs index d6542803..28b40d27 100644 --- a/tests/throttle.rs +++ b/tests/throttle.rs @@ -1,4 +1,4 @@ -use httpmock::{Method::GET, MockRef, MockServer}; +use httpmock::{Method::GET, Mock, MockServer}; mod common; @@ -33,7 +33,7 @@ pub async fn get_about(user: &GooseUser) -> GooseTaskResult { } // All tests in this file run against common endpoints. -fn setup_mock_server_endpoints(server: &MockServer) -> Vec { +fn setup_mock_server_endpoints(server: &MockServer) -> Vec { vec![ // First set up INDEX_PATH, store in vector at INDEX_KEY. server.mock(|when, then| { @@ -111,7 +111,7 @@ fn common_build_configuration( // Helper to confirm all variations generate appropriate results. fn validate_test( - mock_endpoints: &[MockRef], + mock_endpoints: &[Mock], request_logs: &[String], throttle_value: usize, previous_requests_file_lines: Option,