Closed Bug 1892906 Opened 5 months ago Closed 5 months ago

Prevent MockKException in Fenix unit tests.

Categories

(Fenix :: General, task, P1)

All
Android
task

Tracking

(firefox128 fixed)

RESOLVED FIXED
128 Branch
Tracking Status
firefox128 --- fixed

People

(Reporter: mcarare, Assigned: mcarare)

References

Details

(Whiteboard: [fxdroid][group1])

Attachments

(2 files, 1 obsolete file)

Besides adding test noise, this can also make other tests that follow fail.


task 2024-04-22T09:58:39.123Z]     Exception in thread "DefaultDispatcher-worker-1 @coroutine#5" io.mockk.MockKException: no answer found for Components(#1).getCore() among the configured answers: ()
[task 2024-04-22T09:58:39.123Z]     at io.mockk.impl.stub.MockKStub.defaultAnswer(MockKStub.kt:91)
[task 2024-04-22T09:58:39.123Z]     at io.mockk.impl.stub.MockKStub.answer(MockKStub.kt:42)
[task 2024-04-22T09:58:39.123Z]     at io.mockk.impl.recording.states.AnsweringState.call(AnsweringState.kt:16)
[task 2024-04-22T09:58:39.123Z]     at io.mockk.impl.recording.CommonCallRecorder.call(CommonCallRecorder.kt:53)
[task 2024-04-22T09:58:39.123Z]     at io.mockk.impl.stub.MockKStub.handleInvocation(MockKStub.kt:269)
[task 2024-04-22T09:58:39.123Z]     at io.mockk.impl.instantiation.JvmMockFactoryHelper$mockHandler$1.invocation(JvmMockFactoryHelper.kt:24)
[task 2024-04-22T09:58:39.123Z]     at io.mockk.proxy.jvm.advice.Interceptor.call(Interceptor.kt:21)
[task 2024-04-22T09:58:39.123Z]     at org.mozilla.fenix.components.Components.getCore(Components.kt:76)
[task 2024-04-22T09:58:39.123Z]     at org.mozilla.fenix.FenixApplication$setStartupMetrics$4.invokeSuspend(FenixApplication.kt:851)
[task 2024-04-22T09:58:39.123Z]     at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
[task 2024-04-22T09:58:39.123Z]     at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
[task 2024-04-22T09:58:39.123Z]     at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:111)
[task 2024-04-22T09:58:39.123Z]     at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:99)
[task 2024-04-22T09:58:39.123Z]     at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:585)
[task 2024-04-22T09:58:39.123Z]     at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:802)
[task 2024-04-22T09:58:39.123Z]     at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:706)
[task 2024-04-22T09:58:39.123Z]     at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:693)
[task 2024-04-22T09:58:39.123Z]     Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [CoroutineId(5), "coroutine#5":StandaloneCoroutine{Cancelling}@25d938e6, Dispatchers.IO]
[task 2024-04-22T09:58:39.123Z]     Exception in thread "DefaultDispatcher-worker-1 @coroutine#6" io.mockk.MockKException: no answer found for Components(#1).getCore() among the configured answers: ()
[task 2024-04-22T09:58:39.123Z]     at io.mockk.impl.stub.MockKStub.defaultAnswer(MockKStub.kt:91)
[task 2024-04-22T09:58:39.123Z]     at io.mockk.impl.stub.MockKStub.answer(MockKStub.kt:42)
[task 2024-04-22T09:58:39.123Z]     at io.mockk.impl.recording.states.AnsweringState.call(AnsweringState.kt:16)
[task 2024-04-22T09:58:39.123Z]     at io.mockk.impl.recording.CommonCallRecorder.call(CommonCallRecorder.kt:53)
[task 2024-04-22T09:58:39.123Z]     at io.mockk.impl.stub.MockKStub.handleInvocation(MockKStub.kt:269)
[task 2024-04-22T09:58:39.123Z]     at io.mockk.impl.instantiation.JvmMockFactoryHelper$mockHandler$1.invocation(JvmMockFactoryHelper.kt:24)
[task 2024-04-22T09:58:39.123Z]     at io.mockk.proxy.jvm.advice.Interceptor.call(Interceptor.kt:21)
[task 2024-04-22T09:58:39.123Z]     at org.mozilla.fenix.components.Components.getCore(Components.kt:76)
[task 2024-04-22T09:58:39.123Z]     at org.mozilla.fenix.FenixApplication$setStartupMetrics$4.invokeSuspend(FenixApplication.kt:851)
[task 2024-04-22T09:58:39.123Z]     at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
[task 2024-04-22T09:58:39.123Z]     at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
[task 2024-04-22T09:58:39.123Z]     at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:111)
[task 2024-04-22T09:58:39.124Z]     at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:99)
[task 2024-04-22T09:58:39.124Z]     at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:585)
[task 2024-04-22T09:58:39.124Z]     at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:802)
[task 2024-04-22T09:58:39.124Z]     at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:706)
[task 2024-04-22T09:58:39.124Z]     at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:693)
[task 2024-04-22T09:58:39.124Z]     Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [CoroutineId(6), "coroutine#6":StandaloneCoroutine{Cancelling}@1d54a52b, Dispatchers.IO]

Pushed by mcarare@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/add11d356ff0 Mock shouldAutocompleteInAwesomebar answer to avoid MockKException. r=android-reviewers,boek
Status: ASSIGNED → RESOLVED
Closed: 5 months ago
Resolution: --- → FIXED
Target Milestone: --- → 127 Branch
Attachment #9398115 - Attachment is obsolete: true
Pushed by mcarare@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/89a4ff4ebbcd Override setting of Autofill metrics to avoid MockKException. r=android-reviewers,avirvara

In the future, please use a new bug for follow-up patches for better tracking (as this one now has different patches landing across different cycles). Bugs are cheap :-)

Flags: needinfo?(mcarare)

This patch was supposed to be for the same bug and was added in the same Phabricator stack, it landed separately by mistake.

Flags: needinfo?(mcarare)

A patch has been attached on this bug, which was already closed. Filing a separate bug will ensure better tracking. If this was not by mistake and further action is needed, please alert the appropriate party. (Or: if the patch doesn't change behavior -- e.g. landing a test case, or fixing a typo -- then feel free to disregard this message)

Target Milestone: 127 Branch → 128 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: