Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce flakiness of some tests #830

Open
StaehliJ opened this issue Dec 16, 2024 · 0 comments
Open

Reduce flakiness of some tests #830

StaehliJ opened this issue Dec 16, 2024 · 0 comments
Assignees
Milestone

Comments

@StaehliJ
Copy link
Contributor

StaehliJ commented Dec 16, 2024

As a Pillarbox developer, I want to be able to run the project's tests with confidence.

Context

Currently, some tests randomly fail.

TimeoutException

MetricsCollectorTest > playback item transition

MetricsCollectorTest > playback item transition FAILED
    java.util.concurrent.TimeoutException
        at androidx.media3.test.utils.robolectric.RobolectricUtil.runLooperUntil(RobolectricUtil.java:149)
        at androidx.media3.test.utils.robolectric.RobolectricUtil.runMainLooperUntil(RobolectricUtil.java:98)
        at androidx.media3.test.utils.robolectric.RobolectricUtil.runMainLooperUntil(RobolectricUtil.java:76)
        at androidx.media3.test.utils.robolectric.TestPlayerRunHelper$PlayerRunResult.runUntil(TestPlayerRunHelper.java:306)
        at androidx.media3.test.utils.robolectric.TestPlayerRunHelper$PlayerRunResult.untilState(TestPlayerRunHelper.java:121)
        at androidx.media3.test.utils.robolectric.TestPlayerRunHelper.runUntilPlaybackState(TestPlayerRunHelper.java:582)
        at ch.srgssr.pillarbox.player.analytics.MetricsCollectorTest.playback item transition(MetricsCollectorTest.kt:91)

PlaybackSessionManagerTest > multiple media items

java.util.concurrent.TimeoutException
	at androidx.media3.test.utils.robolectric.RobolectricUtil.runLooperUntil(RobolectricUtil.java:149)
	at androidx.media3.test.utils.robolectric.RobolectricUtil.runMainLooperUntil(RobolectricUtil.java:98)
	at androidx.media3.test.utils.robolectric.RobolectricUtil.runMainLooperUntil(RobolectricUtil.java:76)
	at androidx.media3.test.utils.robolectric.TestPlayerRunHelper$PlayerRunResult.runUntil(TestPlayerRunHelper.java:306)
	at androidx.media3.test.utils.robolectric.TestPlayerRunHelper$PlayerRunResult.untilState(TestPlayerRunHelper.java:121)
	at androidx.media3.test.utils.robolectric.TestPlayerRunHelper.runUntilPlaybackState(TestPlayerRunHelper.java:582)
	at ch.srgssr.pillarbox.player.analytics.PlaybackSessionManagerTest.play multiple media items(PlaybackSessionManagerTest.kt:183)

PlaybackSessionManagerTest > play multiple media items, remove upcoming media item

PlaybackSessionManagerTest > play multiple media items, remove upcoming media item FAILED
    java.util.concurrent.TimeoutException
        at androidx.media3.test.utils.robolectric.RobolectricUtil.runLooperUntil(RobolectricUtil.java:149)
        at androidx.media3.test.utils.robolectric.RobolectricUtil.runMainLooperUntil(RobolectricUtil.java:98)
        at androidx.media3.test.utils.robolectric.RobolectricUtil.runMainLooperUntil(RobolectricUtil.java:76)
        at androidx.media3.test.utils.robolectric.TestPlayerRunHelper$PlayerRunResult.runUntil(TestPlayerRunHelper.java:306)
        at androidx.media3.test.utils.robolectric.TestPlayerRunHelper$PlayerRunResult.untilState(TestPlayerRunHelper.java:121)
        at androidx.media3.test.utils.robolectric.TestPlayerRunHelper.runUntilPlaybackState(TestPlayerRunHelper.java:582)
        at ch.srgssr.pillarbox.player.analytics.PlaybackSessionManagerTest.play multiple media items, remove upcoming media item(PlaybackSessionManagerTest.kt:234)

MockKException

CommandersActTrackerIntegrationTest > check uptime and position updates for not live

