Problem/Motivation

Test-only job sometimes report as successfull even if there are failures in tests, see:

https://git.drupalcode.org/project/drupal/-/jobs/506479

There were 4 errors:
1) Drupal\Tests\system\Functional\Pager\PagerTest::testActiveClass
Error: Class "Drupal\Core\Cache\MemoryCache\MemoryCacheFactory" not found
...
There was 1 failure:
1) Drupal\Tests\user\Kernel\UserPassRehashTest::testUniqueHashNoPasswordValue
...

And still:

Job succeeded

From the Slack discussion with @fjgarlin:

test-only tests are run using phpunit, whereas the whole suite uses run-tests.sh, so that might explain why phpunit is not catching the exception.we have some try/catch blocks on run-tests.sh and on some test base classes that might capture that and not reported

Steps to reproduce

See: https://git.drupalcode.org/project/drupal/-/jobs/506479

Proposed resolution

Fix the error checking.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Issue fork drupal-3409733

Command icon 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

poker10 created an issue. See original summary.

fjgarlin’s picture

Note that the report shows them as errors: https://git.drupalcode.org/project/drupal/-/pipelines/65788/test_report

I think the reason for this is that the job is taking the exit code of the last command being run (https://stackoverflow.com/questions/70820135/gitlab-make-the-ci-cd-faile...). If we see the reported job, the last tests being run are actually successful, so it's taking the status from that last command.

So we need to capture if there was any error during the script and then add an exit 1 in that case.

james.williams made their first commit to this issue’s fork.

james.williams’s picture

Status: Active » Needs review

Thanks for your guidance @fjgarlin - hopefully !8466 is along the right lines?

fjgarlin’s picture

The code changes look correct to me and hopefully that's all that's needed. Now we need to verify it. Two options:
- Bring the test files from that other job to this MR, run the test only, then remove those changes.
- Bring the changes from this MR to that other issue, run the test only, then remove the changes.

With that, I'd be happy to RTBC.

fjgarlin’s picture

Status: Needs review » Reviewed & tested by the community

Based on the code review I did before and this run https://git.drupalcode.org/issue/drupal-3454196/-/pipelines/203616 which verifies the fix in both the top level Test-only job and the per-version test-only job, I am marking this RTBC.

  • longwave committed cdd8d3cc on 10.3.x
    Issue #3409733 by james.williams, fjgarlin, poker10: Test-only job does...

  • longwave committed 2d0757fd on 10.4.x
    Issue #3409733 by james.williams, fjgarlin, poker10: Test-only job does...

  • longwave committed 1c3d9629 on 11.0.x
    Issue #3409733 by james.williams, fjgarlin, poker10: Test-only job does...

  • longwave committed 0ac3d2a0 on 11.x
    Issue #3409733 by james.williams, fjgarlin, poker10: Test-only job does...
longwave’s picture

Version: 11.x-dev » 10.3.x-dev
Status: Reviewed & tested by the community » Fixed

Committed and pushed 0ac3d2a036 to 11.x and 1c3d9629f4 to 11.0.x and 2d0757fde1 to 10.4.x and cdd8d3cc14 to 10.3.x. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.