test(tvix/nar-bridge): add NARInfo handler tests

Change-Id: I245ab38c30bb27c941274b2621aecccb695dacd0
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12918
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
This commit is contained in:
Florian Klink 2024-12-26 12:08:47 +01:00 committed by clbot
parent 30b631ea72
commit 6e4f067054
2 changed files with 175 additions and 0 deletions

View file

@ -1,4 +1,5 @@
use crate::pathinfoservice::PathInfo;
use md5::Digest;
use nix_compat::nixhash::{CAHash, NixHash};
use nix_compat::store_path::StorePath;
use std::sync::LazyLock;
@ -140,3 +141,17 @@ pub static PATH_INFO: LazyLock<PathInfo> = LazyLock::new(|| PathInfo {
deriver: None,
ca: Some(CAHash::Nar(NixHash::Sha256([0; 32]))),
});
/// A PathInfo message for the store path with CASTORE_NODE_SYMLINK as root node.
pub static PATH_INFO_SYMLINK: LazyLock<PathInfo> = LazyLock::new(|| PathInfo {
store_path: DUMMY_PATH.clone(),
node: CASTORE_NODE_SYMLINK.clone(),
references: vec![],
nar_size: NAR_CONTENTS_SYMLINK.len() as u64,
nar_sha256: sha2::Sha256::new_with_prefix(NAR_CONTENTS_SYMLINK.as_slice())
.finalize()
.into(),
signatures: vec![],
deriver: None,
ca: None,
});