bug 1366294 - Part 8 - Include a message on telemetry testfails. r=gfritzsche
☠☠ backed out by dbb8be04d8ce ☠ ☠
authorChris H-C <chutten@mozilla.com>
Fri, 23 Jun 2017 16:39:59 -0400
changeset 418917 43fb00c0f96d9df2cac763744eed061298763a57
parent 418916 ccf043ec6160e90aeded92607d64451445c701fa
child 418918 0ed44ecf9062ac9486cd379870e2376f3a8b119a
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgfritzsche
bugs1366294
milestone56.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 1366294 - Part 8 - Include a message on telemetry testfails. r=gfritzsche I just added some short identifiable messages to help identify which part of the test failed. MozReview-Commit-ID: 3AX2iucGiRx
toolkit/components/telemetry/tests/unit/test_TelemetrySession.js
--- a/toolkit/components/telemetry/tests/unit/test_TelemetrySession.js
+++ b/toolkit/components/telemetry/tests/unit/test_TelemetrySession.js
@@ -774,44 +774,44 @@ add_task(async function test_checkSubses
     "TELEMETRY_TEST_KEYED_RELEASE_OPTOUT",
   ]);
 
   // Compare the two sets of histograms.
   // The "subsession" histograms should match the registered
   // "classic" histograms. However, histograms can change
   // between us collecting the different payloads, so we only
   // check for deep equality on known stable histograms.
-  let checkHistograms = (classic, subsession) => {
+  let checkHistograms = (classic, subsession, message) => {
     for (let id of Object.keys(classic)) {
       if (!registeredIds.has(id)) {
         continue;
       }
 
-      Assert.ok(id in subsession);
+      Assert.ok(id in subsession, message + ` (${id})`);
       if (stableHistograms.has(id)) {
         Assert.deepEqual(classic[id],
-                         subsession[id]);
+                         subsession[id], message);
       } else {
         Assert.equal(classic[id].histogram_type,
-                     subsession[id].histogram_type);
+                     subsession[id].histogram_type, message);
       }
     }
   };
 
   // Same as above, except for keyed histograms.
-  let checkKeyedHistograms = (classic, subsession) => {
+  let checkKeyedHistograms = (classic, subsession, message) => {
     for (let id of Object.keys(classic)) {
       if (!registeredIds.has(id)) {
         continue;
       }
 
-      Assert.ok(id in subsession);
+      Assert.ok(id in subsession, message);
       if (stableKeyedHistograms.has(id)) {
         Assert.deepEqual(classic[id],
-                         subsession[id]);
+                         subsession[id], message);
       }
     }
   };
 
   // Both classic and subsession payload histograms should start the same.
   // The payloads should be identical for now except for the reason.
   count.clear();
   keyed.clear();
