Skip to content

Commit

Permalink
[eclipse-iceoryx#361] Add static storage open timeout tests
Browse files Browse the repository at this point in the history
  • Loading branch information
elfenpiff committed Aug 30, 2024
1 parent 1265acb commit 0200f85
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions iceoryx2-cal/tests/static_storage_trait_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,25 @@ mod static_storage {
assert_that!(read_content, eq content);
}

#[test]
fn open_locked_with_timeout_works<Sut: StaticStorage>() {
const TIMEOUT: Duration = Duration::from_millis(100);
let _test_guard = TEST_MUTEX.lock();
let storage_name = generate_name();

let _storage_guard = Sut::Builder::new(&storage_name).create_locked();

let start = std::time::SystemTime::now();
let storage_reader = Sut::Builder::new(&storage_name).open(TIMEOUT);

assert_that!(start.elapsed().unwrap(), ge TIMEOUT);
assert_that!(storage_reader, is_err);
assert_that!(
storage_reader.err().unwrap(), eq
StaticStorageOpenError::InitializationNotYetFinalized
);
}

#[test]
fn releasing_ownership_works<Sut: StaticStorage>() {
let _test_guard = TEST_MUTEX.lock();
Expand Down

0 comments on commit 0200f85

Please sign in to comment.