Skip to content

Update Rust crate googletest to v0.14.2 #11431

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ crates_io_test_db = { path = "crates/crates_io_test_db" }
crates_io_trustpub = { path = "crates/crates_io_trustpub", features = ["test-helpers"] }
claims = "=0.8.0"
diesel = { version = "=2.2.11", features = ["r2d2"] }
googletest = "=0.14.1"
googletest = "=0.14.2"
insta = { version = "=1.43.1", features = ["glob", "json", "redactions"] }
jsonwebtoken = "=9.3.1"
quoted_printable = "=0.5.1"
Expand Down
2 changes: 1 addition & 1 deletion crates/crates_io_database/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ utoipa = { version = "=5.4.0", features = ["chrono"] }
claims = "=0.8.0"
crates_io_test_db = { path = "../crates_io_test_db" }
diesel-async = { version = "=0.5.2", features = ["postgres"] }
googletest = "=0.14.1"
googletest = "=0.14.2"
insta = "=1.43.1"
tokio = { version = "=1.45.1", features = ["macros", "rt"] }
4 changes: 2 additions & 2 deletions src/tests/github_secret_scanning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ async fn github_secret_alert_revokes_token() {
.load(&mut conn)
.await
);
assert_that!(tokens, empty());
assert_that!(tokens, is_empty());

let tokens: Vec<ApiToken> = assert_ok!(
ApiToken::belonging_to(user.as_model())
Expand Down Expand Up @@ -216,7 +216,7 @@ async fn github_secret_alert_for_revoked_token() {
.load(&mut conn)
.await
);
assert_that!(tokens, empty());
assert_that!(tokens, is_empty());

let tokens: Vec<ApiToken> = assert_ok!(
ApiToken::belonging_to(user.as_model())
Expand Down
2 changes: 1 addition & 1 deletion src/tests/krate/following.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ async fn test_following() {
assert_that!(user.search("").await.crates, len(eq(1)));
// see https://github.com/jplatte/serde_html_form/issues/13
assert_that!(user.search("following").await.crates, len(eq(1)));
assert_that!(user.search("following=1").await.crates, empty());
assert_that!(user.search("following=1").await.crates, is_empty());

// Unfollow the crate again and check that this call is also idempotent.
unfollow(CRATE_NAME, &user).await;
Expand Down
8 changes: 4 additions & 4 deletions src/tests/krate/publish/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ async fn new_wrong_token() {
let response = token.publish_crate(crate_to_publish).await;
assert_snapshot!(response.status(), @"403 Forbidden");
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"authentication failed"}]}"#);
assert_that!(app.stored_files().await, empty());
assert_that!(app.emails().await, empty());
assert_that!(app.stored_files().await, is_empty());
assert_that!(app.emails().await, is_empty());
}

#[tokio::test(flavor = "multi_thread")]
Expand All @@ -51,8 +51,8 @@ async fn new_krate_wrong_user() {
assert_snapshot!(response.status(), @"403 Forbidden");
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"this crate exists but you don't seem to be an owner. If you believe this is a mistake, perhaps you need to accept an invitation to be an owner before publishing."}]}"#);

assert_that!(app.stored_files().await, empty());
assert_that!(app.emails().await, empty());
assert_that!(app.stored_files().await, is_empty());
assert_that!(app.emails().await, is_empty());
}

#[tokio::test(flavor = "multi_thread")]
Expand Down
2 changes: 1 addition & 1 deletion src/tests/krate/publish/basics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ async fn new_krate_duplicate_version() {
assert_snapshot!(response.status(), @"400 Bad Request");
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"crate version `1.0.0` is already uploaded"}]}"#);

assert_that!(app.stored_files().await, empty());
assert_that!(app.stored_files().await, is_empty());
}

#[tokio::test(flavor = "multi_thread")]
Expand Down
2 changes: 1 addition & 1 deletion src/tests/krate/publish/categories.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,5 @@ async fn too_many_categories() {
.await;
assert_snapshot!(response.status(), @"400 Bad Request");
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"expected at most 5 categories per crate"}]}"#);
assert_that!(app.stored_files().await, empty());
assert_that!(app.stored_files().await, is_empty());
}
2 changes: 1 addition & 1 deletion src/tests/krate/publish/deleted_crates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ async fn test_recently_deleted_crate_with_same_name() -> anyhow::Result<()> {
let response = token.publish_crate(crate_to_publish).await;
assert_snapshot!(response.status(), @"400 Bad Request");
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"A crate with the name `actix_web` was recently deleted. Reuse of this name will be available after 2099-12-25T12:34:56Z."}]}"#);
assert_that!(app.stored_files().await, empty());
assert_that!(app.stored_files().await, is_empty());

