about summary refs log tree commit diff
path: root/tvix/store/src/tests
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2023-03-15T23·01+0100
committerflokli <flokli@flokli.de>2023-03-16T13·47+0000
commitee23220564987771c8e7909ded6fb9853f1d1b0d (patch)
treeb1c99097c8912642c9f3582adebff49f9caa3093 /tvix/store/src/tests
parent9c08cbc9732710a0003cb7bbe0ff7a9950fc22b6 (diff)
refactor(tvix/store/directorysvc): use [u8; 32] instead of Vec<u8> r/6014
Also, simplify the trait interface, only allowing lookups of Directory
objects by their digest.

Change-Id: I6eec28a8cb0557bed9b69df8b8ff99a5e0f8fe35
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8313
Tested-by: BuildkiteCI
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: tazjin <tazjin@tvl.su>
Diffstat (limited to 'tvix/store/src/tests')
-rw-r--r--tvix/store/src/tests/fixtures.rs8
-rw-r--r--tvix/store/src/tests/import.rs10
-rw-r--r--tvix/store/src/tests/nar_renderer.rs2
3 files changed, 8 insertions, 12 deletions
diff --git a/tvix/store/src/tests/fixtures.rs b/tvix/store/src/tests/fixtures.rs
index 10ce7f3dc4e2..6d38dd45729d 100644
--- a/tvix/store/src/tests/fixtures.rs
+++ b/tvix/store/src/tests/fixtures.rs
@@ -39,7 +39,7 @@ lazy_static! {
     pub static ref DIRECTORY_COMPLICATED: proto::Directory = proto::Directory {
         directories: vec![DirectoryNode {
             name: "keep".to_string(),
-            digest: DIRECTORY_WITH_KEEP.digest(),
+            digest: DIRECTORY_WITH_KEEP.digest().to_vec(),
             size: DIRECTORY_WITH_KEEP.size(),
         }],
         files: vec![FileNode {
@@ -57,7 +57,7 @@ lazy_static! {
     pub static ref DIRECTORY_B: Directory = Directory {
         directories: vec![DirectoryNode {
             name: "a".to_string(),
-            digest: DIRECTORY_A.digest(),
+            digest: DIRECTORY_A.digest().to_vec(),
             size: DIRECTORY_A.size(),
         }],
         ..Default::default()
@@ -66,12 +66,12 @@ lazy_static! {
         directories: vec![
             DirectoryNode {
                 name: "a".to_string(),
-                digest: DIRECTORY_A.digest(),
+                digest: DIRECTORY_A.digest().to_vec(),
                 size: DIRECTORY_A.size(),
             },
             DirectoryNode {
                 name: "a'".to_string(),
-                digest: DIRECTORY_A.digest(),
+                digest: DIRECTORY_A.digest().to_vec(),
                 size: DIRECTORY_A.size(),
             }
         ],
diff --git a/tvix/store/src/tests/import.rs b/tvix/store/src/tests/import.rs
index 63ca1efa13f3..3a48df9e33c8 100644
--- a/tvix/store/src/tests/import.rs
+++ b/tvix/store/src/tests/import.rs
@@ -106,7 +106,7 @@ fn complicated() {
                 .unwrap()
                 .to_string_lossy()
                 .to_string(),
-            digest: DIRECTORY_COMPLICATED.digest(),
+            digest: DIRECTORY_COMPLICATED.digest().to_vec(),
             size: DIRECTORY_COMPLICATED.size(),
         }),
         root_node,
@@ -114,15 +114,11 @@ fn complicated() {
 
     // ensure DIRECTORY_WITH_KEEP and DIRECTORY_COMPLICATED have been uploaded
     assert!(directory_service
-        .get(&proto::get_directory_request::ByWhat::Digest(
-            DIRECTORY_WITH_KEEP.digest()
-        ))
+        .get(&DIRECTORY_WITH_KEEP.digest())
         .unwrap()
         .is_some());
     assert!(directory_service
-        .get(&proto::get_directory_request::ByWhat::Digest(
-            DIRECTORY_COMPLICATED.digest()
-        ))
+        .get(&DIRECTORY_COMPLICATED.digest())
         .unwrap()
         .is_some());
 
diff --git a/tvix/store/src/tests/nar_renderer.rs b/tvix/store/src/tests/nar_renderer.rs
index 2b5b4f705c64..056cfaf5fb11 100644
--- a/tvix/store/src/tests/nar_renderer.rs
+++ b/tvix/store/src/tests/nar_renderer.rs
@@ -198,7 +198,7 @@ fn test_complicated() {
             &mut buf,
             crate::proto::node::Node::Directory(DirectoryNode {
                 name: "doesntmatter".to_string(),
-                digest: DIRECTORY_COMPLICATED.digest(),
+                digest: DIRECTORY_COMPLICATED.digest().to_vec(),
                 size: DIRECTORY_COMPLICATED.size(),
             }),
         )