tests: Plumping to retry when event monitor output is not ready

Treat missing or still-short event monitor files as a retryable state
in integration test helpers.

This keeps polling-based restore and snapshot checks from failing early
with file-not-found or short-file assertions while the monitor output
is still being written.

In the following, we can gracefully wait for the corresponding
conditions to become true.

On-behalf-of: SAP philipp.schuster@sap.com
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
This commit is contained in:
Philipp Schuster
2026-04-10 13:36:34 +02:00
committed by Rob Bradford
parent b26488b1bf
commit 2c395d4ae8

View File

@@ -498,6 +498,9 @@ fn parse_event_file(event_file: &str) -> Vec<serde_json::Value> {
// Return true if all events from the input 'expected_events' are matched sequentially
// with events from the 'event_file'
pub(crate) fn check_sequential_events(expected_events: &[&MetaEvent], event_file: &str) -> bool {
if !Path::new(event_file).exists() {
return false;
}
let json_events = parse_event_file(event_file);
let len = expected_events.len();
let mut idx = 0;
@@ -529,8 +532,13 @@ pub(crate) fn check_sequential_events_exact(
expected_events: &[&MetaEvent],
event_file: &str,
) -> bool {
if !Path::new(event_file).exists() {
return false;
}
let json_events = parse_event_file(event_file);
assert!(expected_events.len() <= json_events.len());
if expected_events.len() > json_events.len() {
return false;
}
let json_events = &json_events[..expected_events.len()];
for (idx, e) in json_events.iter().enumerate() {
@@ -551,8 +559,13 @@ pub(crate) fn check_sequential_events_exact(
// Return true if events from the input 'latest_events' are matched exactly
// with the most recent events from the 'event_file'
pub(crate) fn check_latest_events_exact(latest_events: &[&MetaEvent], event_file: &str) -> bool {
if !Path::new(event_file).exists() {
return false;
}
let json_events = parse_event_file(event_file);
assert!(latest_events.len() <= json_events.len());
if latest_events.len() > json_events.len() {
return false;
}
let json_events = &json_events[(json_events.len() - latest_events.len())..];
for (idx, e) in json_events.iter().enumerate() {