From 7fe7e03df32977da2bea7531a5142b24af971cf8 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Mon, 13 Feb 2023 18:58:10 +0100 Subject: chore(tvix/store): remove old implementations These were implementing against the (more complicated) gRPC interface, for which we now have a wrapper. Change-Id: I0a8284493718ab99618a1d21a76df4d173edb899 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8100 Reviewed-by: raitobezarius Tested-by: BuildkiteCI --- tvix/store/src/tests/path_info_service.rs | 67 ------------------------------- 1 file changed, 67 deletions(-) delete mode 100644 tvix/store/src/tests/path_info_service.rs (limited to 'tvix/store/src/tests/path_info_service.rs') diff --git a/tvix/store/src/tests/path_info_service.rs b/tvix/store/src/tests/path_info_service.rs deleted file mode 100644 index 42e6db36ca88..000000000000 --- a/tvix/store/src/tests/path_info_service.rs +++ /dev/null @@ -1,67 +0,0 @@ -use tempfile::TempDir; -use tonic::Request; - -use crate::proto::get_path_info_request::ByWhat::ByOutputHash; -use crate::proto::node::Node::Symlink; -use crate::proto::path_info_service_server::PathInfoService; -use crate::proto::PathInfo; -use crate::proto::{GetPathInfoRequest, Node, SymlinkNode}; -use crate::sled_path_info_service::SledPathInfoService; - -use lazy_static::lazy_static; - -lazy_static! { - static ref DUMMY_OUTPUT_HASH: Vec = vec![ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00 - ]; -} - -/// Trying to get a non-existent PathInfo should return a not found error. -#[tokio::test] -async fn not_found() -> anyhow::Result<()> { - let service = SledPathInfoService::new(TempDir::new()?.path().to_path_buf())?; - - let resp = service - .get(Request::new(GetPathInfoRequest { - by_what: Some(ByOutputHash(DUMMY_OUTPUT_HASH.to_vec())), - })) - .await; - - let resp = resp.expect_err("must fail"); - assert_eq!(resp.code(), tonic::Code::NotFound); - - Ok(()) -} - -/// Put a PathInfo into the store, get it back. -#[tokio::test] -async fn put_get() -> anyhow::Result<()> { - let service = SledPathInfoService::new(TempDir::new()?.path().to_path_buf())?; - - let path_info = PathInfo { - node: Some(Node { - node: Some(Symlink(SymlinkNode { - name: "00000000000000000000000000000000-foo".to_string(), - target: "doesntmatter".to_string(), - })), - }), - ..Default::default() - }; - - let resp = service.put(Request::new(path_info.clone())).await; - - assert!(resp.is_ok()); - assert_eq!(resp.expect("must succeed").into_inner(), path_info); - - let resp = service - .get(Request::new(GetPathInfoRequest { - by_what: Some(ByOutputHash(DUMMY_OUTPUT_HASH.to_vec())), - })) - .await; - - assert!(resp.is_ok()); - assert_eq!(resp.expect("must succeed").into_inner(), path_info); - - Ok(()) -} -- cgit 1.4.1