Download & Extend

Random test failure in Drupal\rest\Tests\Views\StyleSerializerTest

Project:Drupal core
Version:8.x-dev
Component:rest.module
Category:bug report
Priority:major
Assigned:Unassigned
Status:closed (fixed)
Issue tags:Random test failure

Issue Summary

@see http://qa.drupal.org/pifr/test/424668

I suspect that the API code applies a trim() on the actual, saved values.

The only difference below is a trailing space in each second array key:

StyleSerializerTest.php 202 Drupal\rest\Tests\Views\StyleSerializerTest->testUIFieldAlias():

Value array (
  0 =>
  array (
    'dTsf82Om' => 'George',
    'D(1h<|N' => 'TEST',
  ),
  1 =>
  array (
    'dTsf82Om' => 'Ringo',
    'D(1h<|N' => 'TEST',
  ),
  2 =>
  array (
    'dTsf82Om' => 'Meredith',
    'D(1h<|N' => 'TEST',
  ),
  3 =>
  array (
    'dTsf82Om' => 'Paul',
    'D(1h<|N' => 'TEST',
  ),
  4 =>
  array (
    'dTsf82Om' => 'John',
    'D(1h<|N' => 'TEST',
  ),
) is identical to value array (
  0 =>
  array (
    'dTsf82Om' => 'George',
    'D(1h<|N ' => 'TEST',
  ),
  1 =>
  array (
    'dTsf82Om' => 'Ringo',
    'D(1h<|N ' => 'TEST',
  ),
  2 =>
  array (
    'dTsf82Om' => 'Meredith',
    'D(1h<|N ' => 'TEST',
  ),
  3 =>
  array (
    'dTsf82Om' => 'Paul',
    'D(1h<|N ' => 'TEST',
  ),
  4 =>
  array (
    'dTsf82Om' => 'John',
    'D(1h<|N ' => 'TEST',
  ),
).

Comments

#1

Status:active» needs review

What about simply that.

Is it just me or should randomString() tried to be avoided?

AttachmentSizeStatusTest resultOperations
drupal-1892016-1.patch824 bytesIdlePASSED: [[SimpleTest]]: [MySQL] 50,620 pass(es).View details

#2

Status:needs review» reviewed & tested by the community

Yeah, this is being trimmed.... The tests should too. This is the right fix I think.

#3

Status:reviewed & tested by the community» needs work

If the API applies a trim(), then why isn't that happening on the form submission itself then? Or is it an assertIdentical() or similar later that fails because the saved value and the raw string are different? Could use a code comment to explain this.

#4

Status:needs work» needs review

We talked about that and even opened another issue which adds validation to only allow expected characters in the form itself: #1892158: Only allow machine like names for the field alias row plugin

Let's here just fix the random test failure.

AttachmentSizeStatusTest resultOperations
drupal-1892016-4.patch932 bytesIdlePASSED: [[SimpleTest]]: [MySQL] 50,640 pass(es).View details

#5

Status:needs review» fixed

OK thanks for the code comment. Committed/pushed to 8.x.

#6

Status:fixed» closed (fixed)

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

nobody click here