Skip to content

Commit a997c82

Browse files
authored
[oximeter] Fix self_stat count test flakes (#7456)
#7262 tried to fix the off-by-one test flake #7255, but it's still around. I think based on discussion on that PR (https://github.com/oxidecomputer/omicron/pull/7262/files#r1890548730), the assertion in it was adding one to the wrong side: it's possible the fake server may have seen one more request than the agent has finished noting, which means `server_count` may be equal to either `count` or `count + 1`, not `count` or `count - 1`. The change from `assert_eq` to `assert` also caused the new flakes to not log the actual values; this puts them back into the assertion message in case this fix is still not quite right.
1 parent b1b3dc1 commit a997c82

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

oximeter/collector/src/agent.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -747,10 +747,10 @@ mod tests {
747747
assert!(count != 0);
748748
let server_count = collection_count.load(Ordering::SeqCst);
749749
assert!(
750-
count == server_count || count - 1 == server_count,
750+
count == server_count || count + 1 == server_count,
751751
"number of collections reported by the collection \
752-
task differs from the number reported by the empty \
753-
producer server itself"
752+
task ({count}) differs from the number reported by the empty \
753+
producer server itself ({server_count})"
754754
);
755755
assert!(stats.failed_collections.is_empty());
756756
logctx.cleanup_successful();
@@ -901,10 +901,10 @@ mod tests {
901901
// server.
902902
let server_count = collection_count.load(Ordering::SeqCst);
903903
assert!(
904-
count == server_count || count - 1 == server_count,
904+
count == server_count || count + 1 == server_count,
905905
"number of collections reported by the collection \
906-
task differs from the number reported by the always-ded \
907-
producer server itself"
906+
task ({count}) differs from the number reported by the always-ded \
907+
producer server itself ({server_count})"
908908
);
909909
assert_eq!(stats.failed_collections.len(), 1);
910910
logctx.cleanup_successful();

0 commit comments

Comments
 (0)