@@ -287,7 +287,15 @@ fn dispatch( |
| 287 | ) -> Response { | 287 | ) -> Response { |
| 288 | match command { | 288 | match command { |
| 289 | Command::Ping => Response::ok_with_data(json!({ "pong": true })), | 289 | Command::Ping => Response::ok_with_data(json!({ "pong": true })), |
| 290 | - Command::Status => Response::ok_with_data(state.status()), | 290 | + Command::Status => { |
| | 291 | + let mut status = state.status(); |
| | 292 | + let diagnostics = collect_authority_diagnostics(); |
| | 293 | + status.authority_connected = Some(diagnostics.authority_connected); |
| | 294 | + status.authority_error = diagnostics.authority_error.clone(); |
| | 295 | + status.subject_kind = Some(diagnostics.subject.kind.clone()); |
| | 296 | + status.temporary_authorization_count = diagnostics.temporary_authorization_count; |
| | 297 | + Response::ok_with_data(status) |
| | 298 | + } |
| 291 | Command::Diagnose => { | 299 | Command::Diagnose => { |
| 292 | let diagnostics = collect_authority_diagnostics(); | 300 | let diagnostics = collect_authority_diagnostics(); |
| 293 | let auth_summary = state.auth_summary(); | 301 | let auth_summary = state.auth_summary(); |
@@ -415,6 +423,19 @@ mod tests { |
| 415 | assert_eq!(data.get("pong").and_then(|v| v.as_bool()), Some(true)); | 423 | assert_eq!(data.get("pong").and_then(|v| v.as_bool()), Some(true)); |
| 416 | } | 424 | } |
| 417 | | 425 | |
| | 426 | + #[test] |
| | 427 | + fn dispatch_status_includes_health_surface_fields() { |
| | 428 | + let state = fake_state(); |
| | 429 | + let (shutdown_tx, _shutdown_rx) = mpsc::unbounded_channel(); |
| | 430 | + |
| | 431 | + let response = dispatch(Command::Status, &state, &shutdown_tx); |
| | 432 | + assert!(response.success); |
| | 433 | + |
| | 434 | + let data = response.data.expect("data"); |
| | 435 | + assert!(data.get("authority_connected").is_some()); |
| | 436 | + assert!(data.get("subject_kind").is_some()); |
| | 437 | + } |
| | 438 | + |
| 418 | #[test] | 439 | #[test] |
| 419 | fn dispatch_quit_signals_shutdown() { | 440 | fn dispatch_quit_signals_shutdown() { |
| 420 | let state = fake_state(); | 441 | let state = fake_state(); |