diff --git a/proxy/src/console/messages.rs b/proxy/src/console/messages.rs index 0d321c077a..e5f1615b14 100644 --- a/proxy/src/console/messages.rs +++ b/proxy/src/console/messages.rs @@ -13,6 +13,7 @@ pub struct ConsoleError { #[derive(Deserialize)] pub struct GetRoleSecret { pub role_secret: Box, + pub allowed_ips: Option>>, } // Manually implement debug to omit sensitive info. @@ -187,4 +188,31 @@ mod tests { Ok(()) } + + #[test] + fn parse_wake_compute() -> anyhow::Result<()> { + let json = json!({ + "address": "0.0.0.0", + "aux": dummy_aux(), + }); + let _: WakeCompute = serde_json::from_str(&json.to_string())?; + Ok(()) + } + + #[test] + fn parse_get_role_secret() -> anyhow::Result<()> { + // Empty `allowed_ips` field. + let json = json!({ + "role_secret": "secret", + }); + let _: GetRoleSecret = serde_json::from_str(&json.to_string())?; + // Empty `allowed_ips` field. + let json = json!({ + "role_secret": "secret", + "allowed_ips": ["8.8.8.8"], + }); + let _: GetRoleSecret = serde_json::from_str(&json.to_string())?; + + Ok(()) + } }