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:
parent
2546446d51
commit
d660c5dec8
1 changed files with 8 additions and 10 deletions
|
@ -5,9 +5,7 @@ use crate::tests::utils::*;
|
||||||
use sha2::{Digest, Sha256};
|
use sha2::{Digest, Sha256};
|
||||||
use std::io;
|
use std::io;
|
||||||
use tokio::io::sink;
|
use tokio::io::sink;
|
||||||
use tvix_castore::proto::DirectoryNode;
|
use tvix_castore::proto as castorepb;
|
||||||
use tvix_castore::proto::FileNode;
|
|
||||||
use tvix_castore::proto::{self as castorepb, SymlinkNode};
|
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn single_symlink() {
|
async fn single_symlink() {
|
||||||
|
@ -15,7 +13,7 @@ async fn single_symlink() {
|
||||||
|
|
||||||
write_nar(
|
write_nar(
|
||||||
&mut buf,
|
&mut buf,
|
||||||
&castorepb::node::Node::Symlink(SymlinkNode {
|
&castorepb::node::Node::Symlink(castorepb::SymlinkNode {
|
||||||
name: "doesntmatter".into(),
|
name: "doesntmatter".into(),
|
||||||
target: "/nix/store/somewhereelse".into(),
|
target: "/nix/store/somewhereelse".into(),
|
||||||
}),
|
}),
|
||||||
|
@ -34,7 +32,7 @@ async fn single_symlink() {
|
||||||
async fn single_file_missing_blob() {
|
async fn single_file_missing_blob() {
|
||||||
let e = write_nar(
|
let e = write_nar(
|
||||||
sink(),
|
sink(),
|
||||||
&castorepb::node::Node::File(FileNode {
|
&castorepb::node::Node::File(castorepb::FileNode {
|
||||||
name: "doesntmatter".into(),
|
name: "doesntmatter".into(),
|
||||||
digest: HELLOWORLD_BLOB_DIGEST.clone().into(),
|
digest: HELLOWORLD_BLOB_DIGEST.clone().into(),
|
||||||
size: HELLOWORLD_BLOB_CONTENTS.len() as u64,
|
size: HELLOWORLD_BLOB_CONTENTS.len() as u64,
|
||||||
|
@ -79,7 +77,7 @@ async fn single_file_wrong_blob_size() {
|
||||||
{
|
{
|
||||||
let e = write_nar(
|
let e = write_nar(
|
||||||
sink(),
|
sink(),
|
||||||
&castorepb::node::Node::File(FileNode {
|
&castorepb::node::Node::File(castorepb::FileNode {
|
||||||
name: "doesntmatter".into(),
|
name: "doesntmatter".into(),
|
||||||
digest: HELLOWORLD_BLOB_DIGEST.clone().into(),
|
digest: HELLOWORLD_BLOB_DIGEST.clone().into(),
|
||||||
size: 42, // <- note the wrong size here!
|
size: 42, // <- note the wrong size here!
|
||||||
|
@ -104,7 +102,7 @@ async fn single_file_wrong_blob_size() {
|
||||||
{
|
{
|
||||||
let e = write_nar(
|
let e = write_nar(
|
||||||
sink(),
|
sink(),
|
||||||
&castorepb::node::Node::File(FileNode {
|
&castorepb::node::Node::File(castorepb::FileNode {
|
||||||
name: "doesntmatter".into(),
|
name: "doesntmatter".into(),
|
||||||
digest: HELLOWORLD_BLOB_DIGEST.clone().into(),
|
digest: HELLOWORLD_BLOB_DIGEST.clone().into(),
|
||||||
size: 2, // <- note the wrong size here!
|
size: 2, // <- note the wrong size here!
|
||||||
|
@ -147,7 +145,7 @@ async fn single_file() {
|
||||||
|
|
||||||
write_nar(
|
write_nar(
|
||||||
&mut buf,
|
&mut buf,
|
||||||
&castorepb::node::Node::File(FileNode {
|
&castorepb::node::Node::File(castorepb::FileNode {
|
||||||
name: "doesntmatter".into(),
|
name: "doesntmatter".into(),
|
||||||
digest: HELLOWORLD_BLOB_DIGEST.clone().into(),
|
digest: HELLOWORLD_BLOB_DIGEST.clone().into(),
|
||||||
size: HELLOWORLD_BLOB_CONTENTS.len() as u64,
|
size: HELLOWORLD_BLOB_CONTENTS.len() as u64,
|
||||||
|
@ -194,7 +192,7 @@ async fn test_complicated() {
|
||||||
|
|
||||||
write_nar(
|
write_nar(
|
||||||
&mut buf,
|
&mut buf,
|
||||||
&castorepb::node::Node::Directory(DirectoryNode {
|
&castorepb::node::Node::Directory(castorepb::DirectoryNode {
|
||||||
name: "doesntmatter".into(),
|
name: "doesntmatter".into(),
|
||||||
digest: DIRECTORY_COMPLICATED.digest().into(),
|
digest: DIRECTORY_COMPLICATED.digest().into(),
|
||||||
size: DIRECTORY_COMPLICATED.size(),
|
size: DIRECTORY_COMPLICATED.size(),
|
||||||
|
@ -211,7 +209,7 @@ async fn test_complicated() {
|
||||||
let bs = blob_service.clone();
|
let bs = blob_service.clone();
|
||||||
let ds = directory_service.clone();
|
let ds = directory_service.clone();
|
||||||
let (nar_size, nar_digest) = calculate_size_and_sha256(
|
let (nar_size, nar_digest) = calculate_size_and_sha256(
|
||||||
&castorepb::node::Node::Directory(DirectoryNode {
|
&castorepb::node::Node::Directory(castorepb::DirectoryNode {
|
||||||
name: "doesntmatter".into(),
|
name: "doesntmatter".into(),
|
||||||
digest: DIRECTORY_COMPLICATED.digest().into(),
|
digest: DIRECTORY_COMPLICATED.digest().into(),
|
||||||
size: DIRECTORY_COMPLICATED.size(),
|
size: DIRECTORY_COMPLICATED.size(),
|
||||||
|
|
Loading…
Add table
Reference in a new issue