refactor(tvix/store/pathinfo/from_addr): stop using gen_*_service
Remove usage of the gen_{blob,directory}_service() helper functions
from utils. We populate Memory{Blob,Directory}Services here directly, as
test_case and rstest doesn't compose well.
Change-Id: I0fb48aadb8c818f508b18ceb83c85eb91359442a
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11278
Reviewed-by: Connor Brewster <cbrewster@hey.com>
Tested-by: BuildkiteCI
This commit is contained in:
parent
1255916b5a
commit
ea257589d3
1 changed files with 10 additions and 7 deletions
|
|
@ -121,9 +121,13 @@ pub async fn from_addr(
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::from_addr;
|
use super::from_addr;
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
|
use std::sync::Arc;
|
||||||
use tempfile::TempDir;
|
use tempfile::TempDir;
|
||||||
use test_case::test_case;
|
use test_case::test_case;
|
||||||
use tvix_castore::utils::{gen_blob_service, gen_directory_service};
|
use tvix_castore::{
|
||||||
|
blobservice::{BlobService, MemoryBlobService},
|
||||||
|
directoryservice::{DirectoryService, MemoryDirectoryService},
|
||||||
|
};
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
static ref TMPDIR_SLED_1: TempDir = TempDir::new().unwrap();
|
static ref TMPDIR_SLED_1: TempDir = TempDir::new().unwrap();
|
||||||
|
|
@ -178,12 +182,11 @@ mod tests {
|
||||||
#[test_case("grpc+http://localhost/some-path", false; "grpc valid invalid host and path")]
|
#[test_case("grpc+http://localhost/some-path", false; "grpc valid invalid host and path")]
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn test_from_addr_tokio(uri_str: &str, exp_succeed: bool) {
|
async fn test_from_addr_tokio(uri_str: &str, exp_succeed: bool) {
|
||||||
let resp = from_addr(
|
let blob_service: Arc<dyn BlobService> = Arc::from(MemoryBlobService::default());
|
||||||
uri_str,
|
let directory_service: Arc<dyn DirectoryService> =
|
||||||
gen_blob_service().into(),
|
Arc::from(MemoryDirectoryService::default());
|
||||||
gen_directory_service().into(),
|
|
||||||
)
|
let resp = from_addr(uri_str, blob_service, directory_service).await;
|
||||||
.await;
|
|
||||||
|
|
||||||
if exp_succeed {
|
if exp_succeed {
|
||||||
resp.expect("should succeed");
|
resp.expect("should succeed");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue