caching
This commit is contained in:
parent
6a535099bb
commit
009173a97d
49 changed files with 1788 additions and 389 deletions
|
|
@ -3,12 +3,12 @@ pub mod text_commands;
|
|||
pub mod transport;
|
||||
|
||||
pub use protocol::{
|
||||
ClientMessage, ComponentHealth, ComponentId, ComponentStatusResponse, ConfigResponse,
|
||||
ConnectionStatus, DaemonMessage, DaemonStatusResponse, DeploymentMode, ExitIntent,
|
||||
HealthStatus, HelloAck, IpcErrorCode, LifecycleEvent, LifecyclePhase, LocalRequest, LogEntry,
|
||||
LogEntriesResponse, MetricSample, OmikronStatusResponse, RequestEnvelope, ResponseEnvelope,
|
||||
ResponsePayload, ResponseResult, StartupPhase, StateSnapshot, StatusResponse, SupervisorKind,
|
||||
TaskSummary, UpdateStatusResponse, UserDetailResponse, UserSummary, CommunitySummary,
|
||||
ClientMessage, CommunitySummary, ComponentHealth, ComponentId, ComponentStatusResponse,
|
||||
ConfigResponse, ConnectionStatus, DaemonMessage, DaemonStatusResponse, DeploymentMode,
|
||||
ExitIntent, HealthStatus, HelloAck, IpcErrorCode, LifecycleEvent, LifecyclePhase, LocalRequest,
|
||||
LogEntriesResponse, LogEntry, MetricSample, OmikronStatusResponse, RequestEnvelope,
|
||||
ResponseEnvelope, ResponsePayload, ResponseResult, StartupPhase, StateSnapshot, StatusResponse,
|
||||
SupervisorKind, TaskSummary, UpdateStatusResponse, UserDetailResponse, UserSummary,
|
||||
};
|
||||
pub use transport::{read_msg, write_msg};
|
||||
|
||||
|
|
|
|||
|
|
@ -136,16 +136,9 @@ pub enum ResponsePayload {
|
|||
Status(StatusResponse),
|
||||
Tasks(Vec<TaskSummary>),
|
||||
Users(Vec<UserSummary>),
|
||||
UserCreated {
|
||||
user_id: i64,
|
||||
username: String,
|
||||
},
|
||||
UserRemoved {
|
||||
user_id: i64,
|
||||
},
|
||||
Acknowledged {
|
||||
message: String,
|
||||
},
|
||||
UserCreated { user_id: i64, username: String },
|
||||
UserRemoved { user_id: i64 },
|
||||
Acknowledged { message: String },
|
||||
DaemonStatus(DaemonStatusResponse),
|
||||
Config(ConfigResponse),
|
||||
OmikronStatus(OmikronStatusResponse),
|
||||
|
|
@ -264,8 +257,15 @@ mod error_tests {
|
|||
|
||||
#[test]
|
||||
fn error_codes_have_operator_facing_messages() {
|
||||
assert_eq!(IpcErrorCode::NotReady.to_string(), "the daemon is not ready yet");
|
||||
assert!(!IpcErrorCode::InternalFailure.to_string().contains("InternalFailure"));
|
||||
assert_eq!(
|
||||
IpcErrorCode::NotReady.to_string(),
|
||||
"the daemon is not ready yet"
|
||||
);
|
||||
assert!(
|
||||
!IpcErrorCode::InternalFailure
|
||||
.to_string()
|
||||
.contains("InternalFailure")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,9 @@ pub fn validation_error(line: &str) -> Option<String> {
|
|||
if normalized == "help" || parse(normalized).is_some() {
|
||||
None
|
||||
} else {
|
||||
Some(format!("Unknown command `{normalized}`. Use /help or Tab completion."))
|
||||
Some(format!(
|
||||
"Unknown command `{normalized}`. Use /help or Tab completion."
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -121,10 +123,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn accepts_the_headless_cli_user_vocabulary() {
|
||||
assert!(matches!(
|
||||
parse("users list"),
|
||||
Some(LocalRequest::ListUsers)
|
||||
));
|
||||
assert!(matches!(parse("users list"), Some(LocalRequest::ListUsers)));
|
||||
assert!(matches!(
|
||||
parse("users add alice"),
|
||||
Some(LocalRequest::CreateUser { .. })
|
||||
|
|
@ -203,10 +202,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn parses_config_get() {
|
||||
assert!(matches!(
|
||||
parse("config get"),
|
||||
Some(LocalRequest::GetConfig)
|
||||
));
|
||||
assert!(matches!(parse("config get"), Some(LocalRequest::GetConfig)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
@ -319,6 +315,10 @@ mod tests {
|
|||
fn validation_distinguishes_help_and_unknown_commands() {
|
||||
assert_eq!(validation_error("/help"), None);
|
||||
assert!(validation_error("status").is_none());
|
||||
assert!(validation_error("statuz").unwrap().contains("Unknown command"));
|
||||
assert!(
|
||||
validation_error("statuz")
|
||||
.unwrap()
|
||||
.contains("Unknown command")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue