Skip to content

Commit 0f35afb

Browse files
authored
Relax test tolerances to avoid flaky tests in buildfarm. (#17)
1 parent ad9e322 commit 0f35afb

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

greenwave_monitor/greenwave_monitor/test_utils.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,14 @@
3030

3131
# Test configurations for various message types and frequencies
3232
# (message_type, expected_frequency, tolerance_hz)
33+
# NOTE: Tolerances and frequencies are set conservatively for reliable operation
34+
# on slow/loaded CI systems such as the ROS buildfarm. The 30% tolerance standard
35+
# ensures tests pass even under system load.
3336
TEST_CONFIGURATIONS = [
34-
('imu', 1.0, 0.5),
37+
('imu', 1.0, 0.3),
3538
('imu', 100.0, 30.0),
36-
('imu', 5000.0, 250.0),
37-
('image', 10.0, 2.0),
39+
('imu', 500.0, 150.0),
40+
('image', 10.0, 3.0),
3841
('string', 100.0, 30.0),
3942
]
4043

@@ -253,9 +256,10 @@ def verify_diagnostic_values(status: DiagnosticStatus,
253256
errors.append(
254257
f'Message frequency {reported_frequency_msg} not within '
255258
f'{tolerance_hz} Hz of expected {expected_frequency}')
256-
if reported_latency_ms > 10:
259+
# Relaxed to 50ms for slow/loaded CI systems (was 10ms)
260+
if reported_latency_ms > 50:
257261
errors.append(
258-
f'Latency should be <= 10 ms for non-string types, '
262+
f'Latency should be <= 50 ms for non-string types, '
259263
f'got {reported_latency_ms}')
260264

261265
return errors

0 commit comments

Comments
 (0)