[infra] Fix warning when pre-approving an already approved failure.

This can happen if a test is approved as failing, it then is fixed, and a
changelist needs to break it again, and the new failure is pre-approved.
This causes approve_results to warn that it can't properly change an approval
from one outcome to the exact same outcome, which is of course wrong, it can
do that.

Change-Id: Ib9ea1d4ea5a204b66808a1789c31fe6ec9c2c9d2
Reviewed-on: https://dart-review.googlesource.com/c/86920
Reviewed-by: William Hesse <whesse@google.com>
This commit is contained in:
Jonas Termansen 2018-12-11 15:24:20 +00:00
parent b924d754c5
commit 4d63202b53

View file

@ -171,13 +171,14 @@ Future<List<Test>> loadResultsFromBot(String bot, ArgResults options,
// there is no approved result yet, use the latest result from the
// builder instead.
final baseResult = approvedResult ?? result;
if ((!wasFlake &&
if (!wasFlake &&
!tryResult["matches"] &&
tryResult["result"] != result["result"])) {
tryResult["result"] != result["result"]) {
// The approved_results.json format currently does not natively
// support preapproval, so preapproving turning one failure into
// another will turn the builder in question red until the CL lands.
if (!baseResult["matches"]) {
if (!baseResult["matches"] &&
tryResult["result"] != baseResult["result"]) {
print("Warning: Preapproving changed failure modes will turn the "
"CI red until the CL is submitted: $bot: $key: "
"${baseResult["result"]} -> ${tryResult["result"]}");