refactor(tvix/store/nar/import): use rstest fixtures from castore
This stops using the gen_{blob,directory}_service() functions from tvix_castore::utils in favor of the rstest-based fixtures. Change-Id: I4c2fff2926f34af63d3bd5c29c8e939dbdf7e062 Reviewed-on: https://cl.tvl.fyi/c/depot/+/11274 Reviewed-by: Connor Brewster <cbrewster@hey.com> Tested-by: BuildkiteCI
This commit is contained in:
parent
07a51c7dc9
commit
3cb9434605
1 changed files with 18 additions and 14 deletions
|
@ -223,6 +223,7 @@ mod test {
|
||||||
use std::io::Cursor;
|
use std::io::Cursor;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
use rstest::*;
|
||||||
use tokio_stream::StreamExt;
|
use tokio_stream::StreamExt;
|
||||||
use tvix_castore::blobservice::BlobService;
|
use tvix_castore::blobservice::BlobService;
|
||||||
use tvix_castore::directoryservice::DirectoryService;
|
use tvix_castore::directoryservice::DirectoryService;
|
||||||
|
@ -231,17 +232,18 @@ mod test {
|
||||||
HELLOWORLD_BLOB_DIGEST,
|
HELLOWORLD_BLOB_DIGEST,
|
||||||
};
|
};
|
||||||
use tvix_castore::proto as castorepb;
|
use tvix_castore::proto as castorepb;
|
||||||
use tvix_castore::utils::{gen_blob_service, gen_directory_service};
|
|
||||||
|
|
||||||
use crate::tests::fixtures::{
|
use crate::tests::fixtures::{
|
||||||
NAR_CONTENTS_COMPLICATED, NAR_CONTENTS_HELLOWORLD, NAR_CONTENTS_SYMLINK,
|
blob_service, directory_service, NAR_CONTENTS_COMPLICATED, NAR_CONTENTS_HELLOWORLD,
|
||||||
|
NAR_CONTENTS_SYMLINK,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[rstest]
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn single_symlink() {
|
async fn single_symlink(
|
||||||
let blob_service = gen_blob_service();
|
blob_service: Arc<dyn BlobService>,
|
||||||
let directory_service = gen_directory_service();
|
directory_service: Arc<dyn DirectoryService>,
|
||||||
|
) {
|
||||||
let handle = tokio::runtime::Handle::current();
|
let handle = tokio::runtime::Handle::current();
|
||||||
|
|
||||||
let root_node = handle
|
let root_node = handle
|
||||||
|
@ -265,11 +267,12 @@ mod test {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[rstest]
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn single_file() {
|
async fn single_file(
|
||||||
let blob_service: Arc<dyn BlobService> = gen_blob_service().into();
|
blob_service: Arc<dyn BlobService>,
|
||||||
let directory_service = gen_directory_service();
|
directory_service: Arc<dyn DirectoryService>,
|
||||||
|
) {
|
||||||
let handle = tokio::runtime::Handle::current();
|
let handle = tokio::runtime::Handle::current();
|
||||||
|
|
||||||
let root_node = handle
|
let root_node = handle
|
||||||
|
@ -301,11 +304,12 @@ mod test {
|
||||||
assert!(blob_service.has(&HELLOWORLD_BLOB_DIGEST).await.unwrap());
|
assert!(blob_service.has(&HELLOWORLD_BLOB_DIGEST).await.unwrap());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[rstest]
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn complicated() {
|
async fn complicated(
|
||||||
let blob_service: Arc<dyn BlobService> = gen_blob_service().into();
|
blob_service: Arc<dyn BlobService>,
|
||||||
let directory_service: Arc<dyn DirectoryService> = gen_directory_service().into();
|
directory_service: Arc<dyn DirectoryService>,
|
||||||
|
) {
|
||||||
let handle = tokio::runtime::Handle::current();
|
let handle = tokio::runtime::Handle::current();
|
||||||
|
|
||||||
let root_node = handle
|
let root_node = handle
|
||||||
|
|
Loading…
Reference in a new issue