Bug 1754527 - Adds test coverage for Glean experiment API to browser_remotesettingsexperimentloader_remote_default.js r=barret
☠☠ backed out by 50325734e7a7 ☠ ☠
authorTravis Long <tlong@mozilla.com>
Tue, 10 May 2022 23:19:16 +0000
changeset 616940 24ae57f9c2bb4719e9cc1d4bcb4597a7cda9722b
parent 616939 93e08f7a934a3777615d6ab7a32df502216087d5
child 616941 59c5271c6ec5837a874abe05548fbfb3540bac6b
push id39680
push userbszekely@mozilla.com
push dateWed, 11 May 2022 09:42:52 +0000
treeherdermozilla-central@87443e31b7c0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbarret
bugs1754527
milestone102.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1754527 - Adds test coverage for Glean experiment API to browser_remotesettingsexperimentloader_remote_default.js r=barret Differential Revision: https://phabricator.services.mozilla.com/D145965
toolkit/components/nimbus/test/browser/browser_remotesettingsexperimentloader_remote_defaults.js
toolkit/components/nimbus/test/unit/test_ExperimentManager_enroll.js
toolkit/components/nimbus/test/unit/test_ExperimentManager_unenroll.js
--- a/toolkit/components/nimbus/test/browser/browser_remotesettingsexperimentloader_remote_defaults.js
+++ b/toolkit/components/nimbus/test/browser/browser_remotesettingsexperimentloader_remote_defaults.js
@@ -204,16 +204,28 @@ add_task(async function test_remote_fetc
       {
         type: "nimbus-rollout",
         enrollmentId: sinon.match.string,
       }
     ),
     "should call setExperimentActive with `bar` feature"
   );
 
+  // Test Glean experiment API interaction
+  Assert.equal(
+    Services.fog.testGetExperimentData(REMOTE_CONFIGURATION_FOO.slug).branch,
+    REMOTE_CONFIGURATION_FOO.branches[0].slug,
+    "Glean.setExperimentActive called with `foo` feature"
+  );
+  Assert.equal(
+    Services.fog.testGetExperimentData(REMOTE_CONFIGURATION_BAR.slug).branch,
+    REMOTE_CONFIGURATION_BAR.branches[0].slug,
+    "Glean.setExperimentActive called with `bar` feature"
+  );
+
   Assert.equal(fooInstance.getVariable("remoteValue"), 42, "Has rollout value");
   Assert.equal(barInstance.getVariable("remoteValue"), 3, "Has rollout value");
 
   // Clear RS db and load again. No configurations so should clear the cache.
   await rsClient.db.clear();
   await RemoteSettingsExperimentLoader.updateRecipes(
     "browser_rsel_remote_defaults"
   );
--- a/toolkit/components/nimbus/test/unit/test_ExperimentManager_enroll.js
+++ b/toolkit/components/nimbus/test/unit/test_ExperimentManager_enroll.js
@@ -30,17 +30,17 @@ globalSandbox.spy(TelemetryEnvironment, 
 globalSandbox.spy(TelemetryEvents, "sendEvent");
 registerCleanupFunction(() => {
   globalSandbox.restore();
 });
 
 /**
  * FOG requires a little setup in order to test it
  */
-add_task(function test_setup() {
+add_setup(function test_setup() {
   // FOG needs a profile directory to put its data in.
   do_get_profile();
 
   // FOG needs to be initialized in order for data to flow.
   Services.fog.initializeFOG();
 });
 
 /**
--- a/toolkit/components/nimbus/test/unit/test_ExperimentManager_unenroll.js
+++ b/toolkit/components/nimbus/test/unit/test_ExperimentManager_unenroll.js
@@ -13,17 +13,17 @@ globalSandbox.spy(TelemetryEnvironment, 
 globalSandbox.spy(TelemetryEvents, "sendEvent");
 registerCleanupFunction(() => {
   globalSandbox.restore();
 });
 
 /**
  * FOG requires a little setup in order to test it
  */
-add_task(function test_setup() {
+add_setup(function test_setup() {
   // FOG needs a profile directory to put its data in.
   do_get_profile();
 
   // FOG needs to be initialized in order for data to flow.
   Services.fog.initializeFOG();
 });
 
 /**