Ok(())
}
26 changes: 13 additions & 13 deletions src/tests/krate/publish/dependencies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ async fn invalid_dependency_name() {
.await;
assert_snapshot!(response.status(), @"400 Bad Request");
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"invalid character `🦀` in dependency name: `🦀`, the first character must be an ASCII character"}]}"#);
assert_that!(app.stored_files().await, empty());
assert_that!(app.stored_files().await, is_empty());
}

#[tokio::test(flavor = "multi_thread")]
Expand Down Expand Up @@ -52,7 +52,7 @@ async fn invalid_dependency_rename() {
.await;
assert_snapshot!(response.status(), @"400 Bad Request");
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"invalid character `💩` in dependency name: `💩`, the first character must be an ASCII character, or `_`"}]}"#);
assert_that!(app.stored_files().await, empty());
assert_that!(app.stored_files().await, is_empty());
}

#[tokio::test(flavor = "multi_thread")]
Expand All @@ -73,7 +73,7 @@ async fn invalid_dependency_name_starts_with_digit() {
.await;
assert_snapshot!(response.status(), @"400 Bad Request");
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"the name `1-foo` cannot be used as a dependency name, the name cannot start with a digit"}]}"#);
assert_that!(app.stored_files().await, empty());
assert_that!(app.stored_files().await, is_empty());
}

#[tokio::test(flavor = "multi_thread")]
Expand All @@ -94,7 +94,7 @@ async fn invalid_dependency_name_contains_unicode_chars() {
.await;
assert_snapshot!(response.status(), @"400 Bad Request");
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"invalid character `🦀` in dependency name: `foo-🦀-bar`, characters must be an ASCII alphanumeric characters, `-`, or `_`"}]}"#);
assert_that!(app.stored_files().await, empty());
assert_that!(app.stored_files().await, is_empty());
}

#[tokio::test(flavor = "multi_thread")]
Expand All @@ -115,7 +115,7 @@ async fn invalid_too_long_dependency_name() {
.await;
assert_snapshot!(response.status(), @"400 Bad Request");
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"the dependency name `fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff` is too long (max 64 characters)"}]}"#);
assert_that!(app.stored_files().await, empty());
assert_that!(app.stored_files().await, is_empty());
}

#[tokio::test(flavor = "multi_thread")]
Expand All @@ -136,7 +136,7 @@ async fn empty_dependency_name() {
.await;
assert_snapshot!(response.status(), @"400 Bad Request");
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"dependency name cannot be empty"}]}"#);
assert_that!(app.stored_files().await, empty());
assert_that!(app.stored_files().await, is_empty());
}

#[tokio::test(flavor = "multi_thread")]
Expand Down Expand Up @@ -212,7 +212,7 @@ async fn new_krate_with_broken_dependency_requirement() {
let response = token.publish_crate(crate_to_publish).await;
assert_snapshot!(response.status(), @"400 Bad Request");
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"\"broken\" is an invalid version requirement"}]}"#);
assert_that!(app.stored_files().await, empty());
assert_that!(app.stored_files().await, is_empty());
}

#[tokio::test(flavor = "multi_thread")]
Expand All @@ -232,7 +232,7 @@ async fn reject_new_krate_with_non_exact_dependency() {
let response = token.publish_crate(crate_to_publish).await;
assert_snapshot!(response.status(), @"400 Bad Request");
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"no known crate named `foo_dep`"}]}"#);
assert_that!(app.stored_files().await, empty());
assert_that!(app.stored_files().await, is_empty());
}

#[tokio::test(flavor = "multi_thread")]
Expand Down Expand Up @@ -261,7 +261,7 @@ async fn reject_new_crate_with_alternative_registry_dependency() {
let response = token.publish_crate(crate_to_publish).await;
assert_snapshot!(response.status(), @"400 Bad Request");
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"Dependency `dep` is hosted on another registry. Cross-registry dependencies are not permitted on crates.io."}]}"#);
assert_that!(app.stored_files().await, empty());
assert_that!(app.stored_files().await, is_empty());
}

