in proxy_agent_extension/src/service_main.rs [829:916]
fn test_proxyagent_service_success_status() {
let proxy_agent_status_obj = ProxyAgentStatus {
version: "1.0.0".to_string(),
status: OverallState::SUCCESS,
monitorStatus: ProxyAgentDetailStatus {
status: ModuleState::RUNNING,
message: "test".to_string(),
states: None,
},
keyLatchStatus: ProxyAgentDetailStatus {
status: ModuleState::RUNNING,
message: "test".to_string(),
states: None,
},
ebpfProgramStatus: ProxyAgentDetailStatus {
status: ModuleState::RUNNING,
message: "test".to_string(),
states: None,
},
proxyListenerStatus: ProxyAgentDetailStatus {
status: ModuleState::RUNNING,
message: "test".to_string(),
states: None,
},
telemetryLoggerStatus: ProxyAgentDetailStatus {
status: ModuleState::RUNNING,
message: "test".to_string(),
states: None,
},
proxyConnectionsCount: 1,
};
let proxy_connection_summary_obj = ProxyConnectionSummary {
userName: "test".to_string(),
ip: "test".to_string(),
port: 1,
processCmdLine: "test".to_string(),
responseStatus: "test".to_string(),
count: 1,
processFullPath: Some("test".to_string()),
userGroups: Some(vec!["test".to_string()]),
};
let proxy_failedAuthenticateSummary_obj = ProxyConnectionSummary {
userName: "test".to_string(),
ip: "test".to_string(),
port: 1,
processCmdLine: "test".to_string(),
responseStatus: "test".to_string(),
count: 1,
processFullPath: Some("test".to_string()),
userGroups: Some(vec!["test".to_string()]),
};
let toplevel_status = GuestProxyAgentAggregateStatus {
timestamp: misc_helpers::get_date_time_string(),
proxyAgentStatus: proxy_agent_status_obj,
proxyConnectionSummary: vec![proxy_connection_summary_obj],
failedAuthenticateSummary: vec![proxy_failedAuthenticateSummary_obj],
};
let mut status = StatusObj {
name: constants::PLUGIN_NAME.to_string(),
operation: constants::ENABLE_OPERATION.to_string(),
configurationAppliedTime: misc_helpers::get_date_time_string(),
code: constants::STATUS_CODE_OK,
status: constants::SUCCESS_STATUS.to_string(),
formattedMessage: FormattedMessage {
lang: constants::LANG_EN_US.to_string(),
message: "Update Proxy Agent command output successfully".to_string(),
},
substatus: Default::default(),
};
let mut status_state_obj = super::common::StatusState::new();
let proxyagent_file_version_in_extension: &String = &"1.0.0".to_string();
let mut service_state = super::service_state::ServiceState::default();
super::extension_substatus(
toplevel_status,
proxyagent_file_version_in_extension,
&mut status,
&mut status_state_obj,
&mut service_state,
);
assert_eq!(status.status, constants::SUCCESS_STATUS.to_string());
}