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

Function round_trip_preserves_multi_port

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

Source from the content-addressed store, hash-verified

2313
2314 #[test]
2315 fn round_trip_preserves_multi_port() {
2316 let yaml = r"
2317version: 1
2318network_policies:
2319 test:
2320 name: test
2321 endpoints:
2322 - host: api.example.com
2323 ports:
2324 - 80
2325 - 443
2326 binaries:
2327 - { path: /usr/bin/curl }
2328";
2329 let proto1 = parse_sandbox_policy(yaml).expect("parse failed");
2330 let yaml_out = serialize_sandbox_policy(&proto1).expect("serialize failed");
2331 let proto2 = parse_sandbox_policy(&yaml_out).expect("re-parse failed");
2332
2333 let ep1 = &proto1.network_policies["test"].endpoints[0];
2334 let ep2 = &proto2.network_policies["test"].endpoints[0];
2335 assert_eq!(ep1.ports, ep2.ports);
2336 assert_eq!(ep1.ports, vec![80, 443]);
2337 }
2338
2339 #[test]
2340 fn serialize_single_port_uses_compact_form() {

Callers

nothing calls this directly

Calls 2

parse_sandbox_policyFunction · 0.85
serialize_sandbox_policyFunction · 0.85

Tested by

no test coverage detected