Skip to content

Commit

Permalink
Update limit test
Browse files Browse the repository at this point in the history
  • Loading branch information
tustvold committed Oct 17, 2023
1 parent 035ae9b commit 3246471
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions object_store/src/limit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,20 +290,15 @@ mod tests {
rename_and_copy(&integration).await;
stream_get(&integration).await;

let mut futures = Vec::with_capacity(max_requests);
for _ in 0..max_requests {
let stream = integration.list_with_delimiter(None);
futures.push(stream);
}

let t = Duration::from_millis(20);
let _permits = integration.semaphore.acquire_many(9).await.unwrap();
let droppable = integration.semaphore.acquire().await.unwrap();

// Expect to not be able to make another request
let t = Duration::from_millis(20);
let fut = integration.list(None).collect::<Vec<_>>();
assert!(timeout(t, fut).await.is_err());

// Drop one of the futures
futures.pop();
drop(droppable);

// Can now make another request
integration.list(None).collect::<Vec<_>>().await;
Expand Down

0 comments on commit 3246471

Please sign in to comment.