Closed Bug 1788561 Opened 3 years ago Closed 3 years ago

Intermittent org.mozilla.geckoview.test.GeolocationTest#jsContentRequestForLocation | java.lang.AssertionError: Mocked longitude matches.

Categories

(GeckoView :: General, defect, P5)

All
Android
defect

Tracking

(Not tracked)

RESOLVED INCOMPLETE

People

(Reporter: intermittent-bug-filer, Unassigned)

References

Details

(Keywords: assertion, intermittent-failure)

Attachments

(2 obsolete files)

Filed by: imoraru [at] mozilla.com
Parsed log: https://treeherder.mozilla.org/logviewer?job_id=389097167&repo=autoland
Full log: https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/BqVvTt_fQuuUGCdUpqZnIQ/runs/0/artifacts/public/logs/live_backing.log


[task 2022-09-01T02:58:27.806Z] 02:58:27     INFO -  TEST-START | org.mozilla.geckoview.test.GeolocationTest#jsContentRequestForLocation
[task 2022-09-01T02:58:29.272Z] 02:58:29     INFO -  org.mozilla.geckoview.test | INSTRUMENTATION_STATUS: numtests=939
[task 2022-09-01T02:58:29.272Z] 02:58:29     INFO -  org.mozilla.geckoview.test | INSTRUMENTATION_STATUS: stream=
[task 2022-09-01T02:58:29.272Z] 02:58:29     INFO -  org.mozilla.geckoview.test | Error in jsContentRequestForLocation(org.mozilla.geckoview.test.GeolocationTest):
[task 2022-09-01T02:58:29.272Z] 02:58:29     INFO -  org.mozilla.geckoview.test | java.lang.AssertionError: Mocked longitude matches.
[task 2022-09-01T02:58:29.272Z] 02:58:29     INFO -  org.mozilla.geckoview.test | Expected: <2.2222>
[task 2022-09-01T02:58:29.273Z] 02:58:29     INFO -  org.mozilla.geckoview.test |      but: was <-122.08400000000002>
[task 2022-09-01T02:58:29.273Z] 02:58:29     INFO -  org.mozilla.geckoview.test | 	at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
[task 2022-09-01T02:58:29.273Z] 02:58:29     INFO -  org.mozilla.geckoview.test | 	at org.junit.Assert.assertThat(Assert.java:956)
[task 2022-09-01T02:58:29.273Z] 02:58:29     INFO -  org.mozilla.geckoview.test | 	at org.junit.rules.ErrorCollector$1.call(ErrorCollector.java:65)
[task 2022-09-01T02:58:29.273Z] 02:58:29     INFO -  org.mozilla.geckoview.test | 	at org.junit.rules.ErrorCollector.checkSucceeds(ErrorCollector.java:78)
[task 2022-09-01T02:58:29.273Z] 02:58:29     INFO -  org.mozilla.geckoview.test | 	at org.junit.rules.ErrorCollector.checkThat(ErrorCollector.java:63)
[task 2022-09-01T02:58:29.273Z] 02:58:29     INFO -  org.mozilla.geckoview.test | 	at org.mozilla.geckoview.test.rule.GeckoSessionTestRule.checkThat(GeckoSessionTestRule.java:903)
[task 2022-09-01T02:58:29.274Z] 02:58:29     INFO -  org.mozilla.geckoview.test | 	at org.mozilla.geckoview.test.BaseSessionTest.assertThat(BaseSessionTest.kt:145)
[task 2022-09-01T02:58:29.274Z] 02:58:29     INFO -  org.mozilla.geckoview.test | 	at org.mozilla.geckoview.test.GeolocationTest.jsContentRequestForLocation(GeolocationTest.kt:114)
[task 2022-09-01T02:58:29.274Z] 02:58:29     INFO -  org.mozilla.geckoview.test |
[task 2022-09-01T02:58:29.274Z] 02:58:29     INFO -  org.mozilla.geckoview.test | INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
[task 2022-09-01T02:58:29.274Z] 02:58:29     INFO -  org.mozilla.geckoview.test | INSTRUMENTATION_STATUS: test=jsContentRequestForLocation
[task 2022-09-01T02:58:29.274Z] 02:58:29     INFO -  org.mozilla.geckoview.test | INSTRUMENTATION_STATUS: class=org.mozilla.geckoview.test.GeolocationTest
[task 2022-09-01T02:58:29.274Z] 02:58:29     INFO -  org.mozilla.geckoview.test | INSTRUMENTATION_STATUS: stack=java.lang.AssertionError: Mocked longitude matches.
[task 2022-09-01T02:58:29.274Z] 02:58:29     INFO -  org.mozilla.geckoview.test | Expected: <2.2222>
[task 2022-09-01T02:58:29.275Z] 02:58:29     INFO -  org.mozilla.geckoview.test |      but: was <-122.08400000000002>
[task 2022-09-01T02:58:29.276Z] 02:58:29     INFO -  org.mozilla.geckoview.test | 	at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
[task 2022-09-01T02:58:29.276Z] 02:58:29     INFO -  org.mozilla.geckoview.test | 	at org.junit.Assert.assertThat(Assert.java:956)
[task 2022-09-01T02:58:29.276Z] 02:58:29     INFO -  org.mozilla.geckoview.test | 	at org.junit.rules.ErrorCollector$1.call(ErrorCollector.java:65)
[task 2022-09-01T02:58:29.276Z] 02:58:29     INFO -  org.mozilla.geckoview.test | 	at org.junit.rules.ErrorCollector.checkSucceeds(ErrorCollector.java:78)
[task 2022-09-01T02:58:29.276Z] 02:58:29     INFO -  org.mozilla.geckoview.test | 	at org.junit.rules.ErrorCollector.checkThat(ErrorCollector.java:63)
[task 2022-09-01T02:58:29.276Z] 02:58:29     INFO -  org.mozilla.geckoview.test | 	at org.mozilla.geckoview.test.rule.GeckoSessionTestRule.checkThat(GeckoSessionTestRule.java:903)
[task 2022-09-01T02:58:29.276Z] 02:58:29     INFO -  org.mozilla.geckoview.test | 	at org.mozilla.geckoview.test.BaseSessionTest.assertThat(BaseSessionTest.kt:145)
[task 2022-09-01T02:58:29.276Z] 02:58:29     INFO -  org.mozilla.geckoview.test | 	at org.mozilla.geckoview.test.GeolocationTest.jsContentRequestForLocation(GeolocationTest.kt:114)
[task 2022-09-01T02:58:29.276Z] 02:58:29     INFO -  org.mozilla.geckoview.test |
[task 2022-09-01T02:58:29.276Z] 02:58:29     INFO -  org.mozilla.geckoview.test | INSTRUMENTATION_STATUS: current=339
[task 2022-09-01T02:58:29.276Z] 02:58:29     INFO -  org.mozilla.geckoview.test | INSTRUMENTATION_STATUS_CODE: -2
[task 2022-09-01T02:58:29.276Z] 02:58:29     INFO -  Printing logcat for test:
[task 2022-09-01T02:58:29.324Z] 02:58:29     INFO -  09-01 02:58:27.588 E/GeckoSessionTestRule( 3362): test_start 1f0befec-3ff2-40ff-89cf-b127eb38b1ec jsContentRequestForLocation(org.mozilla.geckoview.test.GeolocationTest)
[task 2022-09-01T02:58:29.324Z] 02:58:29     INFO -  09-01 02:58:27.588 E/GeckoSessionTestRule( 3362): before prepareStatement jsContentRequestForLocation(org.mozilla.geckoview.test.GeolocationTest)
[task 2022-09-01T02:58:29.325Z] 02:58:29     INFO -  09-01 02:58:27.607 D/GeckoViewStartup( 3362): onEvent GeckoView:StorageDelegate:Attached
<...>
[task 2022-09-01T02:58:29.354Z] 02:58:29     INFO -  09-01 02:58:28.335 D/GeckoViewContent( 3362): handleEvent: DOMWindowClose
[task 2022-09-01T02:58:29.354Z] 02:58:29     INFO -  09-01 02:58:28.335 D/GeckoViewConsole( 3362): onEvent GeckoView:WebExtension:List null
[task 2022-09-01T02:58:29.354Z] 02:58:29     INFO -  09-01 02:58:28.336 E/GeckoSessionTestRule( 3362): test_end c5ee677f-bc83-49bd-9e28-2d35f3d0f059 jsContentRequestForLocation(org.mozilla.geckoview.test.GeolocationTest)
[task 2022-09-01T02:58:29.354Z] 02:58:29  WARNING -  TEST-UNEXPECTED-FAIL | org.mozilla.geckoview.test.GeolocationTest#jsContentRequestForLocation | java.lang.AssertionError: Mocked longitude matches.
[task 2022-09-01T02:58:29.354Z] 02:58:29     INFO -  TEST-INFO took 1517ms
[task 2022-09-01T02:58:29.375Z] 02:58:29     INFO -  org.mozilla.geckoview.test | INSTRUMENTATION_STATUS: numtests=939
[task 2022-09-01T02:58:29.375Z] 02:58:29     INFO -  org.mozilla.geckoview.test | INSTRUMENTATION_STATUS: stream=
[task 2022-09-01T02:58:29.375Z] 02:58:29     INFO -  org.mozilla.geckoview.test | INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
[task 2022-09-01T02:58:29.376Z] 02:58:29     INFO -  org.mozilla.geckoview.test | INSTRUMENTATION_STATUS: test=accurateProviderSelected
[task 2022-09-01T02:58:29.376Z] 02:58:29     INFO -  org.mozilla.geckoview.test | INSTRUMENTATION_STATUS: class=org.mozilla.geckoview.test.GeolocationTest
[task 2022-09-01T02:58:29.376Z] 02:58:29     INFO -  org.mozilla.geckoview.test | INSTRUMENTATION_STATUS: current=340
[task 2022-09-01T02:58:29.376Z] 02:58:29     INFO -  org.mozilla.geckoview.test | INSTRUMENTATION_STATUS_CODE: 1
[task 2022-09-01T02:58:29.377Z] 02:58:29     INFO -  TEST-START | org.mozilla.geckoview.test.GeolocationTest#accurateProviderSelected

