about summary refs log tree commit diff
path: root/tvix/derivation/src/tests/mod.rs
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2023-01-04T12·38+0100
committerflokli <flokli@flokli.de>2023-01-04T21·58+0000
commitcc626d686cceed84e45d21bf32514a3a3f8e2b11 (patch)
tree8a211983e216149207a240713ff95ab0a662d173 /tvix/derivation/src/tests/mod.rs
parent407a9cd90f3a1ea3bb0cf4ced85cfacb29881b0c (diff)
feat(tvix/derivation): implement Derivation::validate() r/5591
Change-Id: I87dfadda872439e108e5f678a5da63dd5b1915d1
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7732
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/derivation/src/tests/mod.rs')
-rw-r--r--tvix/derivation/src/tests/mod.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/tvix/derivation/src/tests/mod.rs b/tvix/derivation/src/tests/mod.rs
index 435d82144067..1b55c6e3e751 100644
--- a/tvix/derivation/src/tests/mod.rs
+++ b/tvix/derivation/src/tests/mod.rs
@@ -31,6 +31,16 @@ fn check_serizaliation(path_to_drv_file: &str) {
 }
 
 #[test_resources("src/tests/derivation_tests/*.drv")]
+fn validate(path_to_drv_file: &str) {
+    let data = read_file(&format!("{}.json", path_to_drv_file));
+    let derivation: Derivation = serde_json::from_str(&data).expect("JSON was not well-formatted");
+
+    derivation
+        .validate()
+        .expect("derivation failed to validate")
+}
+
+#[test_resources("src/tests/derivation_tests/*.drv")]
 fn check_to_string(path_to_drv_file: &str) {
     let data = read_file(&format!("{}.json", path_to_drv_file));
     let derivation: Derivation = serde_json::from_str(&data).expect("JSON was not well-formatted");