refactor(tvix/store/tests/nar_renderer): use castorepb consistently

Change-Id: I40f33044c838a7cfb9b3665fdea8e70e6886343e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9953
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Tested-by: BuildkiteCI
This commit is contained in:
Florian Klink 2023-11-05 14:02:20 +02:00 committed by flokli
parent 2546446d51
commit d660c5dec8

View file

@ -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(),