From 6728bf58e510b8813355dc81f4d21ce72057d164 Mon Sep 17 00:00:00 2001 From: Andrew Werner Date: Wed, 2 Aug 2023 00:30:11 -0400 Subject: [PATCH] integration-test: deflake log test This both waits longer and waits until at least one message comes through. Probably only the longer waiting was necessary, but this works. --- test/integration-test/src/tests/log.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/integration-test/src/tests/log.rs b/test/integration-test/src/tests/log.rs index 8645762b..e79dc3e4 100644 --- a/test/integration-test/src/tests/log.rs +++ b/test/integration-test/src/tests/log.rs @@ -68,11 +68,14 @@ async fn log() { // Call the function that the uprobe is attached to, so it starts logging. trigger_ebpf_program(); + // Wait for there to be some logs, and for the number of logs to stop changing. let mut logs = 0; let records = loop { - tokio::time::sleep(std::time::Duration::from_millis(10)).await; + // Note that 100ms was chosen after observing that 10ms can be too short + // in CI. + tokio::time::sleep(std::time::Duration::from_millis(100)).await; let records = captured_logs.lock().unwrap(); - if records.len() == logs { + if records.len() == logs && logs > 0 { break records; } logs = records.len();