Bug 1554178 - Disable events sampling for uptake telemetry tests r=glasserc

Differential Revision: https://phabricator.services.mozilla.com/D32484

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Mathieu Leplatre 2019-05-27 07:35:45 +00:00
parent 3f41c3104f
commit 9871d095db
4 changed files with 58 additions and 52 deletions

View File

@ -198,3 +198,17 @@ function checkUptakeTelemetry(snapshot1, snapshot2, expectedIncrements) {
equal(expected, actual, `check events for ${status}`);
}
}
async function withFakeChannel(channel, f) {
const module = ChromeUtils.import("resource://services-common/uptake-telemetry.js", null);
const oldPolicy = module.Policy;
module.Policy = {
...oldPolicy,
getChannel: () => channel,
};
try {
return await f();
} finally {
module.Policy = oldPolicy;
}
}

View File

@ -20,20 +20,6 @@ async function withFakeClientID(uuid, f) {
}
}
async function withFakeChannel(channel, f) {
const module = ChromeUtils.import("resource://services-common/uptake-telemetry.js", null);
const oldPolicy = module.Policy;
module.Policy = {
...oldPolicy,
getChannel: () => channel,
};
try {
return await f();
} finally {
module.Policy = oldPolicy;
}
}
add_task(async function test_unknown_status_is_not_reported() {
const source = "update-source";
const startHistogram = getUptakeTelemetrySnapshot(source);

View File

@ -344,12 +344,14 @@ add_task(async function test_telemetry_if_sync_succeeds() {
add_task(clear_state);
add_task(async function test_synchronization_duration_is_reported_in_uptake_status() {
await withFakeChannel("nightly", async () => {
await client.maybeSync(2000);
TelemetryTestUtils.assertEvents([
["uptake.remotecontent.result", "uptake", "remotesettings", UptakeTelemetry.STATUS.SUCCESS,
{ source: client.identifier, duration: (v) => v > 0, trigger: "manual" }],
]);
});
});
add_task(clear_state);

View File

@ -303,6 +303,7 @@ add_task(clear_state);
add_task(async function test_age_of_data_is_reported_in_uptake_status() {
await withFakeChannel("nightly", async () => {
const serverTime = 1552323900000;
server.registerPathHandler(CHANGES_PATH, serveChangesEntries(serverTime, [{
id: "b6ba7fab-a40a-4d03-a4af-6b627f3c5b36",
@ -320,10 +321,12 @@ add_task(async function test_age_of_data_is_reported_in_uptake_status() {
["uptake.remotecontent.result", "uptake", "remotesettings", UptakeTelemetry.STATUS.SUCCESS,
{ source: TELEMETRY_HISTOGRAM_SYNC_KEY, duration: () => true, trigger: "manual" }],
]);
});
});
add_task(clear_state);
add_task(async function test_synchronization_duration_is_reported_in_uptake_status() {
await withFakeChannel("nightly", async () => {
server.registerPathHandler(CHANGES_PATH, serveChangesEntries(10000, [{
id: "b6ba7fab-a40a-4d03-a4af-6b627f3c5b36",
last_modified: 42,
@ -344,6 +347,7 @@ add_task(async function test_synchronization_duration_is_reported_in_uptake_stat
["uptake.remotecontent.result", "uptake", "remotesettings", "success",
{ source: TELEMETRY_HISTOGRAM_SYNC_KEY, duration: (v) => v >= 1000, trigger: "manual" }],
]);
});
});
add_task(clear_state);