Closed Bug 1379025 Opened 7 years ago Closed 7 years ago

Sync ping "firm up" follow-up tests

Categories

(Firefox for Android Graveyard :: Metrics, defect)

defect
Not set
normal

Tracking

(firefox55 fixed, firefox56 fixed)

RESOLVED FIXED
Firefox 56
Tracking Status
firefox55 --- fixed
firefox56 --- fixed

People

(Reporter: Grisha, Assigned: Grisha)

References

Details

Attachments

(1 file)

I somehow entirely missed test changes in Bug 1374758.
Assignee: nobody → gkruglov
Status: NEW → ASSIGNED
Comment on attachment 8884115 [details]
Bug 1379025 - Update sync ping tests for the "firm up" changes

https://reviewboard.mozilla.org/r/155042/#review160310

Works for me!

::: mobile/android/tests/background/junit4/src/org/mozilla/gecko/telemetry/pingbuilders/TelemetrySyncPingBundleBuilderTest.java:143
(Diff revision 1)
> +
> +        // Test general shape of payload. Expecting {"syncs":[],"why":"schedule", "version": 1}.
>          // NB that even though we set an empty sync event store, it's not in the json string.
>          // That's because sync events are not yet instrumented.
>          ExtendedJSONObject payload = outgoingPing.getPayload().getObject("payload");
> -        assertEquals("{\"syncs\":[],\"why\":\"schedule\"}", payload.toJSONString());
> +        assertEquals(3, payload.keySet().size());

Again -- you can `.equals` two EJO's.  But I'm fine with this for now.

::: mobile/android/tests/background/junit4/src/org/mozilla/gecko/telemetry/pingbuilders/TelemetrySyncPingBundleBuilderTest.java:194
(Diff revision 1)
>  
> -    private void assertSync(ExtendedJSONObject sync, String uid, long took, String deviceID, int version, boolean restarted) throws JSONException {
> +    private void assertSync(ExtendedJSONObject sync, String uid, long took, String deviceID, boolean restarted) throws JSONException {
>          assertEquals(uid, sync.getString("uid"));
>          assertEquals(Long.valueOf(took), sync.getLong("took"));
>          assertEquals(deviceID, sync.getString("deviceID"));
> -        assertEquals(Integer.valueOf(version), sync.getIntegerSafely("version"));
> +        assertTrue(sync.getLong("when") != null);

Consider testing that `when` is larger than some fixed timestamp (say from a year ago) and also smaller than the _current_ timestamp.
Attachment #8884115 - Flags: review?(nalexander) → review+
Pushed by gkruglov@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/407df61a6300
Update sync ping tests for the "firm up" changes r=nalexander
https://hg.mozilla.org/mozilla-central/rev/407df61a6300
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 56
Can you request uplift here too (from https://bugzilla.mozilla.org/show_bug.cgi?id=1374758#c22) Thanks!
Flags: needinfo?(gkruglov)
Flags: needinfo?(gkruglov)
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: