add tests and mocks

This commit is contained in:
mpostma
2021-03-23 16:19:01 +01:00
parent 3cc3637e2d
commit 46293546f3
9 changed files with 273 additions and 23 deletions

View File

@ -12,6 +12,9 @@ use actor::UuidResolverActor;
use message::UuidResolveMsg;
use store::{HeedUuidStore, UuidStore};
#[cfg(test)]
use mockall::automock;
pub use handle_impl::UuidResolverHandleImpl;
const UUID_STORE_SIZE: usize = 1_073_741_824; //1GiB
@ -19,6 +22,7 @@ const UUID_STORE_SIZE: usize = 1_073_741_824; //1GiB
pub type Result<T> = std::result::Result<T, UuidError>;
#[async_trait::async_trait]
#[cfg_attr(test, automock)]
pub trait UuidResolverHandle {
async fn resolve(&self, name: String) -> anyhow::Result<Uuid>;
async fn get_or_create(&self, name: String) -> Result<Uuid>;