This repository has been archived by the owner on Apr 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release-v1.4.2' into release
- Loading branch information
Showing
11 changed files
with
129 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,6 +50,21 @@ enrollment: | |
- [email protected] | ||
expires: never | ||
|
||
schema_namespace: | ||
type: string | ||
lifetime: ping | ||
send_in_pings: | ||
- study-enrollment | ||
description: | | ||
The schema namespace for the study the user has joined. | ||
bugs: | ||
- https://github.com/mozilla-rally/rally-core-addon/issues/545 | ||
data_reviews: | ||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1663857#c5 | ||
notification_emails: | ||
- [email protected] | ||
expires: never | ||
|
||
unenrollment: | ||
study_id: | ||
type: string | ||
|
@@ -66,6 +81,21 @@ unenrollment: | |
- [email protected] | ||
expires: never | ||
|
||
schema_namespace: | ||
type: string | ||
lifetime: ping | ||
send_in_pings: | ||
- study-unenrollment | ||
description: | | ||
The schema namespace for the study the user has left. | ||
bugs: | ||
- https://github.com/mozilla-rally/rally-core-addon/issues/545 | ||
data_reviews: | ||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1646151#c32 | ||
notification_emails: | ||
- [email protected] | ||
expires: never | ||
|
||
user: | ||
age: | ||
type: labeled_boolean | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -91,6 +91,9 @@ | |
}, | ||
"minimumCoreVersion": { | ||
"type": "string" | ||
}, | ||
"useLegacyTelemetry": { | ||
"type": "boolean" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,20 +20,30 @@ const OFFBOARD_URL = "https://production.rally.mozilla.org/offboard"; | |
|
||
// A fake study id to use in the tests when looking for a | ||
// "known" study. | ||
const FAKE_STUDY_ID = "[email protected]"; | ||
const FAKE_STUDY_ID = "[email protected]"; | ||
const FAKE_LEGACY_STUDY_ID = "[email protected]"; | ||
const FAKE_STUDY_NAMESPACE = "fake-study-installed-namespace" | ||
const FAKE_STUDY_ID_NOT_INSTALLED = "[email protected]"; | ||
const FAKE_LEGACY_STUDY_NAMESPACE = "fake-legacy-study-installed-namespace" | ||
const FAKE_STUDY_ID_NOT_INSTALLED = "[email protected]"; | ||
const FAKE_STUDY_NOT_INSTALLED_NAMESPACE = "fake-study-not-installed-namespace" | ||
const FAKE_STUDY_LIST = [ | ||
{ | ||
"addonId": FAKE_STUDY_ID, | ||
"schemaNamespace": FAKE_STUDY_NAMESPACE, | ||
"minimumCoreVersion": "0.0.1" | ||
"minimumCoreVersion": "0.0.1", | ||
"useLegacyTelemetry": false | ||
}, | ||
{ | ||
"addonId": FAKE_LEGACY_STUDY_ID, | ||
"schemaNamespace": FAKE_LEGACY_STUDY_NAMESPACE, | ||
"minimumCoreVersion": "0.0.1", | ||
"useLegacyTelemetry": true | ||
}, | ||
{ | ||
"addonId": FAKE_STUDY_ID_NOT_INSTALLED, | ||
"schemaNamespace": FAKE_STUDY_NOT_INSTALLED_NAMESPACE, | ||
"minimumCoreVersion": "0.0.1" | ||
"minimumCoreVersion": "0.0.1", | ||
"useLegacyTelemetry": true | ||
} | ||
]; | ||
const FAKE_UUID = "c0ffeec0-ffee-c0ff-eec0-ffeec0ffeec0"; | ||
|
@@ -251,10 +261,11 @@ describe('Core', function () { | |
await this.core._enrollStudy(FAKE_STUDY_ID); | ||
|
||
assert.equal(await enrollmentMetrics.studyId.testGetValue("study-enrollment"), FAKE_STUDY_ID); | ||
assert.equal(await enrollmentMetrics.schemaNamespace.testGetValue("study-enrollment"), FAKE_STUDY_NAMESPACE); | ||
|
||
// We expect to store the fake ion ID. | ||
assert.ok( | ||
this.core._dataCollection.sendEnrollmentPing.withArgs(FAKE_UUID, FAKE_STUDY_NAMESPACE).calledOnce | ||
this.core._dataCollection.sendEnrollmentPing.withArgs(FAKE_UUID, FAKE_STUDY_NAMESPACE).notCalled | ||
); | ||
enrollmentPingMock.verify(); | ||
}); | ||
|
@@ -341,7 +352,7 @@ describe('Core', function () { | |
|
||
// We to submit a ping with the expected type. | ||
assert.ok( | ||
this.core._dataCollection.sendDeletionPing.withArgs(FAKE_UUID, FAKE_STUDY_NAMESPACE).calledOnce | ||
this.core._dataCollection.sendDeletionPing.withArgs(FAKE_UUID, FAKE_STUDY_NAMESPACE).notCalled | ||
); | ||
|
||
// Make sure that we're generating an uninstall message for | ||
|
@@ -445,7 +456,7 @@ describe('Core', function () { | |
{type: "telemetry-ping", data: {}}, | ||
{id: FAKE_STUDY_ID} | ||
), | ||
{ message: "Core._handleExternalMessage - [email protected] not joined"} | ||
{ message: `Core._handleExternalMessage - ${FAKE_STUDY_ID} not joined`} | ||
); | ||
}); | ||
}); | ||
|
@@ -486,8 +497,9 @@ describe('Core', function () { | |
describe('_fetchAvailableStudies()', function () { | ||
it('returns a list of addons', async function () { | ||
let studies = await this.core._fetchAvailableStudies(); | ||
assert.equal(studies.length, 2); | ||
assert.equal(studies.length, 3); | ||
assert.ok(studies.filter(a => (a.addonId === FAKE_STUDY_ID))); | ||
assert.ok(studies.filter(a => (a.addonId === FAKE_LEGACY_STUDY_ID))); | ||
assert.ok(studies.filter(a => (a.addonId === FAKE_STUDY_ID_NOT_INSTALLED))); | ||
}); | ||
|
||
|
@@ -507,7 +519,7 @@ describe('Core', function () { | |
// Kick off an update task. | ||
let studies = | ||
await this.core._updateInstalledStudies(FAKE_STUDY_LIST); | ||
assert.equal(studies.length, 2); | ||
assert.equal(studies.length, 3); | ||
// Check that the FAKE_STUDY_ID is marked as installed (as per | ||
// our fake data, see the beginning of this file). | ||
assert.equal(studies | ||
|
@@ -537,7 +549,7 @@ describe('Core', function () { | |
it('rejects on target study ids', async function () { | ||
assert.rejects( | ||
this.core._sendMessageToStudy(FAKE_STUDY_ID, "unknown-type-test", {}), | ||
{ message: "Core._sendMessageToStudy - unexpected message \"unknown-type-test\" to study \"[email protected]\""} | ||
{ message: `Core._sendMessageToStudy - unexpected message "unknown-type-test" to study "${FAKE_STUDY_ID}"`} | ||
); | ||
}); | ||
|
||
|
@@ -610,7 +622,7 @@ describe('Core', function () { | |
it('pauses studies properly', async function () { | ||
// Make sure the functions yield during tests! | ||
browser.storage.local.get | ||
.callsArgWith(1, {activatedStudies: [FAKE_STUDY_ID]}) | ||
.callsArgWith(1, {activatedStudies: [FAKE_STUDY_ID, FAKE_LEGACY_STUDY_ID]}) | ||
.resolves(); | ||
chrome.runtime.sendMessage.yields(); | ||
|
||
|
@@ -626,7 +638,38 @@ describe('Core', function () { | |
{}, | ||
// This is the callback hidden away by webextension-polyfill. | ||
sinon.match.any | ||
).calledOnce | ||
).calledOnce, | ||
chrome.runtime.sendMessage.withArgs( | ||
FAKE_LEGACY_STUDY_ID, | ||
sinon.match({type: "pause", data: {}}), | ||
// We're not providing any option. | ||
{}, | ||
// This is the callback hidden away by webextension-polyfill. | ||
sinon.match.any | ||
).notCalled | ||
); | ||
|
||
const fakeLegacyStudy = FAKE_STUDY_LIST[1]; | ||
fakeLegacyStudy.studyPaused = true; | ||
await this.core._sendRunState(FAKE_STUDY_LIST, [FAKE_LEGACY_STUDY_ID]); | ||
|
||
assert.ok( | ||
chrome.runtime.sendMessage.withArgs( | ||
FAKE_LEGACY_STUDY_ID, | ||
sinon.match({type: "pause", data: {}}), | ||
// We're not providing any option. | ||
{}, | ||
// This is the callback hidden away by webextension-polyfill. | ||
sinon.match.any | ||
).calledOnce, | ||
chrome.runtime.sendMessage.withArgs( | ||
FAKE_STUDY_ID, | ||
sinon.match({type: "pause", data: {}}), | ||
// We're not providing any option. | ||
{}, | ||
// This is the callback hidden away by webextension-polyfill. | ||
sinon.match.any | ||
).notCalled | ||
); | ||
}); | ||
|
||
|
@@ -637,9 +680,9 @@ describe('Core', function () { | |
.resolves(); | ||
chrome.runtime.sendMessage.yields(); | ||
|
||
const fakeStudy = FAKE_STUDY_LIST[0]; | ||
fakeStudy.studyPaused = true; | ||
await this.core._sendRunState(FAKE_STUDY_LIST, [FAKE_STUDY_ID]); | ||
const fakeLegacyStudy = FAKE_STUDY_LIST[1]; | ||
fakeLegacyStudy.studyPaused = true; | ||
await this.core._sendRunState(FAKE_STUDY_LIST, [FAKE_LEGACY_STUDY_ID]); | ||
|
||
sinon.spy(this.core._dataCollection, "sendPing"); | ||
|
||
|
@@ -671,7 +714,7 @@ describe('Core', function () { | |
{type: "telemetry-ping", data: SENT_PING}, | ||
{id: FAKE_STUDY_ID} | ||
), | ||
{ message: "Core._handleExternalMessage - [email protected] is paused and may not send data"} | ||
{ message: `Core._handleExternalMessage - ${FAKE_STUDY_ID} is paused and may not send data`} | ||
); | ||
|
||
assert.ok( | ||
|
@@ -712,6 +755,8 @@ describe('Core', function () { | |
await this.core._unenrollStudy(FAKE_STUDY_ID); | ||
|
||
assert.equal(await unenrollmentMetrics.studyId.testGetValue("study-unenrollment"), FAKE_STUDY_ID); | ||
assert.equal(await unenrollmentMetrics.schemaNamespace.testGetValue("study-unenrollment"), FAKE_STUDY_NAMESPACE); | ||
|
||
unenrollmentPingMock.verify(); | ||
}); | ||
|
||
|
@@ -739,7 +784,7 @@ describe('Core', function () { | |
// Attempt to unenroll from the study. | ||
assert.rejects( | ||
this.core._unenrollStudy(FAKE_STUDY_ID), | ||
{ message: "Core._unenrollStudy - Unenrolling study which has ended, not sending deletion pings for [email protected]"} | ||
{ message: `Core._unenrollStudy - Unenrolling study which has ended, not sending deletion pings for ${FAKE_STUDY_ID}`} | ||
); | ||
|
||
// No unenrollment pings are sent. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters