Bug 1553062 - Send events on Normandy recipe runner start/end r=mythmon

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Mathieu Leplatre 2019-05-22 18:02:21 +00:00
parent d3e6eadc70
commit b02582a13a
2 changed files with 23 additions and 0 deletions

View File

@ -199,6 +199,7 @@ var RecipeRunner = {
}, },
async run() { async run() {
Services.obs.notifyObservers(null, "recipe-runner:start");
this.clearCaches(); this.clearCaches();
// Unless lazy classification is enabled, prep the classify cache. // Unless lazy classification is enabled, prep the classify cache.
if (!Services.prefs.getBoolPref(LAZY_CLASSIFY_PREF, false)) { if (!Services.prefs.getBoolPref(LAZY_CLASSIFY_PREF, false)) {
@ -241,6 +242,7 @@ var RecipeRunner = {
await actions.finalize(); await actions.finalize();
await Uptake.reportRunner(Uptake.RUNNER_SUCCESS); await Uptake.reportRunner(Uptake.RUNNER_SUCCESS);
Services.obs.notifyObservers(null, "recipe-runner:end");
}, },
/** /**

View File

@ -127,6 +127,27 @@ decorate_task(
} }
); );
decorate_task(
withStub(Uptake, "reportRunner"),
withStub(RecipeRunner, "loadRecipes"),
withStub(ActionsManager.prototype, "finalize"),
async function testRunEvents(
reportRunnerStub,
loadRecipesStub,
finalizeStub,
) {
loadRecipesStub.returns(Promise.resolve([]));
const startPromise = TestUtils.topicObserved("recipe-runner:start");
const endPromise = TestUtils.topicObserved("recipe-runner:end");
await RecipeRunner.run();
// Will timeout if notifications were not received.
await startPromise;
await endPromise;
}
);
decorate_task( decorate_task(
withPrefEnv({ withPrefEnv({
set: [ set: [