Problem/Motivation
while working on test in #3254207: Only allow 1 patch release update increment in Cron with @kunal.sachdev we noticed the validation results for cron update attempts are lost during the error logging.
We do
try {
$this->begin([
'drupal' => $recommended_version,
]);
$this->stage();
$this->apply();
$this->destroy();
}
catch (\Throwable $e) {
$this->logger->error($e->getMessage());
return;
}
So if the Update throws an UpdateException we only get the generic "Unable to complete the update because of errors." message.
Proposed resolution
If aStageValidationException is caught during a cron update attempt log all everything in getResults()
Issue fork automatic_updates-3259810
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
tedbow@kunal.sachdev just some notes here from our discussion.
To test the message logged.
\Drupal\Tests\automatic_updates\Kernel\CronUpdaterTest()array $validation_errors, string $expected_log_message.TestChecker1::setTestResult($validation_errors, PreCreateEvent::class);to force an error in the Updater during cron. (see \Drupal\Tests\automatic_updates\Functional\UpdaterFormTest::testUpdateErrors)\Drupal\Tests\automatic_updates\Functional\UpdaterFormTest::assertUpdateStagedTimes()to a shared trait for this.Comment #5
tedbowComment #7
phenaproximaAlthough I contributed to this, I mostly just did minor cleanup. Therefore I feel okay RTBCing this.
Comment #9
tedbow