From d660c5dec83e4eda9363bff924ebca171a49c82a Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Sun, 5 Nov 2023 14:02:20 +0200 Subject: refactor(tvix/store/tests/nar_renderer): use castorepb consistently Change-Id: I40f33044c838a7cfb9b3665fdea8e70e6886343e Reviewed-on: https://cl.tvl.fyi/c/depot/+/9953 Reviewed-by: raitobezarius Tested-by: BuildkiteCI --- tvix/store/src/tests/nar_renderer.rs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'tvix/store') diff --git a/tvix/store/src/tests/nar_renderer.rs b/tvix/store/src/tests/nar_renderer.rs index b57b58ec52dd..b92739552ce7 100644 --- a/tvix/store/src/tests/nar_renderer.rs +++ b/tvix/store/src/tests/nar_renderer.rs @@ -5,9 +5,7 @@ use crate::tests::utils::*; use sha2::{Digest, Sha256}; use std::io; use tokio::io::sink; -use tvix_castore::proto::DirectoryNode; -use tvix_castore::proto::FileNode; -use tvix_castore::proto::{self as castorepb, SymlinkNode}; +use tvix_castore::proto as castorepb; #[tokio::test] async fn single_symlink() { @@ -15,7 +13,7 @@ async fn single_symlink() { write_nar( &mut buf, - &castorepb::node::Node::Symlink(SymlinkNode { + &castorepb::node::Node::Symlink(castorepb::SymlinkNode { name: "doesntmatter".into(), target: "/nix/store/somewhereelse".into(), }), @@ -34,7 +32,7 @@ async fn single_symlink() { async fn single_file_missing_blob() { let e = write_nar( sink(), - &castorepb::node::Node::File(FileNode { + &castorepb::node::Node::File(castorepb::FileNode { name: "doesntmatter".into(), digest: HELLOWORLD_BLOB_DIGEST.clone().into(), size: HELLOWORLD_BLOB_CONTENTS.len() as u64, @@ -79,7 +77,7 @@ async fn single_file_wrong_blob_size() { { let e = write_nar( sink(), - &castorepb::node::Node::File(FileNode { + &castorepb::node::Node::File(castorepb::FileNode { name: "doesntmatter".into(), digest: HELLOWORLD_BLOB_DIGEST.clone().into(), size: 42, // <- note the wrong size here! @@ -104,7 +102,7 @@ async fn single_file_wrong_blob_size() { { let e = write_nar( sink(), - &castorepb::node::Node::File(FileNode { + &castorepb::node::Node::File(castorepb::FileNode { name: "doesntmatter".into(), digest: HELLOWORLD_BLOB_DIGEST.clone().into(), size: 2, // <- note the wrong size here! @@ -147,7 +145,7 @@ async fn single_file() { write_nar( &mut buf, - &castorepb::node::Node::File(FileNode { + &castorepb::node::Node::File(castorepb::FileNode { name: "doesntmatter".into(), digest: HELLOWORLD_BLOB_DIGEST.clone().into(), size: HELLOWORLD_BLOB_CONTENTS.len() as u64, @@ -194,7 +192,7 @@ async fn test_complicated() { write_nar( &mut buf, - &castorepb::node::Node::Directory(DirectoryNode { + &castorepb::node::Node::Directory(castorepb::DirectoryNode { name: "doesntmatter".into(), digest: DIRECTORY_COMPLICATED.digest().into(), size: DIRECTORY_COMPLICATED.size(), @@ -211,7 +209,7 @@ async fn test_complicated() { let bs = blob_service.clone(); let ds = directory_service.clone(); let (nar_size, nar_digest) = calculate_size_and_sha256( - &castorepb::node::Node::Directory(DirectoryNode { + &castorepb::node::Node::Directory(castorepb::DirectoryNode { name: "doesntmatter".into(), digest: DIRECTORY_COMPLICATED.digest().into(), size: DIRECTORY_COMPLICATED.size(), -- cgit 1.4.1