Problem/Motivation

From https://www.drupal.org/pift-ci-job/25947


Update.Drupal\system\Tests\Update\UpdatePathTestBaseFilledTest
✓		- runUpdates
✗	
testUpdatedSite
fail: [Other] Line 303 of core/modules/system/src/Tests/Update/UpdatePathTestBaseFilledTest.php:
"Comentario completo" found

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Comments

catch created an issue. See original summary.

dawehner’s picture

Assigned: Unassigned » dawehner

Trying to figure that out.

dawehner’s picture

I still saw on HEAD a hell lot of notices while running this test.

catch’s picture

Issue tags: +beta target
alexpott’s picture

Status: Active » Needs review
StatusFileSize
new1.41 KB

So this was fun...

  public function prepareQuery($query) {
    // mapConditionOperator converts LIKE operations to ILIKE for consistency
    // with MySQL. However, Postgres does not support ILIKE on bytea (blobs)
    // fields.
    // To make the ILIKE operator work, we type-cast bytea fields into text.
    // @todo This workaround only affects bytea fields, but the involved field
    //   types involved in the query are unknown, so there is no way to
    //   conditionally execute this for affected queries only.
    return parent::prepareQuery(preg_replace('/ ([^ ]+) +(I*LIKE|NOT +I*LIKE) /i', ' ${1}::text ${2} ', $query));
  }

was failing because on the upgrade db we'd not actually run the installer. For Postgres this means running the following query:

$query = "ALTER DATABASE \"" . $connection_options['database'] . "\" SET bytea_output = 'escape';";

Basically the solution is to run the database's tasks in Drupal\system\Tests\Update\UpdatePathTestBase. However we have to do this after the database is loaded and the container created because tasks currently uses t() :).

And yep the Contains... is slightly out of scope but this really really annoys me because it makes it harder to c&p to run the test from the command line.

I now know far more about bytea than I wanted to :(

catch’s picture

Issue tags: -beta target

Very nice find.

Untagging beta target since this affects tests + postgres only.

alexpott’s picture

For some reason I can't repeat the test success :( ohoh

alexpott’s picture

Status: Needs review » Needs work

#926636: Drupal install error on PostgreSQL 9.0 database and #1524456: Cleaner way of supporting postgresql 9 bytea output contain some of the history of bytea output encoding. Suffice to say Drupal\Core\Database\Driver\pgsql\Install\Tasks::checkBinaryOutputSuccess() does not actually work for me. I got green results locally for #5 because I ran the test after running the command. If i'd tested on a completely fresh postgres db it would fail. And it is still failing on DrupalCI... https://www.drupal.org/pift-ci-job/26381

alexpott’s picture

Status: Needs work » Needs review
StatusFileSize
new3.04 KB
new3.25 KB

Fixed it... this partially implements #1524456: Cleaner way of supporting postgresql 9 bytea output because the bytea_output check is currently a bit broken - as shown by the tests! Yay for Postgres testing. I wonder if this will fix anything else.

alexpott’s picture

Assigned: dawehner » Unassigned

So yay this makes the Drupal\system\Tests\Update\UpdatePathTestBaseFilledTest pass on DrupalCI and does not seem to introduce any new failure modes... it didn't fix the random fails in the installer unfortunately - ho hum.

dawehner’s picture

+++ b/core/modules/system/src/Tests/Update/UpdatePathTestBase.php
@@ -141,6 +144,28 @@ function __construct($test_id = NULL) {
+    // Run the install database tasks. Create a minimal container so that t()
+    // works.
+    // @see install_begin_request()
+    $container = new ContainerBuilder();
+    $container->setParameter('language.default_values', Language::$defaultValues);
+    $container
+      ->register('language.default', 'Drupal\Core\Language\LanguageDefault')
+      ->addArgument('%language.default_values%');
+    $container
+      ->register('language_manager', 'Drupal\Core\Language\LanguageManager')
+      ->addArgument(new Reference('language.default'));
+    $container
+      ->register('string_translation', 'Drupal\Core\StringTranslation\TranslationManager')
+      ->addArgument(new Reference('language_manager'));
+    \Drupal::setContainer($container);
+
+    require_once __DIR__ . '/../../../../../includes/install.inc';
+    $connection = Database::getConnection();
+    $errors = db_installer_object($connection->driver())->runTasks();
+    if (!empty($errors)) {
+      $this->fail('Failed to run installer database tasks: ' . implode(', ', $errors));
+    }

Do you mind extracting that into its own method? Its something most readers of setUp() won't be interested in.

alexpott’s picture

StatusFileSize
new2.9 KB
new3.53 KB

Sure np

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Thank you alex!

Relative to https://www.drupal.org/pift-ci-job/26051 (the last branch result), we remove one test failure, yeaaaaaaaaaaah!

alexpott’s picture

Unfortunately #2561121: Installer fails on postgresql due to uncaught exception is random so counting errors is not relevant - whether or not Drupal\system\Tests\Update\UpdatePathTestBaseFilledTest passes is. And that tests is now passing on Postgres (as well as MySQL and sqlite)

andypost’s picture

could be fixed on commit

+++ b/core/modules/system/src/Tests/Update/UpdatePathTestBaseFilledTest.php
@@ -2,7 +2,7 @@
+ * Contains \Drupal\system\Tests\Update\UpdatePathTestBaseFilledTest

nit, missing a dot

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 12: 2561229.12.patch, failed testing.

catch’s picture

Status: Needs work » Reviewed & tested by the community

Just committed #2561121: Installer fails on postgresql due to uncaught exception. Trying to re-test this to see how it looks without the random fails.

catch queued 12: 2561229.12.patch for re-testing.

alexpott’s picture

StatusFileSize
new557 bytes
new3.53 KB

Fixing coding standards.

The last submitted patch, 12: 2561229.12.patch, failed testing.

plach’s picture

The testbot is happy, we should be done here.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 19: 2561229.19.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
StatusFileSize
new3.53 KB

Just a reupload as the testbot maybe had a bad mood.

alexpott’s picture

Status: Needs review » Reviewed & tested by the community

Back to rtbc... after this 1 postgres fail left that is being fixed by #2561129: Composite indexes are not correctly deleted/re-created when updating a field storage definition.

catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 8.0.x, thanks!

  • catch committed 6d4b0ae on 8.0.x
    Issue #2561229 by alexpott, dawehner: Upgrade content tests fails on...

Status: Fixed » Closed (fixed)

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