зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1477255: offer context.environment as well as context.normandy r=leplatrem
Differential Revision: https://phabricator.services.mozilla.com/D15530 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
70b1934e2e
Коммит
2bff1b287f
|
@ -284,6 +284,8 @@ var RecipeRunner = {
|
||||||
arguments: recipe.arguments,
|
arguments: recipe.arguments,
|
||||||
};
|
};
|
||||||
return {
|
return {
|
||||||
|
environment,
|
||||||
|
// Backwards compatibility -- see bug 1477255.
|
||||||
normandy: environment,
|
normandy: environment,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
|
@ -37,26 +37,29 @@ add_task(async function getFilterContext() {
|
||||||
"version",
|
"version",
|
||||||
];
|
];
|
||||||
for (const key of expectedNormandyKeys) {
|
for (const key of expectedNormandyKeys) {
|
||||||
|
ok(key in context.environment, `environment.${key} is available`);
|
||||||
ok(key in context.normandy, `normandy.${key} is available`);
|
ok(key in context.normandy, `normandy.${key} is available`);
|
||||||
}
|
}
|
||||||
|
Assert.deepEqual(context.normandy, context.environment,
|
||||||
|
"context offers normandy as backwards-compatible alias for context.environment");
|
||||||
|
|
||||||
is(
|
is(
|
||||||
context.normandy.recipe.id,
|
context.environment.recipe.id,
|
||||||
recipe.id,
|
recipe.id,
|
||||||
"normandy.recipe is the recipe passed to getFilterContext",
|
"environment.recipe is the recipe passed to getFilterContext",
|
||||||
);
|
);
|
||||||
delete recipe.unrelated;
|
delete recipe.unrelated;
|
||||||
Assert.deepEqual(
|
Assert.deepEqual(
|
||||||
context.normandy.recipe,
|
context.environment.recipe,
|
||||||
recipe,
|
recipe,
|
||||||
"normandy.recipe drops unrecognized attributes from the recipe",
|
"environment.recipe drops unrecognized attributes from the recipe",
|
||||||
);
|
);
|
||||||
|
|
||||||
// Filter context attributes are cached.
|
// Filter context attributes are cached.
|
||||||
await SpecialPowers.pushPrefEnv({set: [["app.normandy.user_id", "some id"]]});
|
await SpecialPowers.pushPrefEnv({set: [["app.normandy.user_id", "some id"]]});
|
||||||
is(context.normandy.userId, "some id", "User id is read from prefs when accessed");
|
is(context.environment.userId, "some id", "User id is read from prefs when accessed");
|
||||||
await SpecialPowers.pushPrefEnv({set: [["app.normandy.user_id", "real id"]]});
|
await SpecialPowers.pushPrefEnv({set: [["app.normandy.user_id", "real id"]]});
|
||||||
is(context.normandy.userId, "some id", "userId was cached");
|
is(context.environment.userId, "some id", "userId was cached");
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче