Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Test failure RestoreDownloadsState MUST populate the store with items in the storage #8271

Closed
Archaeopteryx opened this issue Aug 27, 2020 · 0 comments

Comments

@Archaeopteryx
Copy link

Archaeopteryx commented Aug 27, 2020

From #8197

CC @Amejia481 @csadilek

Log: https://treeherder.mozilla.org/logviewer.html#?job_id=314222448&repo=android-components

[task 2020-08-27T22:17:08.550Z] TEST: RestoreDownloadsState MUST populate the store with items in the storage
[task 2020-08-27T22:17:08.550Z] [Robolectric] mozilla.components.feature.downloads.DownloadMiddlewareTest.RestoreDownloadsState MUST populate the store with items in the storage: sdk=28; resources=binary
[task 2020-08-27T22:17:08.647Z] I/MonitoringInstr: Instrumentation started!
[task 2020-08-27T22:17:08.647Z] I/MonitoringInstr: Setting context classloader to 'org.robolectric.internal.bytecode.SandboxClassLoader@52d6d490', Original: 'org.robolectric.internal.bytecode.SandboxClassLoader@52d6d490'
[task 2020-08-27T22:17:08.647Z] D [DownloadMiddleware] Download restarted from the storage null
[task 2020-08-27T22:17:08.647Z] D [DownloadMiddleware] Sending download intent null
[task 2020-08-27T22:17:08.647Z] FAILURE
[task 2020-08-27T22:17:08.647Z]
[task 2020-08-27T22:17:08.648Z] java.util.NoSuchElementException: List is empty.
[task 2020-08-27T22:17:08.648Z] at kotlin.collections.CollectionsKt___CollectionsKt.first(_Collections.kt:206)
[task 2020-08-27T22:17:08.648Z] at kotlin.collections.CollectionsKt___CollectionsKt.first(_Collections.kt:190)
[task 2020-08-27T22:17:08.648Z] at mozilla.components.feature.downloads.DownloadMiddlewareTest$RestoreDownloadsState MUST populate the store with items in the storage$1.invokeSuspend(DownloadMiddlewareTest.kt:190)
[task 2020-08-27T22:17:08.648Z] at mozilla.components.feature.downloads.DownloadMiddlewareTest$RestoreDownloadsState MUST populate the store with items in the storage$1.invoke(DownloadMiddlewareTest.kt)
[task 2020-08-27T22:17:08.649Z] at kotlinx.coroutines.test.TestBuildersKt$runBlockingTest$deferred$1.invokeSuspend(TestBuilders.kt:50)
[task 2020-08-27T22:17:08.649Z] at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
[task 2020-08-27T22:17:08.649Z] at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56)
[task 2020-08-27T22:17:08.649Z] at kotlinx.coroutines.test.TestCoroutineDispatcher.dispatch(TestCoroutineDispatcher.kt:50)
[task 2020-08-27T22:17:08.649Z] at kotlinx.coroutines.DispatchedContinuationKt.resumeCancellableWith(DispatchedContinuation.kt:288)
[task 2020-08-27T22:17:08.649Z] at kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable(Cancellable.kt:26)
[task 2020-08-27T22:17:08.649Z] at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:109)
[task 2020-08-27T22:17:08.649Z] at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:158)
[task 2020-08-27T22:17:08.649Z] at kotlinx.coroutines.BuildersKt__Builders_commonKt.async(Builders.common.kt:89)
[task 2020-08-27T22:17:08.650Z] at kotlinx.coroutines.BuildersKt.async(Unknown Source)
[task 2020-08-27T22:17:08.650Z] at kotlinx.coroutines.BuildersKt__Builders_commonKt.async$default(Builders.common.kt:82)
[task 2020-08-27T22:17:08.650Z] at kotlinx.coroutines.BuildersKt.async$default(Unknown Source)
[task 2020-08-27T22:17:08.650Z] at kotlinx.coroutines.test.TestBuildersKt.runBlockingTest(TestBuilders.kt:49)
[task 2020-08-27T22:17:08.650Z] at kotlinx.coroutines.test.TestBuildersKt.runBlockingTest$default(TestBuilders.kt:45)
[task 2020-08-27T22:17:08.650Z] at mozilla.components.feature.downloads.DownloadMiddlewareTest.RestoreDownloadsState MUST populate the store with items in the storage(DownloadMiddlewareTest.kt:165)
[task 2020-08-27T22:17:08.650Z] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[task 2020-08-27T22:17:08.650Z] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[task 2020-08-27T22:17:08.650Z] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[task 2020-08-27T22:17:08.650Z] at java.lang.reflect.Method.invoke(Method.java:498)
[task 2020-08-27T22:17:08.650Z] at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
[task 2020-08-27T22:17:08.650Z] at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
[task 2020-08-27T22:17:08.650Z] at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
[task 2020-08-27T22:17:08.650Z] at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
[task 2020-08-27T22:17:08.650Z] at org.robolectric.RobolectricTestRunner$HelperTestRunner$1.evaluate(RobolectricTestRunner.java:601)
[task 2020-08-27T22:17:08.650Z] at org.robolectric.internal.SandboxTestRunner$2.evaluate(SandboxTestRunner.java:260)
[task 2020-08-27T22:17:08.650Z] at org.robolectric.internal.SandboxTestRunner.runChild(SandboxTestRunner.java:130)
[task 2020-08-27T22:17:08.650Z] at org.robolectric.internal.SandboxTestRunner.runChild(SandboxTestRunner.java:42)
[task 2020-08-27T22:17:08.650Z] at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
[task 2020-08-27T22:17:08.650Z] at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
[task 2020-08-27T22:17:08.650Z] at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
[task 2020-08-27T22:17:08.650Z] at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
[task 2020-08-27T22:17:08.650Z] at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
[task 2020-08-27T22:17:08.650Z] at org.robolectric.internal.SandboxTestRunner$1.evaluate(SandboxTestRunner.java:84)
[task 2020-08-27T22:17:08.650Z] at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
[task 2020-08-27T22:17:08.650Z] at androidx.test.ext.junit.runners.AndroidJUnit4.run(AndroidJUnit4.java:104)
[task 2020-08-27T22:17:08.650Z] at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.runTestClass(JUnitTestClassExecutor.java:110)
[task 2020-08-27T22:17:08.650Z] at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:58)
[task 2020-08-27T22:17:08.651Z] at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:38)
[task 2020-08-27T22:17:08.651Z] at org.gradle.api.internal.tasks.testing.junit.AbstractJUnitTestClassProcessor.processTestClass(AbstractJUnitTestClassProcessor.java:62)
[task 2020-08-27T22:17:08.651Z] at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:51)
[task 2020-08-27T22:17:08.651Z] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[task 2020-08-27T22:17:08.651Z] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[task 2020-08-27T22:17:08.651Z] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[task 2020-08-27T22:17:08.651Z] at java.lang.reflect.Method.invoke(Method.java:498)
[task 2020-08-27T22:17:08.651Z] at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
[task 2020-08-27T22:17:08.651Z] at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
[task 2020-08-27T22:17:08.651Z] at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:33)
[task 2020-08-27T22:17:08.651Z] at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94)
[task 2020-08-27T22:17:08.651Z] at com.sun.proxy.$Proxy2.processTestClass(Unknown Source)
[task 2020-08-27T22:17:08.651Z] at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:118)
[task 2020-08-27T22:17:08.651Z] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[task 2020-08-27T22:17:08.651Z] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[task 2020-08-27T22:17:08.651Z] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[task 2020-08-27T22:17:08.651Z] at java.lang.reflect.Method.invoke(Method.java:498)
[task 2020-08-27T22:17:08.651Z] at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
[task 2020-08-27T22:17:08.651Z] at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
[task 2020-08-27T22:17:08.651Z] at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:182)
[task 2020-08-27T22:17:08.651Z] at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:164)
[task 2020-08-27T22:17:08.651Z] at org.gradle.internal.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:412)
[task 2020-08-27T22:17:08.651Z] at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
[task 2020-08-27T22:17:08.651Z] at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
[task 2020-08-27T22:17:08.651Z] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[task 2020-08-27T22:17:08.651Z] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[task 2020-08-27T22:17:08.651Z] at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
[task 2020-08-27T22:17:08.651Z] at java.lang.Thread.run(Thread.java:748)

┆Issue is synchronized with this Jira Task

Amejia481 added a commit to Amejia481/android-components that referenced this issue Aug 27, 2020
Amejia481 added a commit to Amejia481/android-components that referenced this issue Aug 27, 2020
Amejia481 added a commit to Amejia481/android-components that referenced this issue Aug 28, 2020
bors bot pushed a commit that referenced this issue Aug 28, 2020
8274: Closes #8271: Fix DownloadMiddleware intermittent test r=csadilek a=Amejia481





Co-authored-by: Arturo Mejia <arturomejiamarmol@gmail.com>
@bors bors bot closed this as completed in 6b1a779 Aug 28, 2020
bors bot pushed a commit that referenced this issue Aug 31, 2020
8293: Closes #8292: DownloadMiddleware uses context.dispatch on wrong thread r=Amejia481 a=csadilek

@Amejia481 when reviewing #8271 I missed that we're switching to an IO thread in `restoreDownloads`. My mistake.

We're not allowing a synchronous dispatch on the store from another thread. Undoing that and adding a fix for the intermittent test failure.

Co-authored-by: Christian Sadilek <christian.sadilek@gmail.com>
bors bot pushed a commit that referenced this issue Aug 31, 2020
8293: Closes #8292: DownloadMiddleware uses context.dispatch on wrong thread r=Amejia481 a=csadilek

@Amejia481 when reviewing #8271 I missed that we're switching to an IO thread in `restoreDownloads`. My mistake.

We're not allowing a synchronous dispatch on the store from another thread. Undoing that and adding a fix for the intermittent test failure.

Co-authored-by: Christian Sadilek <christian.sadilek@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant