зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1530508: convert reportRecipe to take the recipe, not just its ID r=mythmon
This will make it easier to report recipe freshness. Differential Revision: https://phabricator.services.mozilla.com/D22016 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
b112738bcb
Коммит
7d8f7c1313
|
@ -113,7 +113,7 @@ class BaseAction {
|
|||
}
|
||||
|
||||
if (this.state !== BaseAction.STATE_READY) {
|
||||
Uptake.reportRecipe(recipe.id, Uptake.RECIPE_ACTION_DISABLED);
|
||||
Uptake.reportRecipe(recipe, Uptake.RECIPE_ACTION_DISABLED);
|
||||
this.log.warn(`Skipping recipe ${recipe.name} because ${this.name} was disabled during preExecution.`);
|
||||
return;
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ class BaseAction {
|
|||
let [valid, validatedArguments] = JsonSchemaValidator.validateAndParseParameters(recipe.arguments, this.schema);
|
||||
if (!valid) {
|
||||
Cu.reportError(new Error(`Arguments do not match schema. arguments: ${JSON.stringify(recipe.arguments)}. schema: ${JSON.stringify(this.schema)}`));
|
||||
Uptake.reportRecipe(recipe.id, Uptake.RECIPE_EXECUTION_ERROR);
|
||||
Uptake.reportRecipe(recipe, Uptake.RECIPE_EXECUTION_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -134,7 +134,7 @@ class BaseAction {
|
|||
Cu.reportError(err);
|
||||
status = Uptake.RECIPE_EXECUTION_ERROR;
|
||||
}
|
||||
Uptake.reportRecipe(recipe.id, status);
|
||||
Uptake.reportRecipe(recipe, status);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -117,13 +117,13 @@ class ActionsManager {
|
|||
status = Uptake.RECIPE_EXECUTION_ERROR;
|
||||
}
|
||||
}
|
||||
Uptake.reportRecipe(recipe.id, status);
|
||||
Uptake.reportRecipe(recipe, status);
|
||||
} else {
|
||||
log.error(
|
||||
`Could not execute recipe ${recipe.name}:`,
|
||||
`Action ${recipe.action} is either missing or invalid.`
|
||||
);
|
||||
Uptake.reportRecipe(recipe.id, Uptake.RECIPE_INVALID_ACTION);
|
||||
Uptake.reportRecipe(recipe, Uptake.RECIPE_INVALID_ACTION);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,8 +35,8 @@ var Uptake = {
|
|||
UptakeTelemetry.report(COMPONENT, status, { source: `${COMPONENT}/runner` });
|
||||
},
|
||||
|
||||
reportRecipe(recipeId, status) {
|
||||
UptakeTelemetry.report(COMPONENT, status, { source: `${COMPONENT}/recipe/${recipeId}` });
|
||||
reportRecipe(recipe, status) {
|
||||
UptakeTelemetry.report(COMPONENT, status, { source: `${COMPONENT}/recipe/${recipe.id}` });
|
||||
},
|
||||
|
||||
reportAction(actionName, status) {
|
||||
|
|
|
@ -85,7 +85,7 @@ decorate_task(
|
|||
["test-remote-action-used", Uptake.ACTION_SUCCESS],
|
||||
["test-remote-action-unused", Uptake.ACTION_SUCCESS],
|
||||
]);
|
||||
Assert.deepEqual(reportRecipeStub.args, [[recipe.id, Uptake.RECIPE_SUCCESS]]);
|
||||
Assert.deepEqual(reportRecipeStub.args, [[recipe, Uptake.RECIPE_SUCCESS]]);
|
||||
},
|
||||
);
|
||||
|
||||
|
@ -128,7 +128,7 @@ decorate_task(
|
|||
Assert.deepEqual(reportActionStub.args, [
|
||||
["test-remote-action-broken", Uptake.ACTION_PRE_EXECUTION_ERROR],
|
||||
]);
|
||||
Assert.deepEqual(reportRecipeStub.args, [[recipe.id, Uptake.RECIPE_ACTION_DISABLED]]);
|
||||
Assert.deepEqual(reportRecipeStub.args, [[recipe, Uptake.RECIPE_ACTION_DISABLED]]);
|
||||
},
|
||||
);
|
||||
|
||||
|
@ -169,7 +169,7 @@ decorate_task(
|
|||
);
|
||||
|
||||
Assert.deepEqual(reportActionStub.args, [["test-remote-action-broken", Uptake.ACTION_SUCCESS]]);
|
||||
Assert.deepEqual(reportRecipeStub.args, [[recipe.id, Uptake.RECIPE_EXECUTION_ERROR]]);
|
||||
Assert.deepEqual(reportRecipeStub.args, [[recipe, Uptake.RECIPE_EXECUTION_ERROR]]);
|
||||
},
|
||||
);
|
||||
|
||||
|
@ -209,7 +209,7 @@ decorate_task(
|
|||
"sandbox holds should still be removed after a failure",
|
||||
);
|
||||
|
||||
Assert.deepEqual(reportRecipeStub.args, [[recipe.id, Uptake.RECIPE_SUCCESS]]);
|
||||
Assert.deepEqual(reportRecipeStub.args, [[recipe, Uptake.RECIPE_SUCCESS]]);
|
||||
Assert.deepEqual(reportActionStub.args, [
|
||||
["test-remote-action-broken", Uptake.ACTION_POST_EXECUTION_ERROR],
|
||||
]);
|
||||
|
|
|
@ -80,7 +80,7 @@ decorate_task(
|
|||
await action.runRecipe(recipe);
|
||||
Assert.deepEqual(
|
||||
reportRecipeStub.args,
|
||||
[[recipe.id, Uptake.RECIPE_SUCCESS]],
|
||||
[[recipe, Uptake.RECIPE_SUCCESS]],
|
||||
"per-recipe uptake telemetry should be reported",
|
||||
);
|
||||
},
|
||||
|
@ -120,7 +120,7 @@ decorate_task(
|
|||
|
||||
Assert.deepEqual(
|
||||
reportRecipeStub.args,
|
||||
[[recipe1.id, Uptake.RECIPE_SUCCESS]],
|
||||
[[recipe1, Uptake.RECIPE_SUCCESS]],
|
||||
"Only recipes executed prior to finalizer should report uptake telemetry",
|
||||
);
|
||||
},
|
||||
|
@ -151,7 +151,7 @@ decorate_task(
|
|||
|
||||
Assert.deepEqual(
|
||||
reportRecipeStub.args,
|
||||
[[recipe.id, Uptake.RECIPE_ACTION_DISABLED]],
|
||||
[[recipe, Uptake.RECIPE_ACTION_DISABLED]],
|
||||
"Recipe should report recipe status as action disabled",
|
||||
);
|
||||
|
||||
|
@ -179,7 +179,7 @@ decorate_task(
|
|||
|
||||
Assert.deepEqual(
|
||||
reportRecipeStub.args,
|
||||
[[recipe.id, Uptake.RECIPE_EXECUTION_ERROR]],
|
||||
[[recipe, Uptake.RECIPE_EXECUTION_ERROR]],
|
||||
"Recipe should report recipe execution error",
|
||||
);
|
||||
|
||||
|
@ -203,7 +203,7 @@ decorate_task(
|
|||
|
||||
Assert.deepEqual(
|
||||
reportRecipeStub.args,
|
||||
[[recipe.id, Uptake.RECIPE_SUCCESS]],
|
||||
[[recipe, Uptake.RECIPE_SUCCESS]],
|
||||
"Recipe should report success",
|
||||
);
|
||||
|
||||
|
@ -243,7 +243,7 @@ decorate_task(
|
|||
|
||||
Assert.deepEqual(
|
||||
reportRecipeStub.args,
|
||||
[[recipe.id, Uptake.RECIPE_ACTION_DISABLED]],
|
||||
[[recipe, Uptake.RECIPE_ACTION_DISABLED]],
|
||||
"Recipe should report recipe status as action disabled",
|
||||
);
|
||||
},
|
||||
|
|
|
@ -31,7 +31,7 @@ decorate_task(
|
|||
await action.runRecipe(recipe);
|
||||
is(action.lastError, null, "lastError should be null");
|
||||
Assert.deepEqual(infoStub.args, [], "no message should be logged");
|
||||
Assert.deepEqual(reportRecipeStub.args, [[recipe.id, Uptake.RECIPE_EXECUTION_ERROR]]);
|
||||
Assert.deepEqual(reportRecipeStub.args, [[recipe, Uptake.RECIPE_EXECUTION_ERROR]]);
|
||||
|
||||
reportRecipeStub.reset();
|
||||
|
||||
|
@ -40,7 +40,7 @@ decorate_task(
|
|||
await action.runRecipe(recipe);
|
||||
is(action.lastError, null, "lastError should be null");
|
||||
Assert.deepEqual(infoStub.args, [], "no message should be logged");
|
||||
Assert.deepEqual(reportRecipeStub.args, [[recipe.id, Uptake.RECIPE_EXECUTION_ERROR]]);
|
||||
Assert.deepEqual(reportRecipeStub.args, [[recipe, Uptake.RECIPE_EXECUTION_ERROR]]);
|
||||
} finally {
|
||||
infoStub.restore();
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ decorate_task(
|
|||
// runRecipe catches exceptions thrown by _run(), so
|
||||
// explicitly check for reported success here.
|
||||
Assert.deepEqual(reportRecipe.args,
|
||||
[[recipe.id, Uptake.RECIPE_SUCCESS]]);
|
||||
[[recipe, Uptake.RECIPE_SUCCESS]]);
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -68,7 +68,7 @@ decorate_task(
|
|||
Assert.deepEqual(action.log.debug.args,
|
||||
[["Skipping post-execution hook for PreferenceExperimentAction because it is disabled."]]);
|
||||
Assert.deepEqual(reportRecipe.args,
|
||||
[[recipe.id, Uptake.RECIPE_ACTION_DISABLED]]);
|
||||
[[recipe, Uptake.RECIPE_ACTION_DISABLED]]);
|
||||
Assert.deepEqual(reportAction.args,
|
||||
[[action.name, Uptake.ACTION_SUCCESS]]);
|
||||
}
|
||||
|
@ -198,7 +198,7 @@ decorate_task(
|
|||
await action.finalize();
|
||||
|
||||
Assert.deepEqual(reportRecipeStub.args,
|
||||
[[recipe.id, Uptake.RECIPE_EXECUTION_ERROR]]);
|
||||
[[recipe, Uptake.RECIPE_EXECUTION_ERROR]]);
|
||||
Assert.deepEqual(startStub.args, [], "start not called");
|
||||
// No way to get access to log message/Error thrown
|
||||
}
|
||||
|
|
|
@ -131,7 +131,7 @@ decorate_task(
|
|||
sendEventStub.assertEvents([]);
|
||||
Assert.deepEqual(
|
||||
reportRecipeStub.args,
|
||||
[[recipe.id, Uptake.RECIPE_SUCCESS]],
|
||||
[[recipe, Uptake.RECIPE_SUCCESS]],
|
||||
"recipe should be reported as succesful",
|
||||
);
|
||||
},
|
||||
|
|
Загрузка…
Ссылка в новой задаче