From 22a9ab7a49b717899025bf2fea96c401f804c194 Mon Sep 17 00:00:00 2001 From: Dmitri Plotnikov Date: Fri, 7 Feb 2025 11:12:43 -0800 Subject: Fix flaky test, BatteryStatsHistoryTest.startNextFragment Bug: 394335078 Flag: TEST_ONLY Test: atest PowerStatsTests; atest PowerStatsTestsRavenwood Change-Id: Iac34ecb0ac2ff490645c325746007e9528ff8a61 --- .../src/com/android/server/power/stats/BatteryStatsHistoryTest.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/services/tests/powerstatstests/src/com/android/server/power/stats/BatteryStatsHistoryTest.java b/services/tests/powerstatstests/src/com/android/server/power/stats/BatteryStatsHistoryTest.java index 8fad93184732..5165e34c7fcd 100644 --- a/services/tests/powerstatstests/src/com/android/server/power/stats/BatteryStatsHistoryTest.java +++ b/services/tests/powerstatstests/src/com/android/server/power/stats/BatteryStatsHistoryTest.java @@ -456,6 +456,8 @@ public class BatteryStatsHistoryTest { } private void fillActiveFile(BatteryStatsHistory history) { + awaitCompletion(); // Wait for BatteryHistoryDirectory.trim if necessary. + // Create roughly 1K of history int initialSize = history.getHistoryUsedSize(); while (history.getHistoryUsedSize() < initialSize + 1000) { -- cgit v1.2.3-59-g8ed1b