continued reply handler test
All checks were successful
Rust/sat-rs/pipeline/pr-main This commit looks good
All checks were successful
Rust/sat-rs/pipeline/pr-main This commit looks good
This commit is contained in:
parent
0fa1503a88
commit
c832e71bb0
@ -398,6 +398,7 @@ mod tests {
|
||||
TestConverter, TestRouter, TestRoutingErrorHandler, APP_DATA_TOO_SHORT, TEST_APID,
|
||||
},
|
||||
verification::{
|
||||
self,
|
||||
tests::{SharedVerificationMap, TestVerificationReporter},
|
||||
FailParams, RequestId, VerificationReportingProvider,
|
||||
},
|
||||
@ -638,11 +639,28 @@ mod tests {
|
||||
let token = test_verif_reporter
|
||||
.start_success(token, &[])
|
||||
.expect("start success failure");
|
||||
let verif_info = test_verif_reporter
|
||||
.verification_info(&verification::RequestId::from(request_id))
|
||||
.expect("no verification info found");
|
||||
assert!(verif_info.started.expect("not started"));
|
||||
assert!(verif_info.accepted.expect("not accepted"));
|
||||
reply_handler.add_routed_request(
|
||||
request_id.into(),
|
||||
action_id,
|
||||
token,
|
||||
Duration::from_millis(1),
|
||||
);
|
||||
let action_reply = ActionReplyPusWithIds {
|
||||
request_id,
|
||||
action_id,
|
||||
reply: ActionReplyPus::Completed,
|
||||
};
|
||||
reply_handler
|
||||
.handle_action_reply(action_reply, &[])
|
||||
.expect("reply handling failure");
|
||||
let verif_info = test_verif_reporter
|
||||
.verification_info(&verification::RequestId::from(request_id))
|
||||
.expect("no verification info found");
|
||||
assert!(verif_info.completed.expect("not started"));
|
||||
}
|
||||
}
|
||||
|
@ -1458,6 +1458,7 @@ pub mod tests {
|
||||
#[allow(dead_code)]
|
||||
fn is_sync<T: Sync>(_: &T) {}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct VerificationStatus {
|
||||
pub accepted: Option<bool>,
|
||||
pub started: Option<bool>,
|
||||
@ -1649,6 +1650,38 @@ pub mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
impl TestVerificationReporter {
|
||||
pub fn verification_info(&self, req_id: &RequestId) -> Option<VerificationStatus> {
|
||||
let verif_map = self.verification_map.lock().unwrap();
|
||||
let value = verif_map.borrow().get(req_id).cloned();
|
||||
value
|
||||
}
|
||||
|
||||
pub fn check_accepted(&self, req_id: &RequestId) -> bool {
|
||||
let verif_map = self.verification_map.lock().unwrap();
|
||||
if let Some(entry) = verif_map.borrow().get(req_id) {
|
||||
return entry.accepted.unwrap_or(false);
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
pub fn check_started(&self, req_id: &RequestId) -> bool {
|
||||
let verif_map = self.verification_map.lock().unwrap();
|
||||
if let Some(entry) = verif_map.borrow().get(req_id) {
|
||||
return entry.started.unwrap_or(false);
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
pub fn check_completed(&self, req_id: &RequestId) -> bool {
|
||||
let verif_map = self.verification_map.lock().unwrap();
|
||||
if let Some(entry) = verif_map.borrow().get(req_id) {
|
||||
return entry.completed.unwrap_or(false);
|
||||
}
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
const TEST_APID: u16 = 0x02;
|
||||
const EMPTY_STAMP: [u8; 7] = [0; 7];
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user