Make WordPress Core

Opened 11 years ago

Last modified 8 weeks ago

#34185 new defect (bug)

Excluding certain PHPUnit test groups results in "Database is dead" notice and tests terminate

Reported by: netweb Owned by:
Priority: normal Milestone: Awaiting Review
Component: Build/Test Tools Version:
Severity: normal Keywords: has-patch has-unit-tests
Cc: Focuses:

Description

When excluding certain PHPUnit groups from the full test suite the tests fail with a "Database is dead" notice.

Known groups thus far:

  • phpunit --exclude-group import
  • phpunit --exclude-group query
$ phpunit --exclude-group import
Installing...
Running as single site... To run multisite, use -c tests/phpunit/multisite.xml
PHPUnit 4.7.7 by Sebastian Bergmann and contributors.

.............................................................   61 / 4556 (  1%)
...................................SS........................  122 / 4556 (  2%)
.............................................................  183 / 4556 (  4%)
.............................................................  244 / 4556 (  5%)
.S...........................................................  305 / 4556 (  6%)
.............................................................  366 / 4556 (  8%)
.............................................................  427 / 4556 (  9%)
.............................................................  488 / 4556 ( 10%)
.............................................................  549 / 4556 ( 12%)
.............................................................  610 / 4556 ( 13%)
.....................S....S..................................  671 / 4556 ( 14%)
................................................S............  732 / 4556 ( 16%)
.............................................................  793 / 4556 ( 17%)
..................................Database is dead.

Change History (5)

#1 @netweb
11 years ago

Adding another known case: phpunit --exclude-group xmlrpc

#2 @isabel_brison
6 years ago

I tested this using the test:php npm script, and found that the tests abort no matter what group I name after --exclude-group. Output is:

...........................................................    59 / 12551 (  0%)
...........................................................   118 / 12551 (  0%)
...............................EE..........................   177 / 12551 (  1%)
........................................EE...............E.   236 / 12551 (  1%)
.......FF.F.E.EE.FEFFFF....................................   295 / 12551 (  2%)
FEFF.FFFFF.EFEF.EFFFF.FFFF.FFF...EEEFEEEEEEEEEEEEEEEEEEEE.E   354 / 12551 (  2%)
EEFEEEEEEEEEEEEEEEEEEEE..FFFFFFS..FFFFF.FFFFF............-1% 

Specifying a --group works as expected.

Something else I noticed is that when passing --exclude-group, groups that are excluded by default, such as external-http, are no longer excluded. Not sure if that's related as those groups work fine when run individually.

#3 @johnbillion
6 years ago

I also saw this while working on #52645 and I'm pretty sure it's coming from a test in the ajax group.

This ticket was mentioned in ​PR #11801 on ​WordPress/wordpress-develop by ​@arkaprabhachowdhury.


5 months ago
#4

  • Keywords has-patch has-unit-tests added; needs-patch removed

## Summary

Preserves the default excluded PHPUnit groups when an additional --exclude-group argument is passed.

## Testing

  • Run npm run test:php -- --filter Tests_PHPUnit_GroupFilters
  • Run npm run test:php -- --exclude-group import --filter test_populate_site_meta
  • Run npm run test:php -- --group ajax and verify ajax tests are no longer skipped by default

#5 @arkaprabhachowdhury
8 weeks ago

Opened [PR #11801](​https://github.com/WordPress/wordpress-develop/pull/11801) to address this ticket. Summary Preserves the default excluded PHPUnit groups when an additional --exclude-group argument is passed. Trac https://core.trac.wordpress.org/ticket/34185 Testing - Run npm run test:php -- --filter Tests_PHPUnit_GroupFilters - Run npm run test:php -- --exclude-group import --filter test_populate_site_meta - Run npm run test:php -- --group ajax and verify ajax tests are no longer skipped by default The PR includes focused regression coverage, and its validation details are recorded in the PR description.

I picked this up because the ticket describes a concrete core behavior or edge case that remains relevant in current WordPress. The proposed change is intentionally scoped to the ticket and is submitted here for code review, with the technical discussion remaining on this ticket.

Note: See TracTickets for help on using tickets.