Testing a fake patch to see if tests run against Drupal 9.

CommentFileSizeAuthor
#28 interdiff-3109693-24-28.txt727 bytesphenaproxima
#28 3109693-28.patch7.72 KBphenaproxima
#24 3109693-24.patch6.91 KBphenaproxima
#23 3109693-23.patch5.86 KBphenaproxima
#20 3109693-19.patch6.98 KBphenaproxima
#18 3109693-17.patch7.75 KBphenaproxima
#15 3109693-15.patch5.65 KBphenaproxima
#11 3109693-11.patch4.05 KBphenaproxima
#8 3109693-8.patch4.05 KBphenaproxima
#7 3109693-7.patch3.73 KBphenaproxima
#6 3109693-6.patch3.71 KBphenaproxima
#5 3109693-5.patch3.01 KBphenaproxima
#4 3109693-4.patch1.12 KBkatherined
#2 3109693-2.patch410 byteskatherined
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

katherined created an issue. See original summary.

katherined’s picture

Wim Leers’s picture

A lot of

Unable to install modules: module 'entity_embed_test' is incompatible with this version of Drupal core.

See \Drupal\Core\Extension\InfoParserDynamic::parse() in Drupal core:

      if (!isset($parsed_info['core']) && !isset($parsed_info['core_version_requirement'])) {
        if (strpos($filename, 'core/') === 0 || strpos($filename, $this->root . '/core/') === 0) {
          // Core extensions do not need to specify core compatibility: they are
          // by definition compatible so a sensible default is used. Core
          // modules are allowed to provide these for testing purposes.
          $parsed_info['core_version_requirement'] = \Drupal::VERSION;
        }
        elseif (isset($parsed_info['package']) && $parsed_info['package'] === 'Testing') {
          // Modules in the testing package are exempt as well. This makes it 👈👈👈👈👈👈👈👈👈👈👈👈👈
          // easier for contrib to use test modules.
          $parsed_info['core_version_requirement'] = \Drupal::VERSION;
        }
        else {
          // Non-core extensions must specify core compatibility.
          throw new InfoParserException("The 'core' or the 'core_version_requirement' key must be present in " . $filename);
        }
      }

Apparently this is not working correctly!?

Ah, no, there's a problem in the test module:

name: 'Entity Embed test'
type: module
description: 'Support module for the Entity Embed module tests.'
core: 8.x
package: Testing

This should just remove the core key altogether 😄

katherined’s picture

Status: Active » Needs review
FileSize
1.12 KB
phenaproxima’s picture

Title: [ignore] Run tests against Drupal 9 » Fix tests on Drupal 9
FileSize
3.01 KB

Debugged the failures with @katherined. The good news is, they looked a lot worse than they actually were.

This should fix most of them, with the notable exception of the update path test. Due to the removal of all Drupal 8 update path testing materials in Drupal 9, we need to wait until Drupal 8.8 is the minimum supported version of core before we can fix that test.

phenaproxima’s picture

Let's see how this does. If it passes, it means we cannot commit it until Drupal 8.8 is the oldest supported version of core.

phenaproxima’s picture

Starting from the clean slate of https://www.drupal.org/pift-ci-job/1590206 ...let's see how many errors this fixes.

phenaproxima’s picture

A quick experiment -- let's see if we can't have our cake and eat it too. If we can, then I can commit this right now.

The last submitted patch, 7: 3109693-7.patch, failed testing. View results

Status: Needs review » Needs work

The last submitted patch, 8: 3109693-8.patch, failed testing. View results

phenaproxima’s picture

Status: Needs work » Needs review
FileSize
4.05 KB

Whoops, I meant theme_installer. Not theme_install.

Status: Needs review » Needs work

The last submitted patch, 11: 3109693-11.patch, failed testing. View results

Berdir’s picture

That check doesn't work on 8.8/8.9 because both files exist. You need a less fancy version, I'd just put 8.8 in there and then after that you check if it does _not_ exist and if so, go back to 8.0

Berdir’s picture

That said, the trusted callback stuff will either require 8.8 anyway or ugly hacks to dynamically define the interface.

I think at this point is pretty much given that the first scheduled 9.0 date won't happen, there's just too much left to do this week, so that also means we have more time until we have to drop 8.7 support, so my recommendation, as usual, would be to just go for ^8.8, do it cleanly and then wait for a good time to drop 8.7 :)

