MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / test_parse_destination

Function test_parse_destination

gateway/src/proxy.rs:275–311  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

273
274 #[test]
275 fn test_parse_destination() {
276 // Test basic app_id only
277 let result = parse_dst_info("myapp").unwrap();
278 assert_eq!(result.app_id, "myapp");
279 assert_eq!(result.port, 80);
280 assert!(!result.is_tls);
281
282 // Test app_id with custom port
283 let result = parse_dst_info("myapp-8080").unwrap();
284 assert_eq!(result.app_id, "myapp");
285 assert_eq!(result.port, 8080);
286 assert!(!result.is_tls);
287
288 // Test app_id with TLS
289 let result = parse_dst_info("myapp-443s").unwrap();
290 assert_eq!(result.app_id, "myapp");
291 assert_eq!(result.port, 443);
292 assert!(result.is_tls);
293
294 // Test app_id with custom port and TLS
295 let result = parse_dst_info("myapp-8443s").unwrap();
296 assert_eq!(result.app_id, "myapp");
297 assert_eq!(result.port, 8443);
298 assert!(result.is_tls);
299
300 // Test default port but ends with s
301 let result = parse_dst_info("myapps").unwrap();
302 assert_eq!(result.app_id, "myapps");
303 assert_eq!(result.port, 80);
304 assert!(!result.is_tls);
305
306 // Test default port but ends with s in port part
307 let result = parse_dst_info("myapp-s").unwrap();
308 assert_eq!(result.app_id, "myapp");
309 assert_eq!(result.port, 443);
310 assert!(result.is_tls);
311 }
312}

Callers

nothing calls this directly

Calls 1

parse_dst_infoFunction · 0.85

Tested by

no test coverage detected