-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #139 from SpaceTeam/timeout-handling
Timeout handling
- Loading branch information
Showing
11 changed files
with
168 additions
and
173 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
use std::time::Duration; | ||
use STS1_EDU_Scheduler::communication::{CommunicationHandle, CEPPacket}; | ||
use super::{SimulationComHandle, start_scheduler, get_status}; | ||
|
||
#[test] | ||
fn integrity_ack_timeout_is_honored() { | ||
let (mut cobc, _socat) = SimulationComHandle::with_socat_proc("integrity_timeout"); | ||
let _sched = start_scheduler("integrity_timeout").unwrap(); | ||
|
||
// Check that delayed ACK is allowed | ||
cobc.send_packet(&CEPPacket::Data(get_status())).unwrap(); | ||
std::thread::sleep(Duration::from_millis(500)); | ||
assert_eq!(cobc.receive_packet().unwrap(), CEPPacket::Data(vec![0])); | ||
|
||
cobc.send_packet(&CEPPacket::Data(get_status())).unwrap(); | ||
assert_eq!(CEPPacket::try_from_read(&mut cobc.cobc_in).unwrap(), CEPPacket::Data(vec![0])); // No ACK sent! | ||
std::thread::sleep(Duration::from_millis(1010)); | ||
|
||
// Timeout passed, normal communication should be possible | ||
cobc.send_packet(&CEPPacket::Data(get_status())).unwrap(); | ||
assert_eq!(cobc.receive_packet().unwrap(), CEPPacket::Data(vec![0])); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters