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

Function parse_ports_array

crates/openshell-policy/src/lib.rs:2250–2266  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2248
2249 #[test]
2250 fn parse_ports_array() {
2251 let yaml = r"
2252version: 1
2253network_policies:
2254 test:
2255 name: test
2256 endpoints:
2257 - { host: api.example.com, ports: [80, 443] }
2258 binaries:
2259 - { path: /usr/bin/curl }
2260";
2261 let policy = parse_sandbox_policy(yaml).expect("should parse");
2262 let ep = &policy.network_policies["test"].endpoints[0];
2263 assert_eq!(ep.ports, vec![80, 443]);
2264 // port should be set to first element for backwards compat
2265 assert_eq!(ep.port, 80);
2266 }
2267
2268 #[test]
2269 fn parse_single_port_normalized_to_ports() {

Callers

nothing calls this directly

Calls 1

parse_sandbox_policyFunction · 0.85

Tested by

no test coverage detected