Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 96591323 authored by Ahmad Khalil's avatar Ahmad Khalil
Browse files

Fix Flaky Test

The goal of the vibrate_singleVibratorRepeatingAlwaysOnWaveform_turnsVibratorBackOn test is to verify that the second segment runs for it full intended duration, even after being cancelled mid step. Therefore, we've updated the condition to greater than or equal. This change handles a race condition where the device causes the segment to run for exactly the expected duration, rather than slightly longer.

Fix: 431925843
Flag: TEST_ONLY
Test: atest VibrationThreadTest#vibrate_singleVibratorRepeatingAlwaysOnWaveform_turnsVibratorBackOn
Change-Id: I55906239fc58667e0b3e895adfc71f838624f323
parent 788876db
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -617,7 +617,7 @@ public class VibrationThreadTest {
        assertThat(segments.get(0).getDuration()).isEqualTo(expectedOnDuration);
        // Vibrator turns off in the middle of the second execution of the first step. Expect it to
        // be turned back ON at least for the fixed duration + the remaining duration of the step.
        assertThat(segments.get(1).getDuration()).isGreaterThan(expectedOnDuration);
        assertThat(segments.get(1).getDuration()).isAtLeast(expectedOnDuration);
        // Set amplitudes for a cycle {1, 2}, start second loop then turn it back on to same value.
        assertThat(mVibratorHelpers.get(VIBRATOR_ID).getAmplitudes().subList(0, 4))
                .containsExactlyElementsIn(expectedAmplitudes(1, 2, 1, 1))