CommandersActTrackerIntegrationTest > check uptime and position updates for not live FAILED
    io.mockk.MockKException: no answer found for ExoPlayer(#26).getApplicationLooper() among the configured answers: ()
        at io.mockk.impl.stub.MockKStub.defaultAnswer(MockKStub.kt:93)
        at io.mockk.impl.stub.MockKStub.answer(MockKStub.kt:44)
        at io.mockk.impl.recording.states.AnsweringState.call(AnsweringState.kt:16)
        at io.mockk.impl.recording.CommonCallRecorder.call(CommonCallRecorder.kt:53)
        at io.mockk.impl.stub.MockKStub.handleInvocation(MockKStub.kt:271)
        at io.mockk.impl.instantiation.JvmMockFactoryHelper$mockHandler$1.invocation(JvmMockFactoryHelper.kt:25)
        at app//io.mockk.proxy.jvm.advice.Interceptor.call(Interceptor.kt:21)
        at app//io.mockk.proxy.jvm.advice.BaseAdvice.handle(BaseAdvice.kt:42)
        at app//io.mockk.proxy.jvm.advice.jvm.JvmMockKProxyInterceptor.interceptNoSuper(JvmMockKProxyInterceptor.java:44)
        at androidx.media3.exoplayer.ExoPlayer$Subclass0.getApplicationLooper(Unknown Source)
        at ch.srgssr.pillarbox.player.PillarboxExoPlayerKt.runOnApplicationLooper(PillarboxExoPlayer.kt:436)
        at ch.srgssr.pillarbox.core.business.tracker.commandersact.CommandersActStreaming.positionHeartbeat$lambda$1(CommandersActStreaming.kt:50)
        at ch.srgssr.pillarbox.player.utils.Heartbeat$start$1.invokeSuspend(Heartbeat.kt:53)
        at app//kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:101)
        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:589)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:832)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:720)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:707)

PillarboxMediaMetaDataTrackerTest

PillarboxMediaMetaDataTrackerTest > chapter transition after seek back

PillarboxMediaMetaDataTrackerTest > chapter transition after seek back FAILED
    java.lang.AssertionError: expected:<[Chapter(id=Chapter3, start=2000, end=5000, mediaMetadata=androidx.media3.common.MediaMetadata@743fcd71), null, Chapter(id=Chapter3, start=2000, end=5000, mediaMetadata=androidx.media3.common.MediaMetadata@743fcd71), null, Chapter(id=Chapter4, start=10000, end=15000, mediaMetadata=androidx.media3.common.MediaMetadata@743fcd71), null]> but was:<[Chapter(id=Chapter3, start=2000, end=5000, mediaMetadata=androidx.media3.common.MediaMetadata@743fcd71), null, Chapter(id=Chapter3, start=2000, end=5000, mediaMetadata=androidx.media3.common.MediaMetadata@743fcd71), Chapter(id=Chapter4, start=10000, end=15000, mediaMetadata=androidx.media3.common.MediaMetadata@743fcd71), null]>
        at org.junit.Assert.fail(Assert.java:89)
        at org.junit.Assert.failNotEquals(Assert.java:835)
        at org.junit.Assert.assertEquals(Assert.java:120)
        at kotlin.test.junit.JUnitAsserter.assertEquals(JUnitSupport.kt:32)
        at kotlin.test.AssertionsKt__AssertionsKt.assertEquals(Assertions.kt:63)
        at kotlin.test.AssertionsKt.assertEquals(Unknown Source)
        at kotlin.test.AssertionsKt__AssertionsKt.assertEquals$default(Assertions.kt:62)
        at kotlin.test.AssertionsKt.assertEquals$default(Unknown Source)
        at ch.srgssr.pillarbox.player.tracker.PillarboxMediaMetaDataTrackerTest.chapter transition after seek back(PillarboxMediaMetaDataTrackerTest.kt:96)

Acceptance criteria

  • Pillarbox tests run reliably.
@StaehliJ StaehliJ converted this from a draft issue Dec 16, 2024
@StaehliJ StaehliJ moved this from ✏️ Draft to 📋 Backlog in Pillarbox Dec 16, 2024
@MGaetan89 MGaetan89 added this to the Test milestone Dec 16, 2024
@MGaetan89 MGaetan89 self-assigned this Dec 16, 2024
@MGaetan89 MGaetan89 moved this from 📋 Backlog to 🚧 In Progress in Pillarbox Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🚧 In Progress
Development

When branches are created from issues, their pull requests are automatically linked.

2 participants