Skip to content

Commit 1278cbe

Browse files
committed
Increase BatteryStatusTracker test tolerance for missing data
Because we were waiting 0.1 seconds to confirm there's no status change, we were getting into a race, because the 0.1s timeout finishes, the status changes because of missing data. Increasing the tolerance for missing data fixes that. This commit also increases the timeout for failures due to stale data, to be clearly higher than `max_data_age`. Signed-off-by: Sahas Subramanian <[email protected]>
1 parent 4f2fe34 commit 1278cbe

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tests/actor/test_battery_status.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,7 @@ async def setup_tracker(
753753
mock_microgrid,
754754
BatteryStatusTracker(
755755
BATTERY_ID,
756-
max_data_age=timedelta(seconds=0.1),
756+
max_data_age=timedelta(seconds=0.2),
757757
max_blocking_duration=timedelta(seconds=1),
758758
status_sender=status_channel.new_sender(),
759759
set_power_result_receiver=set_power_result_channel.new_receiver(),
@@ -1027,7 +1027,7 @@ async def test_stale_data(
10271027

10281028
await self._send_healthy_inverter(mock_microgrid)
10291029
await self._send_healthy_battery(mock_microgrid, timestamp)
1030-
assert await recv_timeout(status_receiver) == ComponentStatus(
1030+
assert await recv_timeout(status_receiver, 0.3) == ComponentStatus(
10311031
BATTERY_ID, ComponentStatusEnum.NOT_WORKING
10321032
)
10331033

@@ -1043,7 +1043,7 @@ async def test_stale_data(
10431043

10441044
await self._send_healthy_battery(mock_microgrid)
10451045
await self._send_healthy_inverter(mock_microgrid, timestamp)
1046-
assert await recv_timeout(status_receiver) == ComponentStatus(
1046+
assert await recv_timeout(status_receiver, 0.3) == ComponentStatus(
10471047
BATTERY_ID, ComponentStatusEnum.NOT_WORKING
10481048
)
10491049

0 commit comments

Comments
 (0)