Skip to content

Commit 46477ee

Browse files
alanzmeta-codesync[bot]
authored andcommitted
Tweak telemetry manager test to not be flaky
Summary: The `test_lifecycle` test is intended to confirm that we do get multiple segments. On a lightly loaded machine, the timing should be zero. This is not always the case, so to avoid flakiness we manually zero out the timing, so the essence of the test is not flaky Reviewed By: jcpetruzza Differential Revision: D85661410 fbshipit-source-id: b7d1130929692360a1284c78787f89f4e537cd88
1 parent dfa958a commit 46477ee

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

crates/elp/src/server/telemetry_manager.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -278,12 +278,14 @@ mod test {
278278
// Control lock scope by having it in braces
279279
let mut telemetry = TEST_TELEMETRY.lock();
280280
telemetry.next_segment(token.clone(), None);
281-
let new = telemetry.active.get(&token).unwrap();
281+
let new = telemetry.active.get_mut(&token).unwrap();
282282
assert_ne!(orig.segment_start_time, new.segment_start_time);
283283
assert_eq!(orig.start_time, new.start_time);
284+
// We sometimes run on a rollover boundary, set the value to zero to avoid flakiness
285+
for seg in &mut new.segments {
286+
seg.1 = 0;
287+
}
284288
let expected = format!("{:#?}\n", &new.segments);
285-
// We sometimes run on a rollover boundary
286-
let expected = expected.replace("1", "0");
287289
expect![[r#"
288290
[
289291
(

0 commit comments

Comments
 (0)