aboutsummaryrefslogtreecommitdiff
path: root/src/garage/tests/k2v
diff options
context:
space:
mode:
Diffstat (limited to 'src/garage/tests/k2v')
-rw-r--r--src/garage/tests/k2v/batch.rs2
-rw-r--r--src/garage/tests/k2v/item.rs11
-rw-r--r--src/garage/tests/k2v/mod.rs13
-rw-r--r--src/garage/tests/k2v/poll.rs2
4 files changed, 8 insertions, 20 deletions
diff --git a/src/garage/tests/k2v/batch.rs b/src/garage/tests/k2v/batch.rs
index 595d0ba8..71de91bf 100644
--- a/src/garage/tests/k2v/batch.rs
+++ b/src/garage/tests/k2v/batch.rs
@@ -6,7 +6,7 @@ use assert_json_diff::assert_json_eq;
use base64::prelude::*;
use serde_json::json;
-use super::json_body;
+use crate::json_body;
use hyper::{Method, StatusCode};
#[tokio::test]
diff --git a/src/garage/tests/k2v/item.rs b/src/garage/tests/k2v/item.rs
index 588836c7..20add889 100644
--- a/src/garage/tests/k2v/item.rs
+++ b/src/garage/tests/k2v/item.rs
@@ -6,7 +6,7 @@ use assert_json_diff::assert_json_eq;
use base64::prelude::*;
use serde_json::json;
-use super::json_body;
+use crate::json_body;
use hyper::{Method, StatusCode};
#[tokio::test]
@@ -44,6 +44,7 @@ async fn test_items_and_indices() {
let content = format!("{}: hello world", sk).into_bytes();
let content2 = format!("{}: hello universe", sk).into_bytes();
let content3 = format!("{}: concurrent value", sk).into_bytes();
+ eprintln!("test iteration {}: {}", i, sk);
// Put initially, no causality token
let res = ctx
@@ -89,7 +90,7 @@ async fn test_items_and_indices() {
assert_eq!(res_body, content);
// ReadIndex -- now there should be some stuff
- tokio::time::sleep(Duration::from_secs(1)).await;
+ tokio::time::sleep(Duration::from_millis(100)).await;
let res = ctx
.k2v
.request
@@ -158,7 +159,7 @@ async fn test_items_and_indices() {
assert_eq!(res_body, content2);
// ReadIndex -- now there should be some stuff
- tokio::time::sleep(Duration::from_secs(1)).await;
+ tokio::time::sleep(Duration::from_millis(100)).await;
let res = ctx
.k2v
.request
@@ -230,7 +231,7 @@ async fn test_items_and_indices() {
);
// ReadIndex -- now there should be some stuff
- tokio::time::sleep(Duration::from_secs(1)).await;
+ tokio::time::sleep(Duration::from_millis(100)).await;
let res = ctx
.k2v
.request
@@ -299,7 +300,7 @@ async fn test_items_and_indices() {
assert_eq!(res.status(), StatusCode::NO_CONTENT);
// ReadIndex -- now there should be some stuff
- tokio::time::sleep(Duration::from_secs(1)).await;
+ tokio::time::sleep(Duration::from_millis(100)).await;
let res = ctx
.k2v
.request
diff --git a/src/garage/tests/k2v/mod.rs b/src/garage/tests/k2v/mod.rs
index a009460e..241e3dc2 100644
--- a/src/garage/tests/k2v/mod.rs
+++ b/src/garage/tests/k2v/mod.rs
@@ -3,16 +3,3 @@ pub mod errorcodes;
pub mod item;
pub mod poll;
pub mod simple;
-
-use hyper::{Body, Response};
-
-pub async fn json_body(res: Response<Body>) -> serde_json::Value {
- let res_body: serde_json::Value = serde_json::from_slice(
- &hyper::body::to_bytes(res.into_body())
- .await
- .unwrap()
- .to_vec()[..],
- )
- .unwrap();
- res_body
-}
diff --git a/src/garage/tests/k2v/poll.rs b/src/garage/tests/k2v/poll.rs
index dd44aed9..452317c2 100644
--- a/src/garage/tests/k2v/poll.rs
+++ b/src/garage/tests/k2v/poll.rs
@@ -5,8 +5,8 @@ use std::time::Duration;
use assert_json_diff::assert_json_eq;
use serde_json::json;
-use super::json_body;
use crate::common;
+use crate::json_body;
#[tokio::test]
async fn test_poll_item() {