| 344 | |
| 345 | #[test] |
| 346 | fn parses_full_example() { |
| 347 | let toml = r#" |
| 348 | [openshell] |
| 349 | version = 1 |
| 350 | |
| 351 | [openshell.gateway] |
| 352 | bind_address = "0.0.0.0:8080" |
| 353 | health_bind_address = "0.0.0.0:8081" |
| 354 | log_level = "info" |
| 355 | compute_drivers = ["kubernetes"] |
| 356 | sandbox_namespace = "agents" |
| 357 | grpc_rate_limit_requests = 120 |
| 358 | grpc_rate_limit_window_seconds = 60 |
| 359 | default_image = "ghcr.io/nvidia/openshell/sandbox:latest" |
| 360 | supervisor_image = "ghcr.io/nvidia/openshell/supervisor:latest" |
| 361 | client_tls_secret_name = "openshell-sandbox-tls" |
| 362 | service_account_name = "openshell-sandbox" |
| 363 | |
| 364 | [openshell.gateway.tls] |
| 365 | cert_path = "/etc/openshell/certs/gateway.pem" |
| 366 | key_path = "/etc/openshell/certs/gateway-key.pem" |
| 367 | client_ca_path = "/etc/openshell/certs/client-ca.pem" |
| 368 | |
| 369 | [openshell.gateway.oidc] |
| 370 | issuer = "https://idp.example.com/realms/openshell" |
| 371 | audience = "openshell-cli" |
| 372 | |
| 373 | [openshell.drivers.kubernetes] |
| 374 | namespace = "agents" |
| 375 | grpc_endpoint = "https://openshell-gateway.agents.svc:8080" |
| 376 | "#; |
| 377 | let tmp = write_tmp(toml); |
| 378 | let file = load(tmp.path()).expect("valid file parses"); |
| 379 | let gw = &file.openshell.gateway; |
| 380 | assert_eq!(gw.log_level.as_deref(), Some("info")); |
| 381 | assert_eq!( |
| 382 | gw.default_image.as_deref(), |
| 383 | Some("ghcr.io/nvidia/openshell/sandbox:latest") |
| 384 | ); |
| 385 | assert_eq!(gw.grpc_rate_limit_requests, Some(120)); |
| 386 | assert_eq!(gw.grpc_rate_limit_window_seconds, Some(60)); |
| 387 | assert!(gw.tls.is_some()); |
| 388 | assert!(gw.oidc.is_some()); |
| 389 | assert!(file.openshell.drivers.contains_key("kubernetes")); |
| 390 | } |
| 391 | |
| 392 | #[test] |
| 393 | fn parses_gateway_auth_config() { |