aboutsummaryrefslogtreecommitdiff
path: root/src/garage/tests/k2v
diff options
context:
space:
mode:
authorAlex <alex@adnab.me>2024-02-07 14:59:40 +0000
committerAlex <alex@adnab.me>2024-02-07 14:59:40 +0000
commit5d941e0100489fff552b59f0679a2a010403a21c (patch)
tree5c5cef9af72d48dd7347922341e43f0013380c60 /src/garage/tests/k2v
parentfeeb076b7f5db7fe6fdbe3d2903fae054cde6219 (diff)
parente011941964b1c1e0b90f85014d166d64a83ae8e2 (diff)
downloadgarage-5d941e0100489fff552b59f0679a2a010403a21c.tar.gz
garage-5d941e0100489fff552b59f0679a2a010403a21c.zip
Merge pull request 'Dependency upgrades: http, hyper, aws-sdk, smaller deps' (#703) from dep-upgrade-202402 into main
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/703
Diffstat (limited to 'src/garage/tests/k2v')
-rw-r--r--src/garage/tests/k2v/batch.rs6
-rw-r--r--src/garage/tests/k2v/item.rs21
-rw-r--r--src/garage/tests/k2v/poll.rs15
-rw-r--r--src/garage/tests/k2v/simple.rs8
4 files changed, 15 insertions, 35 deletions
diff --git a/src/garage/tests/k2v/batch.rs b/src/garage/tests/k2v/batch.rs
index 71de91bf..39554d4d 100644
--- a/src/garage/tests/k2v/batch.rs
+++ b/src/garage/tests/k2v/batch.rs
@@ -7,6 +7,7 @@ use base64::prelude::*;
use serde_json::json;
use crate::json_body;
+use http_body_util::BodyExt;
use hyper::{Method, StatusCode};
#[tokio::test]
@@ -77,10 +78,7 @@ async fn test_batch() {
.unwrap()
.to_string(),
);
- let res_body = hyper::body::to_bytes(res.into_body())
- .await
- .unwrap()
- .to_vec();
+ let res_body = res.into_body().collect().await.unwrap().to_bytes();
assert_eq!(res_body, values.get(sk).unwrap().as_bytes());
}
diff --git a/src/garage/tests/k2v/item.rs b/src/garage/tests/k2v/item.rs
index 20add889..5a347bd9 100644
--- a/src/garage/tests/k2v/item.rs
+++ b/src/garage/tests/k2v/item.rs
@@ -7,6 +7,7 @@ use base64::prelude::*;
use serde_json::json;
use crate::json_body;
+use http_body_util::BodyExt;
use hyper::{Method, StatusCode};
#[tokio::test]
@@ -83,10 +84,7 @@ async fn test_items_and_indices() {
.to_str()
.unwrap()
.to_string();
- let res_body = hyper::body::to_bytes(res.into_body())
- .await
- .unwrap()
- .to_vec();
+ let res_body = res.into_body().collect().await.unwrap().to_bytes();
assert_eq!(res_body, content);
// ReadIndex -- now there should be some stuff
@@ -152,10 +150,7 @@ async fn test_items_and_indices() {
res.headers().get("content-type").unwrap().to_str().unwrap(),
"application/octet-stream"
);
- let res_body = hyper::body::to_bytes(res.into_body())
- .await
- .unwrap()
- .to_vec();
+ let res_body = res.into_body().collect().await.unwrap().to_bytes();
assert_eq!(res_body, content2);
// ReadIndex -- now there should be some stuff
@@ -394,10 +389,7 @@ async fn test_item_return_format() {
.to_str()
.unwrap()
.to_string();
- let res_body = hyper::body::to_bytes(res.into_body())
- .await
- .unwrap()
- .to_vec();
+ let res_body = res.into_body().collect().await.unwrap().to_bytes();
assert_eq!(res_body, single_value);
// f1: not specified
@@ -434,10 +426,7 @@ async fn test_item_return_format() {
res.headers().get("content-type").unwrap().to_str().unwrap(),
"application/octet-stream"
);
- let res_body = hyper::body::to_bytes(res.into_body())
- .await
- .unwrap()
- .to_vec();
+ let res_body = res.into_body().collect().await.unwrap().to_bytes();
assert_eq!(res_body, single_value);
// f3: json
diff --git a/src/garage/tests/k2v/poll.rs b/src/garage/tests/k2v/poll.rs
index 452317c2..277f8bc8 100644
--- a/src/garage/tests/k2v/poll.rs
+++ b/src/garage/tests/k2v/poll.rs
@@ -1,4 +1,5 @@
use base64::prelude::*;
+use http_body_util::BodyExt;
use hyper::{Method, StatusCode};
use std::time::Duration;
@@ -47,11 +48,8 @@ async fn test_poll_item() {
.unwrap()
.to_string();
- let res2_body = hyper::body::to_bytes(res2.into_body())
- .await
- .unwrap()
- .to_vec();
- assert_eq!(res2_body, b"Initial value");
+ let res2_body = res2.into_body().collect().await.unwrap().to_bytes();
+ assert_eq!(res2_body, b"Initial value"[..]);
// Start poll operation
let poll = {
@@ -95,11 +93,8 @@ async fn test_poll_item() {
assert_eq!(poll_res.status(), StatusCode::OK);
- let poll_res_body = hyper::body::to_bytes(poll_res.into_body())
- .await
- .unwrap()
- .to_vec();
- assert_eq!(poll_res_body, b"New value");
+ let poll_res_body = poll_res.into_body().collect().await.unwrap().to_bytes();
+ assert_eq!(poll_res_body, b"New value"[..]);
}
#[tokio::test]
diff --git a/src/garage/tests/k2v/simple.rs b/src/garage/tests/k2v/simple.rs
index 465fc24d..1017330d 100644
--- a/src/garage/tests/k2v/simple.rs
+++ b/src/garage/tests/k2v/simple.rs
@@ -1,5 +1,6 @@
use crate::common;
+use http_body_util::BodyExt;
use hyper::{Method, StatusCode};
#[tokio::test]
@@ -32,9 +33,6 @@ async fn test_simple() {
.unwrap();
assert_eq!(res2.status(), StatusCode::OK);
- let res2_body = hyper::body::to_bytes(res2.into_body())
- .await
- .unwrap()
- .to_vec();
- assert_eq!(res2_body, b"Hello, world!");
+ let res2_body = res2.into_body().collect().await.unwrap().to_bytes();
+ assert_eq!(res2_body, b"Hello, world!"[..]);
}