Problem/Motivation

    Comment Preview (Drupal\Tests\comment\Functional\CommentPreview)
     ✘ Comment preview
       ┐
       ├ Failed asserting that a string is an instance of interface Drupal\Component\Render\MarkupInterface.
       │
       │ /builds/issue/drupal-3496259/core/modules/comment/tests/src/Functional/CommentPreviewTest.php:59
       ┴
     ✔ Comment preview duplicate submission
     ✔ Comment edit preview save

Steps to reproduce

Example: https://git.drupalcode.org/issue/drupal-3496259/-/jobs/3829641#L1340

Proposed resolution

Replace calls to State with KeyValue.

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3496319

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

spokje created an issue. See original summary.

spokje’s picture

Whilst we're only trying to fix CommentPreviewTest::testCommentPreview here, this means making changes in \Drupal\user_hooks_test\Hook\UserHooksTest.
In turn, those changes affect the following tests:

\Drupal\Tests\comment\Functional\CommentPreviewTest::testCommentPreview
\Drupal\Tests\user\Kernel\UserEntityLabelTest::testLabelCallback
\Drupal\Tests\user\Functional\UserEditTest::testUserEdit
\Drupal\Tests\user\Functional\UserTokenReplaceTest::testUserTokenReplacement

So I think we have to run our multiple-run tests on all of them before and after the chage.

MR !10711 Has some pipeline changes to make those tests, and only those tests, run 2500 times and gives us 28 fails out of the 2500 runs. Those fails are all in \Drupal\Tests\comment\Functional\CommentPreviewTest::testCommentPreview

MR !10712 shows that changing \Drupal::state()->set()/get() to Drupal::keyValue()->set()/get(); passes a 2500 times run on all four mentioned tests without errors.

The reason for MR !10712 to show up as failed is _probably_ the fact that the artifacts are too big to upload.
Sadly we can't be sure of that, because that message is snipped since the job-log is too big to keep around:

Job's log exceeded limit of 4194304 bytes.
Job execution will continue but no more output will be collected.

spokje’s picture

Status: Active » Needs review

The changes we want committed after review are in MR!10713

spokje’s picture

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Based on the other one reviewed and merged this seems like a good refactor.

catch’s picture

Status: Reviewed & tested by the community » Needs review

One question on the MR.

spokje’s picture

Tried to answer in thread

smustgrave’s picture

Status: Needs review » Needs work

For 1 open thread

If you are another contributor eager to jump in, please allow the original poster @spokje at least 48 hours to respond to feedback first, so they have the opportunity to finish what they started!

spokje’s picture

I'm not getting anywhere with the remark in the MR, so throwing it out in the open for other, bigger brains.

Well, that was way harder then I remembered.

Apparently conditioning to think one way (use DI, use DI, use DI), doesn't mean it can quickly reverse (remove DI, remove DI remove DI).
Anyway. I think I've got there in the end.

spokje changed the visibility of the branch 11.x to hidden.

spokje’s picture

Status: Needs work » Needs review
smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Believe all feedback has been addressed on this one.

  • catch committed 590371ca on 11.1.x
    Issue #3496319 by spokje: [random test failure] CommentPreviewTest::...

  • catch committed 2ba2f9f3 on 11.x
    Issue #3496319 by spokje: [random test failure] CommentPreviewTest::...
catch’s picture

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

Committed/pushed to 11.x and cherry-picked back to 11.1.x.

This doesn't apply to 11.0/10.5/10.4 due to OOP hooks, moving to 'to be ported'.

mstrelan made their first commit to this issue’s fork.

mstrelan changed the visibility of the branch 3496319-multiple-runs-key-value to hidden.

mstrelan changed the visibility of the branch 3496319-multiple-run-as-is to hidden.

catch’s picture

Status: Patch (to be ported) » Reviewed & tested by the community

Backport looks good. Test failures are unrelated.

  • alexpott committed 7aa26830 on 10.5.x
    Issue #3496319 by spokje, catch: [random test failure]...
alexpott’s picture

Status: Reviewed & tested by the community » Fixed

FWIW does this actually happen on 10.5.x? I think state cache collecting only was turned on by default in 11.x. - anyhows no harm in the tests being aligned.

Committed 7aa2683 and pushed to 10.5.x. Thanks!

quietone made their first commit to this issue’s fork.

quietone’s picture

Status: Fixed » Needs review

This broke TrackerTest on 10.5.x. Just pushed a fix.

  • catch committed 3d80c32d on 10.5.x
    Issue #3496319 by quietone: [random test failure] CommentPreviewTest::...
catch’s picture

Status: Needs review » Fixed

Committed/pushed the follow-up to 10.5.x, thanks!

Status: Fixed » Closed (fixed)

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