MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / bare_name_with_env_override

Function bare_name_with_env_override

crates/openshell-core/src/image.rs:72–87  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

70
71 #[test]
72 fn bare_name_with_env_override() {
73 let _guard = env_lock().lock().unwrap();
74 // Use a temp env override. Safety: test-only, and these env-var tests
75 // are not run concurrently with other tests reading the same var.
76 let key = "OPENSHELL_COMMUNITY_REGISTRY";
77 let prev = std::env::var(key).ok();
78 // SAFETY: single-threaded test context; no other thread reads this var.
79 unsafe { std::env::set_var(key, "my-registry.example.com/sandboxes") };
80 let result = resolve_community_image("python");
81 assert_eq!(result, "my-registry.example.com/sandboxes/python:latest");
82 // Restore.
83 match prev {
84 Some(v) => unsafe { std::env::set_var(key, v) },
85 None => unsafe { std::env::remove_var(key) },
86 }
87 }
88
89 #[test]
90 fn full_reference_with_slash_passes_through() {

Callers

nothing calls this directly

Calls 2

env_lockFunction · 0.85
resolve_community_imageFunction · 0.85

Tested by

no test coverage detected