Skip to content

Commit a496c71

Browse files
authored
tests/krate/publish/rate_limit: Increase rate limit duration (#9197)
... to decrease test flakiness. Ideally this test wouldn't rely on timings at all, but with rate limits and without an obvious way to control the clock that is unfortunately not straight-forward with the current implementation.
1 parent 39fa099 commit a496c71

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/tests/krate/publish/rate_limit.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,10 @@ async fn publish_new_crate_rate_limit_doesnt_affect_existing_crates() {
227227

228228
#[tokio::test(flavor = "multi_thread")]
229229
async fn publish_existing_crate_rate_limited() {
230+
const RATE_LIMIT: Duration = Duration::from_millis(1000);
231+
230232
let (app, anon, _, token) = TestApp::full()
231-
.with_rate_limit(LimitedAction::PublishUpdate, Duration::from_millis(500), 1)
233+
.with_rate_limit(LimitedAction::PublishUpdate, RATE_LIMIT, 1)
232234
.with_token();
233235

234236
// Upload a new crate
@@ -280,7 +282,7 @@ async fn publish_existing_crate_rate_limited() {
280282
"###);
281283

282284
// Wait for the limit to be up
283-
thread::sleep(Duration::from_millis(500));
285+
thread::sleep(RATE_LIMIT);
284286

285287
let crate_to_publish = PublishBuilder::new("rate_limited1", "1.0.2");
286288
token.publish_crate(crate_to_publish).await.good();

0 commit comments

Comments
 (0)