The patch attached adds two new options to run-tests.sh

The following command will run the StateSystemUpgradePathTest 100 times and if a failure occurs it will exit immediately.

./core/scripts/run-tests.sh --die-on-fail --repeat 100 --class "Drupal\system\Tests\Upgrade\StateSystemUpgradePathTest"

You can then change your settings.php to use simpletest db suffix to debug the test failure.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

alexpott’s picture

And now adding patch :)

Berdir’s picture

+1, this is really helpful to track these nasty random failures down.

Maybe we can move the exit a bit down after checking and printing the error log? Not sure if it's necessary, as we likely already know what the error is when using this, just not under which circumstances it happens.

alexpott’s picture

Rerolled...

The reason I put the exit where I did is because the simpletest_script_cleanup() routine removes the db and files as well as printing the log and we want to keep these.

alexpott’s picture

And here by the patch... Cheers @swentel

swentel’s picture

Status: Needs review » Reviewed & tested by the community

Alright, let's get this in, this is so freaking handy

webchick’s picture

Category: feature » task
Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs backport to D7

That seems incredibly handy! So handy, that I'd love to see an option for "Die on fail" exposed at admin/config/development/testing/settings, too. :)

Switching to a task rather than a feature so it doesn't get gummed up on thresholds.

Seems like at least the extra params (possibly the UI change too; it's not like this is a very user-facing form) should be eligible for backport.

xjm’s picture

So handy, that I'd love to see an option for "Die on fail" exposed at admin/config/development/testing/settings, too. :)

I think this is out of scope here, maybe a followup issue?

xjm’s picture

Status: Needs work » Needs review
alexpott’s picture

I'm inclined to agree with xjm that adding the option to the admin interface is out of scope. Especially since once set in the admin interface it'll be set for all test runs which is unlikely to be the desired outcome. So we'll maybe we'll need to add it to the re-run tests page... or something like that.

Patch attached improves the run-tests.sh message by providing the db prefix and files directory to make it easier to update your settings to debug the fail.

webchick’s picture

Hm. I guess we can defer it. It's very odd though to me for run-tests.sh and simpletest.module to be out of sync regarding the features they provide. :\ We're adding a new CMI value here, it seems natural to expose a UI for it.

xjm’s picture

Status: Needs review » Reviewed & tested by the community

There's already very different featuresets in run-tests.sh versus the module UI, so I've filed #1893930: Expose a setting to die on failure in the SimpleTest UI

webchick’s picture

Version: 8.x-dev » 7.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)

Sorry, this fell off my radar. This has already been very field-tested in debugging several major issues so it's good to go.

Committed and pushed to 8.x, moving back to 7.x for backport.

sun’s picture

Version: 7.x-dev » 8.x-dev
Status: Patch (to be ported) » Needs review
FileSize
2.38 KB

Thanks, this is a useful addition.

Marked #1893930: Expose a setting to die on failure in the SimpleTest UI as won't fix, with a short explanation for why.

Attached patch cleans up the committed changes.

sun’s picture

Sorry, public vs. protected.

alexpott’s picture

Really like the changes in #14 - whilst trying to debug random upgrade failures I wanted to use the --verbose flag as well but discovered that --die-on-fail and --verbose are mutually exclusive... the patch attached fixes that.

sun’s picture

Status: Needs review » Reviewed & tested by the community
webchick’s picture

Version: 8.x-dev » 7.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)

Committed to 8.x. Will push in a few mins.

Back to 7.x.

pietmarcus’s picture

Assigned: Unassigned » pietmarcus
Issue summary: View changes
Status: Patch (to be ported) » Needs review
FileSize
4.57 KB

I had to dust off the patch a bit, but I have backported it to drupal 7. Please review.

Status: Needs review » Needs work

The last submitted patch, 18: 1825592-18.patch, failed testing.

pietmarcus’s picture

Status: Needs work » Needs review

Tests ran successfully this time. Please review.

  • webchick committed 8e37c34 on 8.3.x
    Issue #1825592 by alexpott: Add --repeat and --die-on-fail to run-tests....
  • webchick committed 0aa731a on 8.3.x
    Issue #1825592 follow-up by sun, alexpott: Clean-ups to --repeat and --...

  • webchick committed 8e37c34 on 8.3.x
    Issue #1825592 by alexpott: Add --repeat and --die-on-fail to run-tests....
  • webchick committed 0aa731a on 8.3.x
    Issue #1825592 follow-up by sun, alexpott: Clean-ups to --repeat and --...

  • webchick committed 8e37c34 on 8.4.x
    Issue #1825592 by alexpott: Add --repeat and --die-on-fail to run-tests....
  • webchick committed 0aa731a on 8.4.x
    Issue #1825592 follow-up by sun, alexpott: Clean-ups to --repeat and --...

  • webchick committed 8e37c34 on 8.4.x
    Issue #1825592 by alexpott: Add --repeat and --die-on-fail to run-tests....
  • webchick committed 0aa731a on 8.4.x
    Issue #1825592 follow-up by sun, alexpott: Clean-ups to --repeat and --...
MustangGB’s picture

Would be super handy to have these in D7, anyone able to review?