You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tests/testsuite/publish.rs
+103Lines changed: 103 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -4402,3 +4402,106 @@ See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for
4402
4402
"#]])
4403
4403
.run();
4404
4404
}
4405
+
4406
+
#[cargo_test]
4407
+
fnworkspace_publish_rate_limit_error(){
4408
+
let registry = registry::RegistryBuilder::new()
4409
+
.http_api()
4410
+
.http_index()
4411
+
.add_responder("/api/v1/crates/new", |_req, _| {
4412
+
// For simplicity, let's just return rate limit error for all requests
4413
+
// This simulates hitting rate limit during workspace publish
4414
+
Response{
4415
+
code:429,
4416
+
headers:vec!["Retry-After: 3600".to_string()],
4417
+
body:format!(
4418
+
"You have published too many new crates in a short period of time. Please try again after Fri, 18 Jul 2025 20:00:34 GMT or email [email protected] to have your limit increased."
4419
+
).into_bytes(),
4420
+
}
4421
+
})
4422
+
.build();
4423
+
4424
+
let p = project()
4425
+
.file(
4426
+
"Cargo.toml",
4427
+
r#"
4428
+
[workspace]
4429
+
members = ["package_a", "package_b", "package_c"]
4430
+
"#,
4431
+
)
4432
+
.file("src/lib.rs","")
4433
+
.file(
4434
+
"package_a/Cargo.toml",
4435
+
r#"
4436
+
[package]
4437
+
name = "package_a"
4438
+
version = "0.1.0"
4439
+
edition = "2015"
4440
+
license = "MIT"
4441
+
description = "package a"
4442
+
repository = "https://github.com/test/package_a"
4443
+
"#,
4444
+
)
4445
+
.file("package_a/src/lib.rs","")
4446
+
.file(
4447
+
"package_b/Cargo.toml",
4448
+
r#"
4449
+
[package]
4450
+
name = "package_b"
4451
+
version = "0.1.0"
4452
+
edition = "2015"
4453
+
license = "MIT"
4454
+
description = "package b"
4455
+
repository = "https://github.com/test/package_b"
4456
+
"#,
4457
+
)
4458
+
.file("package_b/src/lib.rs","")
4459
+
.file(
4460
+
"package_c/Cargo.toml",
4461
+
r#"
4462
+
[package]
4463
+
name = "package_c"
4464
+
version = "0.1.0"
4465
+
edition = "2015"
4466
+
license = "MIT"
4467
+
description = "package c"
4468
+
repository = "https://github.com/test/package_c"
4469
+
4470
+
[dependencies]
4471
+
package_a = { version = "0.1.0", path = "../package_a" }
4472
+
"#,
4473
+
)
4474
+
.file("package_c/src/lib.rs","")
4475
+
.build();
4476
+
4477
+
// This demonstrates the current non-actionable error message
4478
+
// The user doesn't know which package failed or what packages remain to be published
[ERROR] failed to publish to registry at http://127.0.0.1:[..]/
4493
+
4494
+
Caused by:
4495
+
failed to get a 200 OK response, got 429
4496
+
headers:
4497
+
HTTP/1.1 429
4498
+
Content-Length: 172
4499
+
Connection: close
4500
+
Retry-After: 3600
4501
+
4502
+
body:
4503
+
You have published too many new crates in a short period of time. Please try again after Fri, 18 Jul 2025 20:00:34 GMT or email [email protected] to have your limit increased.
0 commit comments