#[tokio::test(flavor = "multi_thread")]
Expand All @@ -281,7 +281,7 @@ async fn new_krate_with_wildcard_dependency() {
let response = token.publish_crate(crate_to_publish).await;
assert_snapshot!(response.status(), @"400 Bad Request");
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"wildcard (`*`) dependency constraints are not allowed on crates.io. Crate with this problem: `foo_wild` See https://doc.rust-lang.org/cargo/faq.html#can-libraries-use--as-a-version-for-their-dependencies for more information"}]}"#);
assert_that!(app.stored_files().await, empty());
assert_that!(app.stored_files().await, is_empty());
}

#[tokio::test(flavor = "multi_thread")]
Expand Down Expand Up @@ -313,7 +313,7 @@ async fn new_krate_with_patch() {
let response = token.publish_crate(crate_to_publish).await;
assert_snapshot!(response.status(), @"400 Bad Request");
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"failed to parse `Cargo.toml` manifest file\n\ncrates cannot be published with `[patch]` tables"}]}"#);
assert_that!(app.stored_files().await, empty());
assert_that!(app.stored_files().await, is_empty());
}

#[tokio::test(flavor = "multi_thread")]
Expand All @@ -328,7 +328,7 @@ async fn new_krate_dependency_missing() {
let response = token.publish_crate(crate_to_publish).await;
assert_snapshot!(response.status(), @"400 Bad Request");
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"no known crate named `bar_missing`"}]}"#);
assert_that!(app.stored_files().await, empty());
assert_that!(app.stored_files().await, is_empty());
}

#[tokio::test(flavor = "multi_thread")]
Expand Down Expand Up @@ -369,7 +369,7 @@ async fn invalid_feature_name() {
.await;
assert_snapshot!(response.status(), @"400 Bad Request");
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"invalid character `🍺` in feature `🍺`, the first character must be a Unicode XID start character or digit (most letters or `_` or `0` to `9`)"}]}"#);
assert_that!(app.stored_files().await, empty());
assert_that!(app.stored_files().await, is_empty());
}

#[tokio::test(flavor = "multi_thread")]
Expand Down
8 changes: 4 additions & 4 deletions src/tests/krate/publish/emails.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ async fn new_krate_without_any_email_fails() {
let response = token.publish_crate(crate_to_publish).await;
assert_snapshot!(response.status(), @"400 Bad Request");
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"A verified email address is required to publish crates to crates.io. Visit https://crates.io/settings/profile to set and verify your email address."}]}"#);
assert_that!(app.stored_files().await, empty());
assert_that!(app.emails().await, empty());
assert_that!(app.stored_files().await, is_empty());
assert_that!(app.emails().await, is_empty());
}

#[tokio::test(flavor = "multi_thread")]
Expand All @@ -39,6 +39,6 @@ async fn new_krate_with_unverified_email_fails() {
let response = token.publish_crate(crate_to_publish).await;
assert_snapshot!(response.status(), @"400 Bad Request");
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"A verified email address is required to publish crates to crates.io. Visit https://crates.io/settings/profile to set and verify your email address."}]}"#);
assert_that!(app.stored_files().await, empty());
assert_that!(app.emails().await, empty());
assert_that!(app.stored_files().await, is_empty());
assert_that!(app.emails().await, is_empty());
}
12 changes: 6 additions & 6 deletions src/tests/krate/publish/features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ async fn invalid_feature_name1() {
let response = token.publish_crate(crate_to_publish).await;
assert_snapshot!(response.status(), @"400 Bad Request");
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"invalid character `~` in feature `~foo`, the first character must be a Unicode XID start character or digit (most letters or `_` or `0` to `9`)"}]}"#);
assert_that!(app.stored_files().await, empty());
assert_that!(app.stored_files().await, is_empty());
}

#[tokio::test(flavor = "multi_thread")]
Expand All @@ -83,7 +83,7 @@ async fn invalid_feature_name2() {
let response = token.publish_crate(crate_to_publish).await;
assert_snapshot!(response.status(), @"400 Bad Request");
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"invalid character `!` in feature `!bar`, the first character must be a Unicode XID start character or digit (most letters or `_` or `0` to `9`)"}]}"#);
assert_that!(app.stored_files().await, empty());
assert_that!(app.stored_files().await, is_empty());
}

#[tokio::test(flavor = "multi_thread")]
Expand Down Expand Up @@ -114,7 +114,7 @@ async fn too_many_features() {
let response = token.publish_crate(publish_builder).await;
assert_snapshot!(response.status(), @"400 Bad Request");
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"crates.io only allows a maximum number of 3 features, but your crate is declaring 5 features.\n\nTake a look at https://blog.rust-lang.org/2023/10/26/broken-badges-and-23k-keywords.html to understand why this restriction was introduced.\n\nIf you have a use case that requires an increase of this limit, please send us an email to [email protected] to discuss the details."}]}"#);
assert_that!(app.stored_files().await, empty());
assert_that!(app.stored_files().await, is_empty());
}

