From 7f8e40c19f1e04623138ffcf98c7beebbf2284f3 Mon Sep 17 00:00:00 2001 From: Brian Picciano Date: Thu, 3 Aug 2023 10:02:03 +0200 Subject: [PATCH] Fixed tests for git and acme::store --- src/domain/acme/store.rs | 4 ++-- src/origin/git.rs | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/domain/acme/store.rs b/src/domain/acme/store.rs index 8887b62..5f1ad27 100644 --- a/src/domain/acme/store.rs +++ b/src/domain/acme/store.rs @@ -166,7 +166,7 @@ impl Store for FSStore { #[cfg(test)] mod tests { use super::*; - use crate::domain::acme; + use crate::domain::tls; use tempdir::TempDir; #[test] @@ -179,7 +179,7 @@ mod tests { Err::(GetAccountKeyError::NotFound) )); - let k = acme::PrivateKey::new(); + let k = tls::PrivateKey::new(); store.set_account_key(&k).expect("account private key set"); diff --git a/src/origin/git.rs b/src/origin/git.rs index 6535be4..090ad09 100644 --- a/src/origin/git.rs +++ b/src/origin/git.rs @@ -379,9 +379,15 @@ mod tests { }; let assert_file_not_empty = |path: &str| { - let f = store.get_file(&descr, path).expect("file not retrieved"); + use bytes::BufMut; + + let mut f = store.get_file(&descr, path).expect("file not retrieved"); + let mut body = bytes::BytesMut::new(); + async move { - let body = f.map(|r| r.unwrap()).concat().await; + while let Some(chunk) = f.next().await { + body.put(chunk.unwrap()) + } assert!(body.len() > 0); } };