зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1725240 - Persist Nimbus experiment featureIds field to disk r=k88hudson
Differential Revision: https://phabricator.services.mozilla.com/D122724
This commit is contained in:
Родитель
30455ed1d8
Коммит
367ad55539
|
@ -208,6 +208,7 @@ class _ExperimentManager {
|
|||
experimentType = TELEMETRY_DEFAULT_EXPERIMENT_TYPE,
|
||||
userFacingName,
|
||||
userFacingDescription,
|
||||
featureIds,
|
||||
},
|
||||
branch,
|
||||
source,
|
||||
|
@ -224,6 +225,7 @@ class _ExperimentManager {
|
|||
userFacingName,
|
||||
userFacingDescription,
|
||||
lastSeen: new Date().toJSON(),
|
||||
featureIds,
|
||||
};
|
||||
|
||||
// Tag this as a forced enrollment. This prevents all unenrolling unless
|
||||
|
|
|
@ -72,6 +72,11 @@
|
|||
"force": {
|
||||
"type": "boolean",
|
||||
"description": "(debug) If the enrollment happened naturally or through devtools"
|
||||
},
|
||||
"featureIds": {
|
||||
"type": "array",
|
||||
"items": [{ "type": "string" }],
|
||||
"description": "Array of strings corresponding to the branch features in the enrollment."
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
|
|
|
@ -289,6 +289,7 @@ const ExperimentFakes = {
|
|||
},
|
||||
userFacingName: "Nimbus recipe",
|
||||
userFacingDescription: "NimbusTestUtils recipe",
|
||||
featureIds: ["test-feature"],
|
||||
...props,
|
||||
};
|
||||
},
|
||||
|
|
|
@ -318,3 +318,24 @@ add_task(async function test_forceEnroll_cleanup() {
|
|||
|
||||
sandbox.restore();
|
||||
});
|
||||
|
||||
add_task(async function test_featureIds_is_stored() {
|
||||
Services.prefs.setStringPref("messaging-system.log", "all");
|
||||
const recipe = ExperimentFakes.recipe("featureIds");
|
||||
// Ensure we get enrolled
|
||||
recipe.bucketConfig.count = recipe.bucketConfig.total;
|
||||
const manager = ExperimentFakes.manager();
|
||||
|
||||
await manager.onStartup();
|
||||
|
||||
await manager.enroll(recipe, "test_featureIds_is_stored");
|
||||
|
||||
Assert.ok(manager.store.addExperiment.calledOnce, "experiment is stored");
|
||||
let [enrollment] = manager.store.addExperiment.firstCall.args;
|
||||
Assert.ok("featureIds" in enrollment, "featureIds is stored");
|
||||
Assert.deepEqual(
|
||||
enrollment.featureIds,
|
||||
["test-feature"],
|
||||
"Has expected value"
|
||||
);
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче