Skip to content

Instantly share code, notes, and snippets.

@badboy
Created November 18, 2021 13:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save badboy/04b7c09d42568bcd3910b193f45c9e2e to your computer and use it in GitHub Desktop.
Save badboy/04b7c09d42568bcd3910b193f45c9e2e to your computer and use it in GitHub Desktop.
diff --git toolkit/components/glean/tests/xpcshell/test_FOGPrefs.js toolkit/components/glean/tests/xpcshell/test_FOGPrefs.js
index 6cfeec020da69..227e1bbbdeee4 100644
--- toolkit/components/glean/tests/xpcshell/test_FOGPrefs.js
+++ toolkit/components/glean/tests/xpcshell/test_FOGPrefs.js
@@ -9,14 +9,17 @@ const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
// FOG needs a profile directory to put its data in.
do_get_profile();
-const FOG = Cc["@mozilla.org/toolkit/glean;1"].createInstance(Ci.nsIFOG);
-// We need to initialize it once, otherwise operations will be stuck in the pre-init queue.
-FOG.initializeFOG();
-
const TELEMETRY_SERVER_PREF = "toolkit.telemetry.server";
const UPLOAD_PREF = "datareporting.healthreport.uploadEnabled";
const LOCALHOST_PREF = "telemetry.fog.test.localhost_port";
+const FOG = Cc["@mozilla.org/toolkit/glean;1"].createInstance(Ci.nsIFOG);
+// We want Glean to use a localhost server so we can be SURE not to send data to the outside world.
+// Yes, the port spells GLEAN on a T9 keyboard, why do you ask?
+Services.prefs.setIntPref(LOCALHOST_PREF, 45326);
+// We need to initialize it once, otherwise operations will be stuck in the pre-init queue.
+FOG.initializeFOG();
+
add_task(function test_fog_upload_only() {
// Don't forget to point the telemetry server to localhost, or Telemetry
// might make a non-local connection during the test run.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment