refactor(tvix/store): expose fixtures, make NAR_CONTENTS const

Allow reusing CASTORE_NODE_* and NAR_CONTENTS_* from other crates.

Also, there's no need for NAR_CONTENTS_* to be Vecs of bytes, these can
just be [u8; _].

Change-Id: I435c08a9d20f6a68266d0c9a70bfc7fdb618ce42
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12915
Tested-by: BuildkiteCI
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
This commit is contained in:
Florian Klink 2024-11-24 18:34:31 +02:00 committed by clbot
parent b2a2225b8b
commit 7c0c270932
12 changed files with 200 additions and 187 deletions

View file

@ -109,8 +109,8 @@ mod test {
use std::num::NonZeroUsize;
use crate::{
fixtures::PATH_INFO,
pathinfoservice::{LruPathInfoService, MemoryPathInfoService, PathInfoService},
tests::fixtures::PATH_INFO,
};
/// Helper function setting up an instance of a "far" and "near"

View file

@ -187,7 +187,6 @@ impl ServiceBuilder for GRPCPathInfoServiceConfig {
mod tests {
use crate::pathinfoservice::tests::make_grpc_path_info_service_client;
use crate::pathinfoservice::PathInfoService;
use crate::tests::fixtures;
/// This ensures connecting via gRPC works as expected.
#[tokio::test]
@ -196,7 +195,7 @@ mod tests {
make_grpc_path_info_service_client().await;
let path_info = path_info_service
.get(fixtures::DUMMY_PATH_DIGEST)
.get(crate::fixtures::DUMMY_PATH_DIGEST)
.await
.expect("must not be error");

View file

@ -94,8 +94,8 @@ mod test {
use std::{num::NonZeroUsize, sync::LazyLock};
use crate::{
fixtures::PATH_INFO,
pathinfoservice::{LruPathInfoService, PathInfo, PathInfoService},
tests::fixtures::PATH_INFO,
};
static PATHINFO_2: LazyLock<PathInfo> = LazyLock::new(|| {
let mut p = PATH_INFO.clone();

View file

@ -144,7 +144,7 @@ pub const DUMMY_VERIFYING_KEY: &str = "do.not.use:cuXqnuzlWfGTKmfzBPx2kXShjRryZM
#[cfg(test)]
mod test {
use crate::{pathinfoservice::PathInfoService, tests::fixtures::PATH_INFO};
use crate::{fixtures::PATH_INFO, pathinfoservice::PathInfoService};
use nix_compat::narinfo::VerifyingKey;
#[tokio::test]

View file

@ -7,11 +7,10 @@ use rstest::*;
use rstest_reuse::{self, *};
use super::{PathInfo, PathInfoService};
use crate::fixtures::{DUMMY_PATH_DIGEST, PATH_INFO};
use crate::pathinfoservice::redb::RedbPathInfoService;
use crate::pathinfoservice::MemoryPathInfoService;
use crate::tests::fixtures::{DUMMY_PATH_DIGEST, PATH_INFO};
use crate::pathinfoservice::test_signing_service;
use crate::pathinfoservice::MemoryPathInfoService;
mod utils;
pub use self::utils::make_grpc_path_info_service_client;