@@ -820,80 +820,80 @@ add_task(async function test_checkSubses
 
   Assert.equal(classic.info.reason, "gather-payload");
   Assert.equal(subsession.info.reason, "environment-change");
   Assert.ok(!(COUNT_ID in classic.histograms));
   Assert.ok(!(COUNT_ID in subsession.histograms));
   Assert.ok(!(KEYED_ID in classic.keyedHistograms));
   Assert.ok(!(KEYED_ID in subsession.keyedHistograms));
 
-  checkHistograms(classic.histograms, subsession.histograms);
-  checkKeyedHistograms(classic.keyedHistograms, subsession.keyedHistograms);
+  checkHistograms(classic.histograms, subsession.histograms, "Should start the same");
+  checkKeyedHistograms(classic.keyedHistograms, subsession.keyedHistograms, "Keyed should start the same");
 
   // Adding values should get picked up in both.
   count.add(1);
   keyed.add("a", 1);
   keyed.add("b", 1);
   classic = TelemetrySession.getPayload();
   subsession = TelemetrySession.getPayload("environment-change");
 
   Assert.ok(COUNT_ID in classic.histograms);
   Assert.ok(COUNT_ID in subsession.histograms);
   Assert.ok(KEYED_ID in classic.keyedHistograms);
   Assert.ok(KEYED_ID in subsession.keyedHistograms);
   Assert.equal(classic.histograms[COUNT_ID].sum, 1);
   Assert.equal(classic.keyedHistograms[KEYED_ID]["a"].sum, 1);
   Assert.equal(classic.keyedHistograms[KEYED_ID]["b"].sum, 1);
 
-  checkHistograms(classic.histograms, subsession.histograms);
-  checkKeyedHistograms(classic.keyedHistograms, subsession.keyedHistograms);
+  checkHistograms(classic.histograms, subsession.histograms, "Added values should be picked up");
+  checkKeyedHistograms(classic.keyedHistograms, subsession.keyedHistograms, "Added values should be picked up by keyed");
 
   // Values should still reset properly.
   count.clear();
   keyed.clear();
   classic = TelemetrySession.getPayload();
   subsession = TelemetrySession.getPayload("environment-change");
 
   Assert.ok(!(COUNT_ID in classic.histograms));
   Assert.ok(!(COUNT_ID in subsession.histograms));
   Assert.ok(!(KEYED_ID in classic.keyedHistograms));
   Assert.ok(!(KEYED_ID in subsession.keyedHistograms));
 
-  checkHistograms(classic.histograms, subsession.histograms);
-  checkKeyedHistograms(classic.keyedHistograms, subsession.keyedHistograms);
+  checkHistograms(classic.histograms, subsession.histograms, "Values should reset");
+  checkKeyedHistograms(classic.keyedHistograms, subsession.keyedHistograms, "Keyed values should reset");
 
   // Adding values should get picked up in both.
   count.add(1);
   keyed.add("a", 1);
   keyed.add("b", 1);
   classic = TelemetrySession.getPayload();
   subsession = TelemetrySession.getPayload("environment-change");
 
   Assert.ok(COUNT_ID in classic.histograms);
   Assert.ok(COUNT_ID in subsession.histograms);
   Assert.ok(KEYED_ID in classic.keyedHistograms);
   Assert.ok(KEYED_ID in subsession.keyedHistograms);
   Assert.equal(classic.histograms[COUNT_ID].sum, 1);
   Assert.equal(classic.keyedHistograms[KEYED_ID]["a"].sum, 1);
   Assert.equal(classic.keyedHistograms[KEYED_ID]["b"].sum, 1);
 
-  checkHistograms(classic.histograms, subsession.histograms);
-  checkKeyedHistograms(classic.keyedHistograms, subsession.keyedHistograms);
+  checkHistograms(classic.histograms, subsession.histograms, "Adding values should be picked up again");
+  checkKeyedHistograms(classic.keyedHistograms, subsession.keyedHistograms, "Adding values should be picked up by keyed again");
 
   // We should be able to reset only the subsession histograms.
   // First check that "snapshot and clear" still returns the old state...
   classic = TelemetrySession.getPayload();
   subsession = TelemetrySession.getPayload("environment-change", true);
 
   let subsessionStartDate = new Date(classic.info.subsessionStartDate);
   Assert.equal(subsessionStartDate.toISOString(), expectedDate.toISOString());
   subsessionStartDate = new Date(subsession.info.subsessionStartDate);
   Assert.equal(subsessionStartDate.toISOString(), expectedDate.toISOString());
-  checkHistograms(classic.histograms, subsession.histograms);
-  checkKeyedHistograms(classic.keyedHistograms, subsession.keyedHistograms);
+  checkHistograms(classic.histograms, subsession.histograms, "Should be able to reset subsession");
+  checkKeyedHistograms(classic.keyedHistograms, subsession.keyedHistograms, "Should be able to reset subsession keyed");
 
   // ... then check that the next snapshot shows the subsession
   // histograms got reset.
   classic = TelemetrySession.getPayload();
   subsession = TelemetrySession.getPayload("environment-change");
 
   Assert.ok(COUNT_ID in classic.histograms);
   Assert.ok(COUNT_ID in subsession.histograms);