Skip to content

Commit f0d4cf6

Browse files
Merge pull request #610 from jeremyandrews/update
Update Dependencies and Fix Clippy Warnings
2 parents 1a8280e + dc3a226 commit f0d4cf6

15 files changed

+73
-85
lines changed

CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Changelog
22

3-
## 0.17.3-dev
3+
## 0.18.0
4+
- update all dependencies
45
- [#565](https://github.com/tag1consulting/goose/pull/565) add `--accept-invalid-certs` to skip validation of https certificates
56
- [#568](https://github.com/tag1consulting/goose/pull/568) don't panic when truncating non utf-8 string
67
- [#574](https://github.com/tag1consulting/goose/pull/574) update [`http`](https://docs.rs/http), [`itertools`](https://docs.rs/itertools) [`nix`](https://docs.rs/nix), [`rustls`](https://docs.rs/rustls/), and [`serial_test`](https://docs.rs/serial_test)

Cargo.toml

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "goose"
3-
version = "0.17.3-dev"
3+
version = "0.18.0"
44
authors = ["Jeremy Andrews <jeremy@tag1consulting.com>"]
55
edition = "2018"
66
description = "A load testing framework inspired by Locust."
@@ -15,16 +15,16 @@ license = "Apache-2.0"
1515
async-trait = "0.1"
1616
chrono = { version = "0.4", default-features = false, features = ["clock"] }
1717
ctrlc = "3"
18-
downcast-rs = "1.2"
18+
downcast-rs = "2.0"
1919
flume = "0.11"
2020
futures = "0.3"
2121
gumdrop = "0.8"
2222
http = "1.1"
23-
itertools = "0.12"
23+
itertools = "0.14"
2424
lazy_static = "1.4"
2525
log = "0.4"
2626
num-format = "0.4"
27-
rand = "0.8"
27+
rand = "0.9"
2828
regex = "1"
2929
reqwest = { version = "0.12", default-features = false, features = [
3030
"cookies",
@@ -34,8 +34,8 @@ reqwest = { version = "0.12", default-features = false, features = [
3434
serde = { version = "1.0", features = ["derive"] }
3535
serde_json = "1.0"
3636
simplelog = "0.12"
37-
strum = "0.26"
38-
strum_macros = "0.26"
37+
strum = "0.27"
38+
strum_macros = "0.27"
3939
tokio = { version = "1", features = [
4040
"fs",
4141
"io-util",
@@ -45,8 +45,8 @@ tokio = { version = "1", features = [
4545
"time",
4646
"sync",
4747
] }
48-
tokio-tungstenite = "0.21"
49-
tungstenite = "0.21"
48+
tokio-tungstenite = "0.26"
49+
tungstenite = "0.26"
5050
url = "2"
5151

5252
[features]
@@ -55,8 +55,8 @@ rustls-tls = ["reqwest/rustls-tls", "tokio-tungstenite/rustls"]
5555
gaggle = []
5656

5757
[dev-dependencies]
58-
httpmock = "0.6"
58+
httpmock = "0.7"
5959
native-tls = "0.2"
60-
nix = { version = "0.27", features = ["signal"] }
61-
rustls = "0.22"
62-
serial_test = "2.0"
60+
nix = { version = "0.29", features = ["signal"] }
61+
rustls = "0.23"
62+
serial_test = "3.2"

examples/drupal_memcache.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -135,15 +135,15 @@ async fn drupal_memcache_front_page(user: &mut GooseUser) -> TransactionResult {
135135

136136
/// View a node from 1 to 10,000, created by preptest.sh.
137137
async fn drupal_memcache_node_page(user: &mut GooseUser) -> TransactionResult {
138-
let nid = rand::thread_rng().gen_range(1..10_000);
138+
let nid = rand::rng().random_range(1..10_000);
139139
let _goose = user.get(format!("/node/{}", &nid).as_str()).await?;
140140

141141
Ok(())
142142
}
143143

144144
/// View a profile from 2 to 5,001, created by preptest.sh.
145145
async fn drupal_memcache_profile_page(user: &mut GooseUser) -> TransactionResult {
146-
let uid = rand::thread_rng().gen_range(2..5_001);
146+
let uid = rand::rng().random_range(2..5_001);
147147
let _goose = user.get(format!("/user/{}", &uid).as_str()).await?;
148148

149149
Ok(())
@@ -175,7 +175,7 @@ async fn drupal_memcache_login(user: &mut GooseUser) -> TransactionResult {
175175
};
176176

177177
// Log the user in.
178-
let uid: usize = rand::thread_rng().gen_range(3..5_002);
178+
let uid: usize = rand::rng().random_range(3..5_002);
179179
let username = format!("user{}", uid);
180180
let params = [
181181
("name", username.as_str()),
@@ -217,7 +217,7 @@ async fn drupal_memcache_login(user: &mut GooseUser) -> TransactionResult {
217217

218218
/// Post a comment.
219219
async fn drupal_memcache_post_comment(user: &mut GooseUser) -> TransactionResult {
220-
let nid: i32 = rand::thread_rng().gen_range(1..10_000);
220+
let nid: i32 = rand::rng().random_range(1..10_000);
221221
let node_path = format!("node/{}", &nid);
222222
let comment_path = format!("/comment/reply/{}", &nid);
223223

examples/umami/admin.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use goose::prelude::*;
22

33
use crate::common;
44

5-
use rand::seq::SliceRandom;
5+
use rand::prelude::*;
66
use std::env;
77

88
/// Log into the website.
@@ -110,7 +110,7 @@ pub async fn log_in(user: &mut GooseUser) -> TransactionResult {
110110
pub async fn edit_article(user: &mut GooseUser) -> TransactionResult {
111111
// First, load a random article.
112112
let nodes = common::get_nodes(&common::ContentType::Article);
113-
let article = nodes.choose(&mut rand::thread_rng());
113+
let article = nodes.choose(&mut rand::rng());
114114
let goose = user.get(article.unwrap().url_en).await?;
115115
common::validate_and_load_static_assets(user, goose, article.unwrap().title_en).await?;
116116

examples/umami/common.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
use goose::goose::GooseResponse;
22
use goose::prelude::*;
33

4-
use rand::prelude::IteratorRandom;
5-
use rand::seq::SliceRandom;
4+
use rand::prelude::*;
65
use regex::Regex;
76

87
/// The Umami website defines three content types.
@@ -392,18 +391,18 @@ pub fn random_words(count: usize, english: bool) -> Vec<String> {
392391
ContentType::Recipe,
393392
ContentType::Recipe,
394393
];
395-
let content_type = content_types.choose(&mut rand::thread_rng());
394+
let content_type = content_types.choose(&mut rand::rng());
396395
// Then randomly select a node of this content type.
397396
let nodes = get_nodes(content_type.unwrap());
398-
let page = nodes.choose(&mut rand::thread_rng());
397+
let page = nodes.choose(&mut rand::rng());
399398
// Randomly select a word from the title to use in our search.
400399
let title = if english {
401400
page.unwrap().title_en
402401
} else {
403402
page.unwrap().title_es
404403
};
405404
let words = title.split_whitespace();
406-
let word = words.choose(&mut rand::thread_rng()).unwrap();
405+
let word = words.choose(&mut rand::rng()).unwrap();
407406
// Remove ' to avoid encoding/decoding issues when validating later.
408407
let cleaned_word = word.replace("&#039;", "");
409408
random_words.push(cleaned_word.to_string());

examples/umami/english.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use goose::prelude::*;
22

33
use crate::common;
44

5-
use rand::seq::SliceRandom;
5+
use rand::prelude::*;
66

77
/// Load the front page in English and all static assets found on the page.
88
pub async fn front_page_en(user: &mut GooseUser) -> TransactionResult {
@@ -23,7 +23,7 @@ pub async fn recipe_listing_en(user: &mut GooseUser) -> TransactionResult {
2323
/// Load a random recipe in English and all static assets found on the page.
2424
pub async fn recipe_en(user: &mut GooseUser) -> TransactionResult {
2525
let nodes = common::get_nodes(&common::ContentType::Recipe);
26-
let recipe = nodes.choose(&mut rand::thread_rng());
26+
let recipe = nodes.choose(&mut rand::rng());
2727
let goose = user.get(recipe.unwrap().url_en).await?;
2828
common::validate_and_load_static_assets(user, goose, recipe.unwrap().title_en).await?;
2929

@@ -41,7 +41,7 @@ pub async fn article_listing_en(user: &mut GooseUser) -> TransactionResult {
4141
/// Load a random article in English and all static assets found on the page.
4242
pub async fn article_en(user: &mut GooseUser) -> TransactionResult {
4343
let nodes = common::get_nodes(&common::ContentType::Article);
44-
let article = nodes.choose(&mut rand::thread_rng());
44+
let article = nodes.choose(&mut rand::rng());
4545
let goose = user.get(article.unwrap().url_en).await?;
4646
common::validate_and_load_static_assets(user, goose, article.unwrap().title_en).await?;
4747

@@ -51,7 +51,7 @@ pub async fn article_en(user: &mut GooseUser) -> TransactionResult {
5151
/// Load a random basic page in English and all static assets found on the page.
5252
pub async fn basic_page_en(user: &mut GooseUser) -> TransactionResult {
5353
let nodes = common::get_nodes(&common::ContentType::BasicPage);
54-
let page = nodes.choose(&mut rand::thread_rng());
54+
let page = nodes.choose(&mut rand::rng());
5555
let goose = user.get(page.unwrap().url_en).await?;
5656
common::validate_and_load_static_assets(user, goose, page.unwrap().title_en).await?;
5757

@@ -66,10 +66,10 @@ pub async fn page_by_nid(user: &mut GooseUser) -> TransactionResult {
6666
common::ContentType::BasicPage,
6767
common::ContentType::Recipe,
6868
];
69-
let content_type = content_types.choose(&mut rand::thread_rng());
69+
let content_type = content_types.choose(&mut rand::rng());
7070
// Then randomly select a node of this content type.
7171
let nodes = common::get_nodes(content_type.unwrap());
72-
let page = nodes.choose(&mut rand::thread_rng());
72+
let page = nodes.choose(&mut rand::rng());
7373
// Load the page by nid instead of by URL.
7474
let goose = user
7575
.get(&("/node/".to_string() + &page.unwrap().nid.to_string()))
@@ -96,7 +96,7 @@ pub async fn search_en(user: &mut GooseUser) -> TransactionResult {
9696
/// Load category listing by a random term in English and all static assets found on the page.
9797
pub async fn term_listing_en(user: &mut GooseUser) -> TransactionResult {
9898
let terms = common::get_terms();
99-
let term = terms.choose(&mut rand::thread_rng());
99+
let term = terms.choose(&mut rand::rng());
100100
let goose = user.get(term.unwrap().url_en).await?;
101101
common::validate_and_load_static_assets(user, goose, term.unwrap().title_en).await?;
102102

examples/umami/spanish.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use goose::prelude::*;
22

33
use crate::common;
44

5-
use rand::seq::SliceRandom;
5+
use rand::prelude::*;
66

77
/// Load the front page in Spanish and all static assets found on the page.
88
pub async fn front_page_es(user: &mut GooseUser) -> TransactionResult {
@@ -23,7 +23,7 @@ pub async fn recipe_listing_es(user: &mut GooseUser) -> TransactionResult {
2323
/// Load a random recipe in Spanish and all static assets found on the page.
2424
pub async fn recipe_es(user: &mut GooseUser) -> TransactionResult {
2525
let nodes = common::get_nodes(&common::ContentType::Recipe);
26-
let recipe = nodes.choose(&mut rand::thread_rng());
26+
let recipe = nodes.choose(&mut rand::rng());
2727
let goose = user.get(recipe.unwrap().url_es).await?;
2828
common::validate_and_load_static_assets(user, goose, recipe.unwrap().title_es).await?;
2929

@@ -41,7 +41,7 @@ pub async fn article_listing_es(user: &mut GooseUser) -> TransactionResult {
4141
/// Load a random article in Spanish and all static assets found on the page.
4242
pub async fn article_es(user: &mut GooseUser) -> TransactionResult {
4343
let nodes = common::get_nodes(&common::ContentType::Article);
44-
let article = nodes.choose(&mut rand::thread_rng());
44+
let article = nodes.choose(&mut rand::rng());
4545
let goose = user.get(article.unwrap().url_es).await?;
4646
common::validate_and_load_static_assets(user, goose, article.unwrap().title_es).await?;
4747

@@ -51,7 +51,7 @@ pub async fn article_es(user: &mut GooseUser) -> TransactionResult {
5151
/// Load a basic page in Spanish and all static assets found on the page.
5252
pub async fn basic_page_es(user: &mut GooseUser) -> TransactionResult {
5353
let nodes = common::get_nodes(&common::ContentType::BasicPage);
54-
let page = nodes.choose(&mut rand::thread_rng());
54+
let page = nodes.choose(&mut rand::rng());
5555
let goose = user.get(page.unwrap().url_es).await?;
5656
common::validate_and_load_static_assets(user, goose, page.unwrap().title_es).await?;
5757

@@ -75,7 +75,7 @@ pub async fn search_es(user: &mut GooseUser) -> TransactionResult {
7575
/// Load category listing by a random term in Spanish and all static assets found on the page.
7676
pub async fn term_listing_es(user: &mut GooseUser) -> TransactionResult {
7777
let terms = common::get_terms();
78-
let term = terms.choose(&mut rand::thread_rng());
78+
let term = terms.choose(&mut rand::rng());
7979
let goose = user.get(term.unwrap().url_es).await?;
8080
common::validate_and_load_static_assets(user, goose, term.unwrap().title_es).await?;
8181

src/controller.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -1465,6 +1465,7 @@ trait ControllerExecuteCommand<T> {
14651465
// if the request was successful or not.
14661466
async fn write_to_socket(&self, socket: &mut T, response_message: Result<String, String>);
14671467
}
1468+
14681469
#[async_trait]
14691470
impl ControllerExecuteCommand<tokio::net::TcpStream> for ControllerState {
14701471
// Run the command received from a telnet Controller request.
@@ -1527,6 +1528,7 @@ impl ControllerExecuteCommand<tokio::net::TcpStream> for ControllerState {
15271528
};
15281529
}
15291530
}
1531+
15301532
#[async_trait]
15311533
impl ControllerExecuteCommand<ControllerWebSocketSender> for ControllerState {
15321534
// Run the command received from a WebSocket Controller request.
@@ -1546,7 +1548,7 @@ impl ControllerExecuteCommand<ControllerWebSocketSender> for ControllerState {
15461548
&& socket
15471549
.send(Message::Close(Some(tokio_tungstenite::tungstenite::protocol::CloseFrame {
15481550
code: tokio_tungstenite::tungstenite::protocol::frame::coding::CloseCode::Normal,
1549-
reason: std::borrow::Cow::Borrowed("exit"),
1551+
reason: "exit".into(),
15501552
})))
15511553
.await
15521554
.is_err()
@@ -1588,7 +1590,7 @@ impl ControllerExecuteCommand<ControllerWebSocketSender> for ControllerState {
15881590
&& socket
15891591
.send(Message::Close(Some(tokio_tungstenite::tungstenite::protocol::CloseFrame {
15901592
code: tokio_tungstenite::tungstenite::protocol::frame::coding::CloseCode::Normal,
1591-
reason: std::borrow::Cow::Borrowed("shutdown"),
1593+
reason: "shutdown".into(),
15921594
})))
15931595
.await
15941596
.is_err()
@@ -1624,7 +1626,7 @@ impl ControllerExecuteCommand<ControllerWebSocketSender> for ControllerState {
16241626
// Success is true if there is no error, false if there is an error.
16251627
success,
16261628
}) {
1627-
Ok(json) => json,
1629+
Ok(json) => json.into(),
16281630
Err(e) => {
16291631
warn!("failed to json encode response: {}", e);
16301632
return;

src/goose.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1545,7 +1545,7 @@ impl GooseUser {
15451545
/// Ok(())
15461546
/// }
15471547
/// ```
1548-
pub async fn request<'a>(
1548+
pub async fn request(
15491549
&mut self,
15501550
mut request: GooseRequest<'_>,
15511551
) -> Result<GooseResponse, Box<TransactionError>> {

0 commit comments

Comments
 (0)