Closed Bug 1147871 Opened 9 years ago Closed 9 years ago

Intermittent video/test/unit/thumbnail_list_test.js | Thumbnail List Unit Tests #api tests #addItem, simple - TypeError: group.localize is not a function followed by other failures

Categories

(Firefox OS Graveyard :: Gaia::Video, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
2.2 S11 (1may)

People

(Reporter: RyanVM, Assigned: rnicoletti)

Details

(Keywords: intermittent-failure, Whiteboard: [systemsfe])

Attachments

(2 files)

New since the TC switch.
Flags: needinfo?(kgrandon)
Flags: needinfo?(jlal)
Comment on attachment 8584001 [details] [review]
[gaia] KevinGrandon:bug_1147871_video_use_mock_l10n > mozilla-b2g:master

Russ or David - could either of you give this a quick review? It seems the problem is that l10n is initializing while the test is running, and mocking the L10n object here should prevent that from happening.
Flags: needinfo?(kgrandon)
Attachment #8584001 - Flags: review?(rnicoletti)
Attachment #8584001 - Flags: review?(dflanagan)
Comment on attachment 8584001 [details] [review]
[gaia] KevinGrandon:bug_1147871_video_use_mock_l10n > mozilla-b2g:master

Looks good.
Attachment #8584001 - Flags: review?(rnicoletti) → review+
Comment on attachment 8584001 [details] [review]
[gaia] KevinGrandon:bug_1147871_video_use_mock_l10n > mozilla-b2g:master

Thanks for the quick review Russ!
Attachment #8584001 - Flags: review?(dflanagan)
Assignee: nobody → kgrandon
Keywords: checkin-needed
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Flags: needinfo?(jlal)
Whiteboard: [systemsfe]
Target Milestone: --- → 2.2 S11 (1may)
I'm reopening this as the failure is still being seen. See [1].

[1] https://bugzilla.mozilla.org/show_bug.cgi?id=1181201#c4
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
It turns out the problem is MockThumbnailGroup does not have a 'localize' function. This is a problem when Mockl10n.ready, in the ThumbnailList constructor, invokes the callback function when the ThumbnailList object has at least one 'item group' (an 'item group' is a MockThumbnailGroup object). This is a problem because on line 234 of thumbnail_list.js, 'group.localize' is invoked when there is at least one item group and MockThumbnailGroup has no 'localize' function.

During the unit test, it is most likely that Mockl10n.ready invokes the callback before any item groups are added to the ThumbnailList object. Occasionally (probably when there is heavy load on the box on which the test is running), it invokes the callback later in the running of the test when at least one item group has been added.

I was able to reproduce the error on my box by playing with the timing of when Mockl10n.ready invokes the callback (20ms delay did the trick).

I will be attaching a patch shortly.
Assignee: kevingrandon → rnicoletti
Status: REOPENED → ASSIGNED
Attachment #8683915 - Flags: review?(dflanagan)
Comment on attachment 8683915 [details] [review]
[gaia] russnicoletti:bug-1147871 > mozilla-b2g:master

Looks good. Thanks for tracking this down. I was involved in the code that added those localize calls where there are two paths depending on whether the l10n library is ready yet or not. It didn't occur to me that it might cause intermittent test failures.

Gallery has very similar localization code for thumbnail groups. Do you mind taking a look to see if there are gallery Mocks that have the same missing localize function?
Attachment #8683915 - Flags: review?(dflanagan) → review+
The gallery MockThumbnailGroup was also missing the 'localize' function. I don't think the gallery thumbnail_list_test had the timing issue because it wasn't using the MockL10n object, whose 'ready' function always invokes the callback. The actual mozl10n.ready function only calls the callback when state is 'ready', which I'm thinking is never the case during unit testing. In any event, I added a 'localize' function to the gallery MockThumbnailGroup object.

Can you merge the PR? I seem to no longer have write access to the gaia github repo.
Flags: needinfo?(dflanagan)
Thanks, Russ.

Landed on master: https://github.com/mozilla-b2g/gaia/commit/55da38674559526e595ceacac69765f0a2a314a4
Status: ASSIGNED → RESOLVED
Closed: 9 years ago9 years ago
Flags: needinfo?(dflanagan)
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: