Make build tests fail 1) more explicitly, 2) earlier when possible (failing StatusCheckEvent subscribers)

Created on 11 November 2022, about 2 years ago
Updated 31 January 2023, almost 2 years ago

Problem/Motivation

πŸ› xdebug being enabled causes tests to fail without clear indication that it is the problem Fixed we found the if the xdebug validator failed then \Drupal\Tests\automatic_updates\Build\CoreUpdateTest::testCron would fail at $assert_session->pageTextContains('Your site is ready for automatic updates.');

Basically this check if meant to confirm that there no status check validation errors or warning for Automatic Updates.
But the message is not very helpful because it does not tell you what error is on the page.

in #3320782 we will solve this xdebug but in general if a status check has error or warning this be displayed in the test failure

Steps to reproduce

To see the difference this merge you have to get a validator to fail. We will force 1 for example but problems in your local set-up or a logic error in our build tests could cause this to happen.

Run these steps in first 8.x-2.x then the merge request branch

  1. Cause ComposerSettingsValidator to fail by changing

    if ($config->get('secure-http') !== TRUE) {
    to
    if ($config->get('secure-http') !== FALSE) {

  2. Run \Drupal\Tests\automatic_updates\Build\CoreUpdateTest::testCron

In 8.x-2.x the failure should be

Behat\Mink\Exception\ResponseTextException : The text "Your site is ready for automatic updates." was not found anywhere in the text of the current page.

in the merge request branch the error should be

Unexpected status check output on the status report page:
HTTPS must be enabled for Composer downloads. See the Composer documentation for more information.

Simply searching for "HTTPS must be enabled for Composer downloads" will find you the validator that is failing. "Your site is ready for automatic updates." not being on your page tells you either, the report didn't load at all because of some error or it did load and there was some error with some unknown validator.

With the same change to ComposerSettingsValidator running \Drupal\Tests\automatic_updates\Build\CoreUpdateTest::testUi will result in this error

Behat\Mink\Exception\ElementNotFoundException : Button with id|name|title|alt|value "Update to 9.8.1" not found.
/Users/ted.bowman/sites/au-contrib/vendor/behat/mink/src/Element/TraversableElement.php:112
/Users/ted.bowman/sites/au-contrib/modules/automatic_updates/tests/src/Build/CoreUpdateTest.php:112

while the merge request again would fail with

Unexpected status check output on the status report page:
HTTPS must be enabled for Composer downloads. See the Composer documentation for more information.

Proposed resolution

Actually display the status check errors

Remaining tasks

User interface changes

API changes

Data model changes

πŸ“Œ Task
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States tedbow Ithaca, NY, USA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024