about summary refs log tree commit diff
path: root/tvix
diff options
context:
space:
mode:
authorBrian Olsen <brian@maven-group.org>2024-11-03T19·18+0100
committerclbot <clbot@tvl.fyi>2024-11-03T23·43+0000
commit685f25ebff8e676d16e4de5f86d4ad2845fef23d (patch)
tree5afac4badc181adda5b89270fd60a79b78f154cc /tvix
parent6f914bc0fa6aa480fed6c500dc0ee26eaefbf1b6 (diff)
fix(tvix/build): Fix tests and clippy warnings on MacOS r/8886
When running tests for buildservice on MacOS it would fail
because of the oci test. I also got some clippy warnings on
MacOS because of disabled code.

Change-Id: I235739fa4270a4ef46e54d3e2b8cbb55eb20bdda
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12726
Reviewed-by: flokli <flokli@flokli.de>
Autosubmit: Brian Olsen <me@griff.name>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix')
-rw-r--r--tvix/build/src/buildservice/from_addr.rs11
1 files changed, 8 insertions, 3 deletions
diff --git a/tvix/build/src/buildservice/from_addr.rs b/tvix/build/src/buildservice/from_addr.rs
index ba185bb25514..c88eef2bbdb8 100644
--- a/tvix/build/src/buildservice/from_addr.rs
+++ b/tvix/build/src/buildservice/from_addr.rs
@@ -14,6 +14,7 @@ use super::oci::OCIBuildService;
 ///
 /// As some of these [BuildService] need to talk to a [BlobService] and
 /// [DirectoryService], these also need to be passed in.
+#[cfg_attr(target_os = "macos", allow(unused_variables))]
 pub async fn from_addr<BS, DS>(
     uri: &str,
     blob_service: BS,
@@ -68,13 +69,17 @@ where
 mod tests {
     use super::from_addr;
     use rstest::rstest;
-    use std::sync::{Arc, LazyLock};
+    use std::sync::Arc;
+    #[cfg(target_os = "linux")]
+    use std::sync::LazyLock;
+    #[cfg(target_os = "linux")]
     use tempfile::TempDir;
     use tvix_castore::{
         blobservice::{BlobService, MemoryBlobService},
         directoryservice::{DirectoryService, MemoryDirectoryService},
     };
 
+    #[cfg(target_os = "linux")]
     static TMPDIR_OCI_1: LazyLock<TempDir> = LazyLock::new(|| TempDir::new().unwrap());
 
     #[rstest]
@@ -95,9 +100,9 @@ mod tests {
     /// Correct scheme to connect to localhost over http, but with additional path, which is invalid.
     #[case::grpc_invalid_host_and_path("grpc+http://localhost/some-path", false)]
     /// This configures OCI, but doesn't specify the bundle path
-    #[case::oci_missing_bundle_dir("oci://", false)]
+    #[cfg_attr(target_os = "linux", case::oci_missing_bundle_dir("oci://", false))]
     /// This configures OCI, specifying the bundle path
-    #[case::oci_bundle_path(&format!("oci://{}", TMPDIR_OCI_1.path().to_str().unwrap()), true)]
+    #[cfg_attr(target_os = "linux", case::oci_bundle_path(&format!("oci://{}", TMPDIR_OCI_1.path().to_str().unwrap()), true))]
     #[tokio::test]
     async fn test_from_addr(#[case] uri_str: &str, #[case] exp_succeed: bool) {
         let blob_service: Arc<dyn BlobService> = Arc::from(MemoryBlobService::default());