about summary refs log tree commit diff
path: root/tvix/store/src/tests/nar_renderer.rs
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2023-07-18T16·37+0300
committerclbot <clbot@tvl.fyi>2023-07-21T19·01+0000
commit72e82ffcb11b1aaf1f1cc8db4189ced5ec0aa42e (patch)
treefbf51cd1d47df2f3341795fe6bcf8e0a95ccebef /tvix/store/src/tests/nar_renderer.rs
parent638f3e874d5eb6c157ffd065e593ee1a8a14d3e0 (diff)
refactor(tvix/store): use bytes for node names and symlink targets r/6436
Some paths might use names that are not valid UTF-8. We should be able
to represent them.

We don't actually need to touch the PathInfo structures, as they need to
represent StorePaths, which come with their own harder restrictions,
which can't encode non-UTF8 data.

While this doesn't change any of the wire format of the gRPC messages,
it does however change the interface of tvix_eval::EvalIO - its
read_dir() method does now return a list of Vec<u8>, rather than
SmolStr. Maybe this should be OsString instead?

Change-Id: I821016d9a58ec441ee081b0b9f01c9240723af0b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8974
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/store/src/tests/nar_renderer.rs')
-rw-r--r--tvix/store/src/tests/nar_renderer.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/tvix/store/src/tests/nar_renderer.rs b/tvix/store/src/tests/nar_renderer.rs
index b92fdc087b28..055538376b72 100644
--- a/tvix/store/src/tests/nar_renderer.rs
+++ b/tvix/store/src/tests/nar_renderer.rs
@@ -15,8 +15,8 @@ fn single_symlink() {
     write_nar(
         &mut buf,
         &crate::proto::node::Node::Symlink(SymlinkNode {
-            name: "doesntmatter".to_string(),
-            target: "/nix/store/somewhereelse".to_string(),
+            name: "doesntmatter".into(),
+            target: "/nix/store/somewhereelse".into(),
         }),
         // don't put anything in the stores, as we don't actually do any requests.
         gen_blob_service(),
@@ -35,7 +35,7 @@ fn single_file_missing_blob() {
     let e = write_nar(
         &mut buf,
         &crate::proto::node::Node::File(FileNode {
-            name: "doesntmatter".to_string(),
+            name: "doesntmatter".into(),
             digest: HELLOWORLD_BLOB_DIGEST.to_vec(),
             size: HELLOWORLD_BLOB_CONTENTS.len() as u32,
             executable: false,
@@ -76,7 +76,7 @@ fn single_file_wrong_blob_size() {
         let e = write_nar(
             &mut buf,
             &crate::proto::node::Node::File(FileNode {
-                name: "doesntmatter".to_string(),
+                name: "doesntmatter".into(),
                 digest: HELLOWORLD_BLOB_DIGEST.to_vec(),
                 size: 42, // <- note the wrong size here!
                 executable: false,
@@ -101,7 +101,7 @@ fn single_file_wrong_blob_size() {
         let e = write_nar(
             &mut buf,
             &crate::proto::node::Node::File(FileNode {
-                name: "doesntmatter".to_string(),
+                name: "doesntmatter".into(),
                 digest: HELLOWORLD_BLOB_DIGEST.to_vec(),
                 size: 2, // <- note the wrong size here!
                 executable: false,
@@ -138,7 +138,7 @@ fn single_file() {
     write_nar(
         &mut buf,
         &crate::proto::node::Node::File(FileNode {
-            name: "doesntmatter".to_string(),
+            name: "doesntmatter".into(),
             digest: HELLOWORLD_BLOB_DIGEST.to_vec(),
             size: HELLOWORLD_BLOB_CONTENTS.len() as u32,
             executable: false,
@@ -176,7 +176,7 @@ fn test_complicated() {
     write_nar(
         &mut buf,
         &crate::proto::node::Node::Directory(DirectoryNode {
-            name: "doesntmatter".to_string(),
+            name: "doesntmatter".into(),
             digest: DIRECTORY_COMPLICATED.digest().to_vec(),
             size: DIRECTORY_COMPLICATED.size(),
         }),
@@ -190,7 +190,7 @@ fn test_complicated() {
     // ensure calculate_nar does return the correct sha256 digest and sum.
     let (nar_size, nar_digest) = calculate_size_and_sha256(
         &crate::proto::node::Node::Directory(DirectoryNode {
-            name: "doesntmatter".to_string(),
+            name: "doesntmatter".into(),
             digest: DIRECTORY_COMPLICATED.digest().to_vec(),
             size: DIRECTORY_COMPLICATED.size(),
         }),