#[tokio::test(flavor = "multi_thread")]
Expand Down Expand Up @@ -142,7 +142,7 @@ async fn too_many_features_with_custom_limit() {
let response = token.publish_crate(publish_builder).await;
assert_snapshot!(response.status(), @"400 Bad Request");
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"crates.io only allows a maximum number of 4 features, but your crate is declaring 5 features.\n\nTake a look at https://blog.rust-lang.org/2023/10/26/broken-badges-and-23k-keywords.html to understand why this restriction was introduced.\n\nIf you have a use case that requires an increase of this limit, please send us an email to [email protected] to discuss the details."}]}"#);
assert_that!(app.stored_files().await, empty());
assert_that!(app.stored_files().await, is_empty());

let publish_builder = PublishBuilder::new("foo", "1.0.0")
.feature("one", &[])
Expand Down Expand Up @@ -174,7 +174,7 @@ async fn too_many_enabled_features() {
let response = token.publish_crate(publish_builder).await;
assert_snapshot!(response.status(), @"400 Bad Request");
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"crates.io only allows a maximum number of 3 features or dependencies that another feature can enable, but the \"default\" feature of your crate is enabling 5 features or dependencies.\n\nTake a look at https://blog.rust-lang.org/2023/10/26/broken-badges-and-23k-keywords.html to understand why this restriction was introduced.\n\nIf you have a use case that requires an increase of this limit, please send us an email to [email protected] to discuss the details."}]}"#);
assert_that!(app.stored_files().await, empty());
assert_that!(app.stored_files().await, is_empty());
}

#[tokio::test(flavor = "multi_thread")]
Expand All @@ -198,7 +198,7 @@ async fn too_many_enabled_features_with_custom_limit() {
let response = token.publish_crate(publish_builder).await;
assert_snapshot!(response.status(), @"400 Bad Request");
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"crates.io only allows a maximum number of 4 features or dependencies that another feature can enable, but the \"default\" feature of your crate is enabling 5 features or dependencies.\n\nTake a look at https://blog.rust-lang.org/2023/10/26/broken-badges-and-23k-keywords.html to understand why this restriction was introduced.\n\nIf you have a use case that requires an increase of this limit, please send us an email to [email protected] to discuss the details."}]}"#);
assert_that!(app.stored_files().await, empty());
assert_that!(app.stored_files().await, is_empty());

let publish_builder =
PublishBuilder::new("foo", "1.0.0").feature("default", &["one", "two", "three", "four"]);
Expand Down
2 changes: 1 addition & 1 deletion src/tests/krate/publish/keywords.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,5 @@ async fn too_many_keywords() {
.await;
assert_snapshot!(response.status(), @"400 Bad Request");
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"expected at most 5 keywords per crate"}]}"#);
assert_that!(app.stored_files().await, empty());
assert_that!(app.stored_files().await, is_empty());
}
6 changes: 3 additions & 3 deletions src/tests/krate/publish/max_size.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ async fn tarball_bigger_than_max_upload_size() {
let response = token.publish_crate(body).await;
assert_snapshot!(response.status(), @"413 Payload Too Large");
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"max upload size is: 5242880"}]}"#);
assert_that!(app.stored_files().await, empty());
assert_that!(app.stored_files().await, is_empty());
}

#[tokio::test(flavor = "multi_thread")]
Expand All @@ -110,7 +110,7 @@ async fn new_krate_gzip_bomb() {
let response = token.publish_crate(crate_to_publish).await;
assert_snapshot!(response.status(), @"400 Bad Request");
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"uploaded tarball is malformed or too large when decompressed"}]}"#);
assert_that!(app.stored_files().await, empty());
assert_that!(app.stored_files().await, is_empty());
}

#[tokio::test(flavor = "multi_thread")]
Expand All @@ -129,7 +129,7 @@ async fn new_krate_too_big() {
let response = user.publish_crate(builder).await;
assert_snapshot!(response.status(), @"400 Bad Request");
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"uploaded tarball is malformed or too large when decompressed"}]}"#);
assert_that!(app.stored_files().await, empty());
assert_that!(app.stored_files().await, is_empty());
}

#[tokio::test(flavor = "multi_thread")]
Expand Down
Loading