It looks like the mocked location is going stale (if it takes longer than 6s to return), and the test is now pulling a new device location. (Bug 1765835 corrected an issue with caching locations/never requesting new locations.)

A similar intermittent test issue was found during original testing of bug 1765835 in the test locationOnBackground.

The solution to the intermittent locationOnBackground was to add this snippet into the test, to ensure that mocked location does not go stale:

Handler(Looper.getMainLooper()).postDelayed({
    try {
        sessionRule.setMockLocation(locManager, locProvider, <<lat>>, <<lon>>)
    } catch (e: Exception) { }
}, 5000)

Likely adding this to jsContentRequestForLocation will correct the issue.

Assignee: nobody → ohall

Tested posting an updated location to the background using the looper. This fixed that test, but impacting the mock location of another test (location posted while another test was running). Background posting technique probably worked on locationOnBackground because that test is much slower.

Will try adjusting the test to expect new locations after a certain test runtime. (These intermittent geolocation issues mostly show up on fission and e10s runs.)

The mock location is going out-of-date on the jsContentRequestForLocation
test. Added a check to ensure the test is within the mock location
timeframe.

Attachment #9293304 - Attachment description: Bug 1788561 - Intermittent GeolocationTest jsContentRequestForLocation → WIP: Bug 1788561 - Intermittent GeolocationTest jsContentRequestForLocation
Attachment #9293304 - Attachment description: WIP: Bug 1788561 - Intermittent GeolocationTest jsContentRequestForLocation → Bug 1788561 - Intermittent GeolocationTest jsContentRequestForLocation

GeckoView is sometimes selecting a provider other than the named mock
provider. Changed the mock provider to override the gps provider for
testing.

Attachment #9294682 - Attachment is obsolete: true
Attachment #9293304 - Attachment description: Bug 1788561 - Intermittent GeolocationTest jsContentRequestForLocation → WIP: Bug 1788561 - Intermittent GeolocationTest jsContentRequestForLocation
Attachment #9293304 - Attachment description: WIP: Bug 1788561 - Intermittent GeolocationTest jsContentRequestForLocation → Bug 1788561 - Intermittent GeolocationTest jsContentRequestForLocation
Assignee: ohall → nobody
Attachment #9293304 - Attachment is obsolete: true
See Also: → 1788734
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → INCOMPLETE
Status: RESOLVED → REOPENED
Resolution: INCOMPLETE → ---
Status: REOPENED → RESOLVED
Closed: 3 years ago3 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: