chore(tvix/store): use lazy_static and dummy digests

While there's currently nothing in here checking the size of the digest,
we should use something that passes the to-be-introduced validate()
function.

Change-Id: I0c515d9e3afc79292dedebce659a32485aa3d936
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7649
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
This commit is contained in:
Florian Klink 2022-12-27 17:41:31 +01:00 committed by flokli
parent dfd9286f68
commit 35b18b2fdb
4 changed files with 16 additions and 2 deletions

View file

@ -24,7 +24,15 @@ impl Directory {
#[cfg(test)]
mod tests {
use super::{Directory, DirectoryNode, FileNode, SymlinkNode};
use lazy_static::lazy_static;
lazy_static! {
static ref DUMMY_DIGEST: Vec<u8> = vec![
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
];
}
#[test]
fn test_directory_size() {
{
@ -51,7 +59,7 @@ mod tests {
let d = Directory {
directories: vec![DirectoryNode {
name: String::from("foo"),
digest: vec![],
digest: DUMMY_DIGEST.to_vec(),
size: 4,
}],
files: vec![],
@ -64,7 +72,7 @@ mod tests {
directories: vec![],
files: vec![FileNode {
name: String::from("foo"),
digest: vec![],
digest: DUMMY_DIGEST.to_vec(),
size: 42,
executable: false,
}],