phenaproxima’s picture

Thanks, @Berdir. Let's see how this does -- I just dropped backwards compatibility.

Status: Needs review » Needs work

The last submitted patch, 15: 3109693-15.patch, failed testing. View results

phenaproxima’s picture

Status: Needs work » Needs review
FileSize
7.75 KB

Okay, that took several hours of increasing frustration and confusion, but then with @oknate's invaluable -- dare I say heroic? -- debugging help, we realized that the test is breaking because, when we implement TrustedCallbackInterface on EntityReferenceFieldFormatter, the X-Drupal-Assertion header goes away, changing the size of the transfer.

That raises the question: why do we even care how much actual data was transferred over the wire? Don't we just care that it's non-zero? This seems plausible because, a few lines later, we specifically assert that a second preview request transferred zero bytes (since it's cached on the client side). Therefore, in theory, we should only need to assert that the first preview request transfers some data. Putting constraints on how much data it was, makes the test more brittle and doesn't seem to add much.

Wim Leers’s picture

Status: Needs review » Needs work
Related issues: +#3064340: Make preview responses cacheable to accelerate previews

That raises the question: why do we even care how much actual data was transferred over the wire? Don't we just care that it's non-zero? This seems plausible because, a few lines later, we specifically assert that a second preview request transferred zero bytes (since it's cached on the client side). Therefore, in theory, we should only need to assert that the first preview request transfers some amount of bytes (non-zero).

Yes, we don't care about the specific number of bytes transfered. We care that it's non-zero vs zero. I was just being cautious about it not accepting a broken response with like a PHP fatal error. But … it doesn't materially matter — non-zero vs zero is what materially matters. (Although a one-byte response could never contain a meaningful preview, that's not the scope of this particular test, so it doesn't materially matter.)

+1 to this change :)


+++ b/tests/src/FunctionalJavascript/MediaImageTest.php
@@ -719,7 +719,11 @@ class MediaImageTest extends EntityEmbedTestBase {
+      'query' => [
+        'XDEBUG_SESSION_START' => 1,
+      ],

We definitely don't want this to get committed 😅

phenaproxima’s picture

Status: Needs work » Needs review
FileSize
6.98 KB

Fixed!

phenaproxima’s picture

Crediting Wim and Berdir for their help.

Wim Leers’s picture

Status: Needs review » Needs work

Sorry, one more:

+++ b/tests/modules/entity_embed_test/entity_embed_test.info.yml
@@ -1,7 +1,7 @@
-core: 8.x
+core_version_requirement: ^8.7.7 || ^9

+++ b/tests/modules/entity_embed_translation_test/entity_embed_translation_test.info.yml
@@ -1,7 +1,7 @@
-core: 8.x
+core_version_requirement: ^8.7.7 || ^9

Test modules don't need to have this specified. You can just delete these lines.

phenaproxima’s picture

Status: Needs work » Needs review
FileSize
5.86 KB

Done.

phenaproxima’s picture

On another reading, I realized that you wanted me to delete the core: 8.x lines as well. So that's done here.

Berdir’s picture

test modules not needing this is only in core since 8.8.2, so you'd need to depend on that in the main file :) That said, you would need to set it to at least ^8.8 with the current patch anyway.

Wim Leers’s picture

Status: Needs review » Reviewed & tested by the community

That said, you would need to set it to at least ^8.8 with the current patch anyway.

Exactly :)

Berdir’s picture

Status: Reviewed & tested by the community » Needs work

Yeah, but the main .info.yml currently contains "core_version_requirement: ^8.7.7 || ^9", which would allow to install on 8.7 and then fatal on the test modules.

And it also contains a unecessary >=8.4 requirement that could be cleaned up.

phenaproxima’s picture

Title: Fix tests on Drupal 9 » Fix tests on Drupal 9 and drop support for 8.7
Status: Needs work » Needs review
FileSize
7.72 KB
727 bytes

Good points. Fixed here.

Wim Leers’s picture

Status: Needs review » Reviewed & tested by the community

  • phenaproxima committed 0bfec15 on 8.x-1.x
    Issue #3109693 by phenaproxima, katherined, Wim Leers, Berdir, oknate:...
phenaproxima’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed to 8.x-1.x. Thanks, everyone!

Status: Fixed » Closed (fixed)

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