Skip to content

Commit

Permalink
Merge pull request #343 from jeremyandrews/updates
Browse files Browse the repository at this point in the history
update httpmock dependency
  • Loading branch information
jeremyandrews authored Aug 13, 2021
2 parents 3c42a4d + a234e1e commit 079f8ad
Show file tree
Hide file tree
Showing 14 changed files with 38 additions and 37 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
6 changes: 3 additions & 3 deletions tests/closure.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use httpmock::{Method::GET, MockRef, MockServer};
use httpmock::{Method::GET, Mock, MockServer};
use std::sync::Arc;

mod common;
Expand Down Expand Up @@ -51,7 +51,7 @@ fn configure_mock_endpoints<'a>() -> Vec<LoadtestEndpoint<'a>> {
}

// All tests in this file run against common endpoints.
fn setup_mock_server_endpoints(server: &MockServer) -> Vec<MockRef> {
fn setup_mock_server_endpoints(server: &MockServer) -> Vec<Mock> {
// Get common configuration for building endpoints and the load test itself.
let test_endpoints = configure_mock_endpoints();

Expand Down Expand Up @@ -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,
) {
Expand Down
6 changes: 3 additions & 3 deletions tests/controller.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down Expand Up @@ -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<MockRef> {
fn setup_mock_server_endpoints(server: &MockServer) -> Vec<Mock> {
vec![
// First set up INDEX_PATH, store in vector at INDEX_KEY.
server.mock(|when, then| {
Expand Down Expand Up @@ -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,
) {
Expand Down
6 changes: 3 additions & 3 deletions tests/defaults.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use httpmock::{Method::GET, MockRef, MockServer};
use httpmock::{Method::GET, Mock, MockServer};
use serial_test::serial;

mod common;
Expand Down Expand Up @@ -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<MockRef> {
fn setup_mock_server_endpoints(server: &MockServer) -> Vec<Mock> {
vec![
// First, set up INDEX_PATH, store in vector at INDEX_KEY.
server.mock(|when, then| {
Expand All @@ -67,7 +67,7 @@ fn setup_mock_server_endpoints(server: &MockServer) -> Vec<MockRef> {
// 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],
) {
Expand Down
6 changes: 3 additions & 3 deletions tests/error.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use httpmock::{Method::GET, MockRef, MockServer};
use httpmock::{Method::GET, Mock, MockServer};
use serial_test::serial;

mod common;
Expand Down Expand Up @@ -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<MockRef> {
fn setup_mock_server_endpoints(server: &MockServer) -> Vec<Mock> {
vec![
// First set up INDEX_PATH, store in vector at INDEX_KEY.
server.mock(|when, then| {
Expand Down Expand Up @@ -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,
) {
Expand Down
6 changes: 3 additions & 3 deletions tests/logs.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use httpmock::{Method::GET, MockRef, MockServer};
use httpmock::{Method::GET, Mock, MockServer};
use serial_test::serial;
use std::fmt;

Expand Down Expand Up @@ -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<MockRef> {
fn setup_mock_server_endpoints(server: &MockServer) -> Vec<Mock> {
vec![
// First, set up INDEX_PATH, store in vector at INDEX_KEY.
server.mock(|when, then| {
Expand All @@ -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,
) {
Expand Down
6 changes: 3 additions & 3 deletions tests/no_normal_tasks.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use httpmock::{
Method::{GET, POST},
MockRef, MockServer,
Mock, MockServer,
};

mod common;
Expand Down Expand Up @@ -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<MockRef> {
fn setup_mock_server_endpoints(server: &MockServer) -> Vec<Mock> {
vec![
// First set up LOGIN_PATH, store in vector at LOGIN_KEY.
server.mock(|when, then| {
Expand Down Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions tests/one_taskset.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use httpmock::{Method::GET, MockRef, MockServer};
use httpmock::{Method::GET, Mock, MockServer};
use serial_test::serial;

mod common;
Expand Down Expand Up @@ -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<MockRef> {
fn setup_mock_server_endpoints(server: &MockServer) -> Vec<Mock> {
vec![
// First set up INDEX_PATH, store in vector at INDEX_KEY.
server.mock(|when, then| {
Expand Down Expand Up @@ -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,
) {
Expand Down
6 changes: 3 additions & 3 deletions tests/redirect.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use httpmock::{Method::GET, MockRef, MockServer};
use httpmock::{Method::GET, Mock, MockServer};
use serial_test::serial;

mod common;
Expand Down Expand Up @@ -96,7 +96,7 @@ fn setup_mock_server_endpoints<'a>(
test_type: &TestType,
server: &'a MockServer,
server2: Option<&'a MockServer>,
) -> Vec<MockRef<'a>> {
) -> Vec<Mock<'a>> {
match test_type {
TestType::Chain => {
vec![
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions tests/scheduler.rs
Original file line number Diff line number Diff line change
@@ -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};

Expand Down Expand Up @@ -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<MockRef> {
fn setup_mock_server_endpoints(server: &MockServer) -> Vec<Mock> {
vec![
// First set up ONE_PATH, store in vector at ONE_KEY.
server.mock(|when, then| {
Expand Down Expand Up @@ -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);

Expand Down
6 changes: 3 additions & 3 deletions tests/sequence.rs
Original file line number Diff line number Diff line change
@@ -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};

Expand Down Expand Up @@ -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<MockRef> {
fn setup_mock_server_endpoints(server: &MockServer) -> Vec<Mock> {
vec![
// First set up ONE_PATH, store in vector at ONE_KEY.
server.mock(|when, then| {
Expand Down Expand Up @@ -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);

Expand Down
6 changes: 3 additions & 3 deletions tests/setup_teardown.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use httpmock::{
Method::{GET, POST},
MockRef, MockServer,
Mock, MockServer,
};
use serial_test::serial;

Expand Down Expand Up @@ -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<MockRef> {
fn setup_mock_server_endpoints(server: &MockServer) -> Vec<Mock> {
vec![
// First set up INDEX_PATH, store in vector at INDEX_KEY.
server.mock(|when, then| {
Expand Down Expand Up @@ -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);

Expand Down
6 changes: 3 additions & 3 deletions tests/throttle.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use httpmock::{Method::GET, MockRef, MockServer};
use httpmock::{Method::GET, Mock, MockServer};

mod common;

Expand Down Expand Up @@ -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<MockRef> {
fn setup_mock_server_endpoints(server: &MockServer) -> Vec<Mock> {
vec![
// First set up INDEX_PATH, store in vector at INDEX_KEY.
server.mock(|when, then| {
Expand Down Expand Up @@ -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<usize>,
Expand Down

0 comments on commit 079f8ad

Please sign in to comment.