Problem/Motivation

Because of https://www.drupal.org/node/3108648 contrib now support semantic versioning for releases.

That means and existing module with a 8.x-1.0 release can a future release of 2.0.0. New contrib modules will be be able to start with semver releases and never use the legacy release format.

#3074993: Use "current" in update URLs instead of CORE_COMPATIBILITY to retrieve all future updates means the update module pulls in both releases in the XML feed

Currently the tests for contrib assume it releases in the 8.x-1.0 format. Obviously there are tests for Update module for Drupal core that use semantic versioning so in theory that shows that projects with semantic version releases should work but until we have tests for a non-core project using semantic versioning we can't be 100% sure.

In addition contrib projects will can have both legacy, 8.x-1.0 style, and semantic version releases in the same XML feed. We have no tests currently that show that update module will recognise that say 2.0.0 is the next major release after the 8.x-1.x branch.

Proposed resolution

We should have test cases that cover these new types of releases that Drupal.org now allows them.

Types of test cases we need.

  1. only 8.x-1.0 type releases(our current cases for contrib)
  2. '

  3. XML with only semver, 1.0.0 format, releases: Covered in this issue
  4. XML with both legacy, 8.x-1.0 format, and semver, 1.0.0 format, releases. Covered in #3127168: Create contrib Update test for legacy to semver releases

This issue only covers case 2).

We should:

  1. create a new class
    abstract class UpdateSemanticTestBase extends UpdateTestBase
    
  2. Rename UpdateCoreTest to UpdateSemverCoreTest and extend UpdateSemanticTestBase class
  3. Move all test methods that deal with release availability from UpdateCoreTest to UpdateSemanticTestBase
    Not all methods need to be moved such as testLocalActions() and testServiceUnavailable() which don't deal with availability of releases
    Also testSecurityCoverageMessage() deals with behaviour that is specific to core.
  4. Once the methods above are moved we will need to replace strings such as 'Drupal' to use a class variable.
    We will also need to change asserts for text to new assert methods that will target just the update table for core or contrib depending on class variable.
  5. Create
    UpdateSemanticContribTest extends UpdateSemanticTestBase
    

    By extending UpdateSemanticTestBase it will have a all the the test methods need for semantic version releases.

  6. This test will prove the update module recognise major releases when the XML has both legacy and semantic versions.

  7. To create the XML needed to support UpdateSemanticContribTest copy and rename all the drupal.*.xml for a new semantic_test module.

    The only XML that does not need to be copied are the XML that support testSecurityCoverageMessage().

    To make this process easier to review a script has been created. Currently the script is included in the patch but will need to be removed before commit.

  8. In #3127168: Create contrib Update test for legacy to semver releases add an additional test testUpdatesLegacyToSemantic() to UpdateSemanticContribTest.

Remaining tasks

We determine if the split between tests in UpdateCoreTest and UpdateContribTest still make sense. There are some methods that only make sense for core but now that contrib and core will be able to have semantic versioning we may be able to unify the core and contrib versions of some test methods with a dataProvider that switches the project name.

Test coverage:

  1. See follow up in ##3127168 Add a test cases for releases in 8.x-8. branch to \Drupal\Tests\update\Functional\UpdateSemverContribTest::testUpdatesLegacyToSemver() since this branch might expose bugs around "8" being a major version. see #17.7
  2. Add test case where site is on legacy needs to update security release on semver version. Or also maybe on legacy and security release on both current major, legacy, and semver next major. Maybe should be added to a test in securityUpdateAvailabilityProvider() for UpdateSemverContribTest

    see #17.10 and #18.10

  3. See follow up in ##3127168 Add test cases to UpdateSemverContribTest where the current major is legacy and unsupported and the next major is semver, supported and recommended

Follow-ups

  1. #3127177: Move test methods not directly related to updates for the Drupal project into their own class Determine if the split between tests in UpdateCoreTest and UpdateContribTest still make sense. There are some methods that only make sense for core but now that contrib and core will be able to have semantic versioning we may be able to unify the core and contrib versions of some test methods with a dataProvider that switches the project name.
  2. #3127168: Create contrib Update test for legacy to semver releases

User interface changes

None

API changes

None

Data model changes

None

CommentFileSizeAuthor
#79 interdiff-73-43e7cc20bff.txt11.73 KBtedbow
#78 interdiff-73-563133bf.txt11.95 KBtedbow
#73 interdiff_71-73.txt33.53 KBvsujeetkumar
#73 3100386_73.patch151.95 KBvsujeetkumar
#71 interdiff_69-71.txt424 bytesvsujeetkumar
#71 3100386_71.patch183.75 KBvsujeetkumar
#69 interdiff_67-69.txt571 bytesravi.shankar
#69 3100386-69.patch183.73 KBravi.shankar
#67 3100386-67.patch183.73 KBilgnerfagundes
#65 3100386-65.patch38.12 KBilgnerfagundes
#62 qELy8Sp - Imgur.png99.9 KBilgnerfagundes
#59 interdiff_57-59.txt45.89 KBnikitagupta
#59 3100386-59.patch221.07 KBnikitagupta
#57 interdiff_56-57.txt2 KBnikitagupta
#57 3100386-57.patch219.1 KBnikitagupta
#56 interdiff_55-56.txt883 bytesravi.shankar
#56 3100386-56.patch218.04 KBravi.shankar
#55 interdiff_53-55.txt2.17 KBravi.shankar
#55 3100386-55.patch218.01 KBravi.shankar
#53 interdiff_52-53.txt1.18 KBravi.shankar
#53 3100386-53.patch217.93 KBravi.shankar
#52 3100386-52.patch217.93 KBravi.shankar
#49 rawdiff.txt265.88 KBravi.shankar
#49 3100386-49.patch168.63 KBravi.shankar
#41 interdiff_38_40.txt4.02 KBnarendra.rajwar27
#40 interdiff_38_40.txt3.95 KBnarendra.rajwar27
#40 3100386-40.patch218.18 KBnarendra.rajwar27
#38 3100386-38.patch221.51 KBjofitz
#35 3100386-35.patch216.44 KBtedbow
#35 interdiff-34-35.txt33.6 KBtedbow
#34 3100386-34.patch248.41 KBtedbow
#34 interdiff-33-34.txt26.95 KBtedbow
#33 interdiff-30-32.txt8.66 KBtedbow
#33 3100386-32.patch222.54 KBtedbow
#30 3100386-30-C35.patch218.18 KBtedbow
#30 interdiff-24-30.txt113.63 KBtedbow
#24 3100386-23-C35.patch204.85 KBtedbow
#24 3100386-23-C35-src-only.patch52.28 KBtedbow
#24 interdiff-19-23.txt761 bytestedbow
#20 interdiff-12-19-no-xml.txt5.29 KBtedbow
#19 3100386-19.patch156.63 KBtedbow
#19 interdiff-12-19.txt164.72 KBtedbow
#19 create-3100386-semver-xml.php_.txt1.29 KBtedbow
#13 create-3100386.php_.txt1.31 KBtedbow
#12 3100386-12.patch158.21 KBtedbow
#12 interdiff-11-12.txt10.71 KBtedbow
#11 interdiff-9-11.txt5.96 KBtedbow
#11 3100386-11.patch160.49 KBtedbow
#9 3100386-9.patch155.8 KBtedbow
#7 3100386-7.patch140.67 KBtedbow
#5 3100386-5.patch139.79 KBtedbow
#5 interdiff-3-5.txt658 bytestedbow
#3 3100386-3.patch139.47 KBtedbow

Issue fork drupal-3100386

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

tedbow created an issue. See original summary.

tedbow’s picture

tedbow’s picture

Status: Active » Needs review
StatusFileSize
new139.47 KB

Here is the first attempt at the patch.
The idea behind it

  1. \Drupal\Tests\update\Functional\UpdateCoreTest contains 2 types of tests
    1. Tests that deal with core versions update/security update availability or lack there off
    2. Test deal with security messages that only apply to core
    3. Tests that deal with the update module but aren't directly tied to specific updates. for instance testLocalActions, testServiceUnavailable, testFetchTasks
  2. For the tests in 1.a) these are really just testing semantic version update testing. It just happens that up until now the core Drupal project is the only project that had semantic version tests
  3. For the tests in 1.a) we should be able to have tests that deal with a non-core project that still pass

So here is how I made this patch

  1. Created a new UpdateSemanticTestBase test class. This will have all the tests that are currently in UpdateCoreTest but should work with both core and contrib using semantic version
  2. UpdateCoreTest now extends UpdateSemanticTestBase
  3. Added new UpdateSemanticContribTest that extends extends UpdateSemanticTestBase
  4. Copied all of the drupal.*.xml files and renamed to semantic_test.*.xml
    rename almost all 'drupal' strings to 'semantic_tests'
  5. Created a new semantic_test module

Status: Needs review » Needs work

The last submitted patch, 3: 3100386-3.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

tedbow’s picture

Status: Needs work » Needs review
StatusFileSize
new658 bytes
new139.79 KB
  1. +++ b/core/modules/update/tests/src/Functional/UpdateCoreTest.php
    @@ -374,7 +44,7 @@ public function securityUpdateAvailabilityProvider() {
    -  public function testSecurityCoverageMessage($installed_version, $fixture, $requirements_section_heading, $message, $mock_date) {
    +  public function xtestSecurityCoverageMessage($installed_version, $fixture, $requirements_section_heading, $message, $mock_date) {
    

    fixing

  2. +++ b/core/modules/update/tests/src/Functional/UpdateTestBase.php
    @@ -204,4 +204,34 @@ protected function assertVersionUpdateLinks($label, $version, $download_version
    +    $this->assertSession()->elementContains('css', $this->updateTableLocator, $string);
    

    s/$text/$string

  3. I know there is more clean up I need to do.docs, comment, standards etc
dww’s picture

Approach here from #3 sounds great. No time to do a careful review right now, but I hope to look soon. This would be fabulous to land ASAP!

Thanks,
-Derek

tedbow’s picture

Assigned: Unassigned » tedbow
StatusFileSize
new140.67 KB

Here is just a reroll.

I working on this. We need at least test for major version update from non-semantic to semantic. For example from 8.x-1.x to 2.x.x

tedbow’s picture

my reroll in #7 was probably wrong. Because it copies xml to new copies it probably didn't get recent changes. The same for function from UPdateCoreTest.

Working on it

tedbow’s picture

StatusFileSize
new155.8 KB

Hmmm. rerolling this was not fun. Hopefully now that a bunch of issues got committed for the Update module it won't be such a big task next time.

This should past tests but I am still working 8.x-1.x to 2.x.x example and much more clean up.

tedbow’s picture

+++ b/core/modules/update/tests/src/Functional/UpdateTestBase.php
@@ -274,6 +274,30 @@ protected function assertUpdateTableElementContains($text) {
diff --git a/create-3100386.php b/create-3100386.php

diff --git a/create-3100386.php b/create-3100386.php
new file mode 100644

This is the script that I used to create the XML copies. I added this incase we needed to reroll this patch again. Will remove before commit.

This actually makes a few xml files we don't need https://github.com/tedbow/drupal/commit/93c9900cacda6cc63d9415f404f72543...

I pushed out my branch incase I need to reroll this again to at least remind me of what I need to do(or someone else)

tedbow’s picture

StatusFileSize
new160.49 KB
new5.96 KB

Here is test that confirms updates from the major version 7, in the format 8.x-7.* will recognise that the versions in the format 8.*.* are version in the next major version, major version 8 of a module.

This is the heart of the what I wanted to prove with this issue. The update module can handle an XML file with both legacy, 8.x-*, and semantic versions in the same XML and recognise both major versions.

I am very relieved this works!

Leaving assigned to myself as this patch still need a lot of clean up.

tedbow’s picture

Assigned: tedbow » Unassigned
StatusFileSize
new10.71 KB
new158.21 KB

clean up and refactoring

tedbow’s picture

Issue summary: View changes
StatusFileSize
new1.31 KB
  1. Updating summary with details on the new test and how they are made
  2. Uploading the script that creates the XML files

My thoughts on reviewing this patch.

  1. +++ b/core/modules/update/tests/src/Functional/UpdateSemanticTestBase.php
    @@ -0,0 +1,445 @@
    +  protected $projectTitle;
    +
    +  protected function setUp() {
    +    parent::setUp();
    +    $admin_user = $this->drupalCreateUser(['administer site configuration', 'administer modules', 'administer themes']);
    

    There are a lot of existing problems with UpdateCoreTest such as this example of no docblock. I hope we don't have to fix all these as I would think this would make this issue take a long time.

  2. +++ b/core/modules/update/tests/modules/update_test/semantic_test.sec.0.2.xml
    @@ -0,0 +1,56 @@
    +  <tag>SEMANTIC_TEST-8-0-2</tag>
    

    also the XML will have the same problem since they are all copies of existing XML files. I think we can address these in #3110917: [meta] Fix update XML fixtures bad data

    Hopefully the script uploaded here will prove we are introducing in new type of problems with the XML.

xjm’s picture

Issue tags: +Drupal 9, +beta target
xjm’s picture

Priority: Normal » Critical
dww’s picture

Assigned: Unassigned » dww

Starting a review now...

dww’s picture

Assigned: dww » Unassigned
Status: Needs review » Needs work

A lot of this looks good. But it's a huge patch to try to review. I mostly skipped over all the new fixture files.

Not all of these points require work, but I'm setting to NW for at least some of them. ;)

  1. --- /dev/null
    +++ b/core/modules/update/tests/modules/semantic_test/semantic_test.info.yml
    
    +++ b/core/modules/update/tests/modules/semantic_test/semantic_test.info.yml
    @@ -0,0 +1,6 @@
    
    @@ -0,0 +1,6 @@
    +name: 'Semantic Test'
    

    Can we call this semver_test* instead of semantic_test*?

    Name could be "Semantic Version Test" if desired.

    "Semantic" is true, but not specific enough. We're not testing the semantics of updates. We're testing semver / semantic version.

    Hopefully easy to automate this change if it's agreeable.

  2. +++ b/core/modules/update/tests/modules/update_test/semantic_test.0.0-alpha1.xml
    @@ -0,0 +1,41 @@
    +    <tag>SEMANTIC_TEST-8-2-0</tag>
    

    Really wish we could agree on #3113798: Remove unused (and generally wrong) <tag> markup from Update module test XML fixtures before we add a bazillion more of these bogus tags. :(

  3. +++ b/core/modules/update/tests/modules/update_test/semantic_test.0.0-alpha1.xml
    @@ -0,0 +1,41 @@
    +     <term><name>Release type</name><value>New features</value></term>
    
    --- /dev/null
    +++ b/core/modules/update/tests/modules/update_test/semantic_test.0.0-beta1.xml
    

    Eyes are glazing over trying to carefully review all these fixtures. I see the script that's auto-generating them. I think if I actually look at all this and say anything, it's going to be punted to "out of scope", so I don't really want to spend much energy on it.

    That said, the naming conventions for these files are weird. What does "0.0-beta1" mean, given there's an 8.2.0 release in here?

    Before we bulk copy/paste all of this, I'd love to do a few cleanups if possible:

    #3115435: Make clear why each XML update.module fixture is created the way it is
    #3121020: Move Update Manager XML test fixtures into a fixtures/release-history directory

    Probably not going to happen, but I can at least wish outloud. ;)

  4. +++ b/core/modules/update/tests/src/Functional/UpdateCoreTest.php
    --- /dev/null
    +++ b/core/modules/update/tests/src/Functional/UpdateSemanticContribTest.php
    

    s/UpdateSemanticContribTest/UpdateSemverContribTest/?

  5. +++ b/core/modules/update/tests/src/Functional/UpdateSemanticContribTest.php
    @@ -0,0 +1,91 @@
    +    // Ensure Drupal core on the same version for all test runs.
    +    if ($this->updateProject !== 'drupal') {
    +      $system_info['drupal'] = [
    +        'project' => 'drupal',
    +        'version' => '8.0.0',
    +        'hidden' => FALSE,
    +      ];
    +    }
    

    This is slightly weird to do in a shared helper method, since it only applies to the contrib side of life. But having different implementations of this in each child class is maybe not worth the effort. Kind of a DRY vs. Smell trade-off. ;)
    /shrug

  6. +++ b/core/modules/update/tests/src/Functional/UpdateSemanticContribTest.php
    @@ -0,0 +1,91 @@
    +    $install_versions = [
    

    s/install_versions/installed_versions/?

  7. +++ b/core/modules/update/tests/src/Functional/UpdateSemanticContribTest.php
    @@ -0,0 +1,91 @@
    +      '8.x-7.1',
    

    Since it's a potentially error-prone edge case, would love to see some '8.x-8.*' test cases in here, too.

  8. +++ b/core/modules/update/tests/src/Functional/UpdateSemanticContribTest.php
    @@ -0,0 +1,91 @@
    +    $this->refreshUpdateStatus([$this->updateProject => '1.0']);
    

    Don't we also need to specify the fixture we're using for core here? I found it later, ignore this.

  9. +++ b/core/modules/update/tests/src/Functional/UpdateSemanticContribTest.php
    @@ -0,0 +1,91 @@
    +      $this->drupalGet('admin/reports/updates');
    +      $this->clickLink(t('Check manually'));
    +      $this->checkForMetaRefresh();
    ...
    +        $this->assertVersionUpdateLinks('Recommended version:', '8.x-7.1');
    

    Isn't all this done by refreshUpdateStatus()? Why aren't we just doing the refreshUpdateStatus() inside the loop?

  10. +++ b/core/modules/update/tests/src/Functional/UpdateSemanticContribTest.php
    @@ -0,0 +1,91 @@
    +      $this->assertUpdateTableTextNotContains(t('Security update required!'));
    

    Don't we want a case where an update to a semver release coincides with a required security update?

  11. +++ b/core/modules/update/tests/src/Functional/UpdateSemanticContribTest.php
    @@ -0,0 +1,91 @@
    +      // All installed versions should indicate that there is update available
    +      // for the next major version of the module.
    

    s/there is update/there is an update/

    Then this will need to re-wrap.

  12. +++ b/core/modules/update/tests/src/Functional/UpdateSemanticContribTest.php
    @@ -0,0 +1,91 @@
    +      $this->assertVersionUpdateLinks('Also available:', '8.1.0');
    

    This is the key assertion in this whole method. However, it's a bit confusing:

    a) I'd expect "8.0.0", not "8.1.0" as the expected release.

    b) This looks a lot like a core version string, so it's easy to miss that this is the main thing to be asserting.

  13. +++ b/core/modules/update/tests/src/Functional/UpdateSemanticContribTest.php
    @@ -0,0 +1,91 @@
    +        // All installed versions besides 8.x-7.1 should recommend 8.x-7.1
    +        // because it is the latest full release for the major.
    +        $this->assertVersionUpdateLinks('Recommended version:', '8.x-7.1');
    

    Can we add a test case for where all the legacy versions are unsupported and the semver release is recommended?

  14. +++ b/core/modules/update/tests/src/Functional/UpdateSemanticTestBase.php
    @@ -0,0 +1,445 @@
    +   * The project title.
    

    "The title of the project being tested" or something?

  15. +++ b/core/modules/update/tests/src/Functional/UpdateSemanticTestBase.php
    @@ -0,0 +1,445 @@
    +    $admin_user = $this->drupalCreateUser(['administer site configuration', 'administer modules', 'administer themes']);
    

    Why do we need 'administer modules' and 'administer themes' for any of this?

  16. +++ b/core/modules/update/tests/src/Functional/UpdateSemanticTestBase.php
    @@ -0,0 +1,445 @@
    +        $this->refreshUpdateStatus([$this->updateProject => "$minor_version.1" . $extra_version]);
    ...
    +        $this->drupalGet('admin/reports/updates');
    +        $this->clickLink(t('Check manually'));
    +        $this->checkForMetaRefresh();
    

    Again, I thought all this was the point of refreshUpdateStatus()...

  17. +++ b/core/modules/update/tests/src/Functional/UpdateSemanticTestBase.php
    @@ -0,0 +1,445 @@
    +            // Both stable and unstable releases are available.
    +            // A stable release is the latest.
    

    These comments don't fully make sense. What does it mean that an unstable release is available if it's not the latest?

  18. +++ b/core/modules/update/tests/src/Functional/UpdateSemanticTestBase.php
    @@ -0,0 +1,445 @@
    +            if ($extra_version == '') {
    

    === ?

  19. +++ b/core/modules/update/tests/src/Functional/UpdateSemanticTestBase.php
    @@ -0,0 +1,445 @@
    +            // Only unstable releases are available.
    +            // An unstable release is the latest.
    

    The former implies the later. ;)

  20. +++ b/core/modules/update/tests/src/Functional/UpdateSemanticTestBase.php
    @@ -0,0 +1,445 @@
    +            break;
    

    newline after break;

  21. +++ b/core/modules/update/tests/src/Functional/UpdateSemanticTestBase.php
    @@ -0,0 +1,445 @@
    +            // Both stable and unstable releases are available.
    +            // A stable release is the latest.
    +            if ($extra_version == '') {
    +              $this->assertUpdateTableTextNotContains(t('Up to date'));
    +              $this->assertUpdateTableTextContains(t('Update available'));
    +              $this->assertVersionUpdateLinks('Recommended version:', $full_version);
    +              $this->assertUpdateTableTextNotContains(t('Latest version:'));
    +              $this->assertUpdateTableElementContains('warning.svg', 'Warning icon was found.');
    +            }
    

    Isn't this entirely duplicate with the case 0 version of this above? DRY?

  22. +++ b/core/modules/update/tests/src/Functional/UpdateSemanticTestBase.php
    @@ -0,0 +1,445 @@
    +            break;
    

    Newline after break.

  23. +++ b/core/modules/update/tests/src/Functional/UpdateSemanticTestBase.php
    @@ -0,0 +1,445 @@
    +          $this->drupalGet('admin/reports/updates');
    +          $this->clickLink(t('Check manually'));
    +          $this->checkForMetaRefresh();
    

    Again -- why do we need these after refreshUpdateStatus()?

  24. +++ b/core/modules/update/tests/src/Functional/UpdateSemanticTestBase.php
    @@ -0,0 +1,445 @@
    +          $this->assertUpdateTableElementContains(Link::fromTextAndUrl('9.0.0', Url::fromUri("http://example.com/{$this->updateProject}-9-0-0-release"))->toString(), 'Link to release appears.');
    +          $this->assertUpdateTableElementContains(Link::fromTextAndUrl(t('Download'), Url::fromUri("http://example.com/{$this->updateProject}-9-0-0.tar.gz"))->toString(), 'Link to download appears.');
    +          $this->assertUpdateTableElementContains(Link::fromTextAndUrl(t('Release notes'), Url::fromUri("http://example.com/{$this->updateProject}-9-0-0-release"))->toString(), 'Link to release notes appears.');
    

    That's a lot of Url and Link instantiation inside a deeply nested loop. These never change across the test cases. Can we do this once outside any of the loops and re-use the results inside the assertions? Will also keep these from being 250 chars wide. ;)

  25. +++ b/core/modules/update/tests/src/Functional/UpdateSemanticTestBase.php
    @@ -0,0 +1,445 @@
    +   * @param string $site_patch_version
    +   *   The patch version to set the site to for testing.
    

    "site" seems a bit off. Implies core, but this could be for anything. Maybe "installed_patch_version" or something?

  26. +++ b/core/modules/update/tests/src/Functional/UpdateSemanticTestBase.php
    @@ -0,0 +1,445 @@
    +    $this->setProjectInstalledVersion("8.$site_patch_version");
    

    I'd expect a minor version. Oh, I see below, this isn't just "site_patch_version", it's really "installed_minor_patch_versions" or something. #confusing

  27. +++ b/core/modules/update/tests/src/Functional/UpdateSemanticTestBase.php
    @@ -0,0 +1,445 @@
    +    $this->assertSecurityUpdates("{$this->updateProject}-8", $expected_security_releases, $expected_update_message_type, $this->updateTableLocator);
    

    Would love an inline comment about why we append "-8" to the updateProject name for this. /shrug

  28. +++ b/core/modules/update/tests/src/Functional/UpdateSemanticTestBase.php
    @@ -0,0 +1,445 @@
    +   * These test cases rely on the following fixtures containing the following
    +   * releases:
    

    YAY! Update manager tests need so much more of this. Thank you, Thank You, THANK YOU!

  29. +++ b/core/modules/update/tests/src/Functional/UpdateSemanticTestBase.php
    @@ -0,0 +1,445 @@
    +   * - drupal.sec.0.1_0.2.xml
    

    Aren't all of these filenames wrong for the contrib case? Instead of "drupal" for all these, don't we want (drupal|semver_test) or something to indicate that the fixture name changes depending on who's calling this? Or just "[project_name]..."

  30. +++ b/core/modules/update/tests/src/Functional/UpdateSemanticTestBase.php
    @@ -0,0 +1,445 @@
    +   *   - 8.0.2
    +   *   - 8.0.1
    +   *   - 8.0.0
    

    Seems like an @todo that these are blank. Maybe something like "Normal" or "Regular" or something so we know we didn't just forget to document them?

  31. +++ b/core/modules/update/tests/src/Functional/UpdateSemanticTestBase.php
    @@ -0,0 +1,445 @@
    +   *   different value for 'supported_branches' that does not contain '8.0.'.
    +   *   It is used to ensure that the "Security update required!" is displayed
    

    Technically "It" would fit on the prior line, although I actually think it's more readable this way...

  32. +++ b/core/modules/update/tests/src/Functional/UpdateSemanticTestBase.php
    @@ -0,0 +1,445 @@
    +   *   - 8.2.0-rc2
    +   *   - 8.2.0-rc1
    +   *   - 8.2.0-beta2
    +   *   - 8.2.0-beta1
    +   *   - 8.2.0-alpha2
    +   *   - 8.2.0-alpha1
    

    Same for all these -- "Normal"?

  33. +++ b/core/modules/update/tests/src/Functional/UpdateSemanticTestBase.php
    @@ -0,0 +1,445 @@
    +      '0.0, 0.2' => [
    

    I don't comprehend the naming convention for these array keys. I know it doesn't actually matter, but this is mostly incomprehensible noise at this point.

    If this is the best we can hope for, can we have a comment in the docblock for this function to explain what the keys are supposed to imply?

    Better yet, can we have more self-documenting keys that guide reviewers and future developers to understanding these?

  34. +++ b/core/modules/update/tests/src/Functional/UpdateSemanticTestBase.php
    @@ -0,0 +1,445 @@
    +        'expected_update_message_type' => static::SECURITY_UPDATE_REQUIRED,
    

    (Out of scope) I wonder why UpdateTestBase defines its own versions of these constants instead of re-using the ones from Update manager itself. /shrug

  35. +++ b/core/modules/update/tests/src/Functional/UpdateSemanticTestBase.php
    @@ -0,0 +1,445 @@
    +    //   - For 8.1.0 using fixture 'sec.0.2-rc2' to ensure that only security
    

    s/that only/that the only/

  36. +++ b/core/modules/update/tests/src/Functional/UpdateSemanticTestBase.php
    @@ -0,0 +1,445 @@
    +    return $test_cases;
    

    I know we just decided dataProviders are okay in Functional tests at #3113992: The 'Update' page has no idea that some updates are incompatible, but this is *a lot* of cases, and this whole thing happens *twice* (once for core semver, once for contrib semver). I'd be curious to see how many minutes this adds to the test runs, and if we really want to keep going with such a massive dataProvider like this...

  37. +++ b/core/modules/update/tests/src/Functional/UpdateSemanticTestBase.php
    @@ -0,0 +1,445 @@
    +   * - drupal.1.0.xml
    

    Again, "drupal" is only true 1/2 of the time.

  38. +++ b/core/modules/update/tests/src/Functional/UpdateSemanticTestBase.php
    @@ -0,0 +1,445 @@
    +  /**
    +   * {@inheritdoc}
    +   */
    +  protected function assertVersionUpdateLinks($label, $version, $download_version = NULL) {
    +    // Test XML files for Drupal core use '-' in the version number for the
    +    // download link.
    +    $download_version = str_replace('.', '-', $version);
    +    parent::assertVersionUpdateLinks($label, $version, $download_version);
    +  }
    

    This is a slightly weird/unfortunate thing to have to override this method for. Can't we make the semver_test fixtures match the core one or vice-versa?

  39. +++ b/core/modules/update/tests/src/Functional/UpdateSemanticTestBase.php
    @@ -0,0 +1,445 @@
    +    if (!isset($xml_map['drupal'])) {
    +      $xml_map['drupal'] = '0.0';
    +    }
    

    Ahah! This answers some previous review point. Phew.

  40. +++ b/core/modules/update/tests/src/Functional/UpdateSemanticTestBase.php
    @@ -0,0 +1,445 @@
    +   * Sets the project installed version.
    

    "Sets the installed project version"

  41. +++ b/core/modules/update/tests/src/Functional/UpdateSemanticTestBase.php
    @@ -0,0 +1,445 @@
    +   *   The version number.
    

    It's really a "version string", since there can be "extra" and all sorts of non-number stuff...

  42. +++ b/core/modules/update/tests/src/Functional/UpdateTestBase.php
    @@ -274,6 +274,30 @@ protected function assertUpdateTableElementContains($text) {
    +  /**
    +   * Asserts that the update table element HTML contains the specified text.
    +   *
    +   * @param string $text
    +   *   The expected text.
    +   *
    +   * @see \Behat\Mink\WebAssert::elementNotContains()
    +   */
    +  protected function assertUpdateTableElementNotContains($text) {
    +    $this->assertSession()
    +      ->elementNotContains('css', $this->updateTableLocator, $text);
    +  }
    +
    +
    +  /**
    +   * Asserts that the update table text does not contain the specified text.
    +   *
    +   * @param string $text
    +   *   The expected text.
    +   */
    +  protected function assertUpdateTableTextNotContains($text) {
    +    $this->assertSession()->elementTextNotContains('css', $this->updateTableLocator, $text);
    +  }
    +
    

    My mind's capacity is starting to overflow with this review, apologies. But why is it in scope to be adding both of these to UpdateTestBase? Aren't we only using them from children of UpdateSemverTestBase?

Thanks!
-Derek

tedbow’s picture

Assigned: Unassigned » tedbow

@dww thanks for the review. Addressing it now

tedbow’s picture

Assigned: tedbow » Unassigned
Issue summary: View changes
Status: Needs work » Needs review
Related issues: +#3100115: The update module should recommend updates based on supported_branches rather than major versions majors
StatusFileSize
new1.29 KB
new164.72 KB
new156.63 KB

Addressing #17
@dww thanks for the review
. I doubt I will get through all of it.

  1. Fixed. Making changes to class names also. Uploading the new script to create the XML
  2. Sorry I don't agree this issue is much more important. I don't think we should worry about that. The current issue is critical and tests functionality that has already been released in full release of Drupal core. If decide to do your plan for the fix in that issue we can remove all <tag> elements with 1 regex script or other automated method.
  3. Again disagree because of the importance of this issue. If those issues happen to get resolved in the meantime the XML creating script simply needs to run again.
  4. fixed
  5. Agreed. This was left over from when it was in UpdateSemverTestBase. Removed the conditional added to the above array.
  6. fixed
  7. Agreed. Since this interdiff is going to be big anyways saving that for the next patch. Added to the remaining tasks. 1 option also just change this test case to 8.x-8. and skip 8.x-7. altogether. We don't have any logic require major versions not be skipped.
  8. 👍
  9. Good catch. Fixed. Though $this->assertVersionUpdateLinks('Recommended version:', '8.x-7.1'); is not done by refreshUpdateStatus(), assuming that was just a dreditor error
  10. Probably I added a todo. We want to not put in this test and but override securityUpdateAvailabilityProvider() in UpdateSemverContribTest and add an extra test case for these cases. Since this issue is adding test coverage for existing functionality I wonder we could do this in required also critical follow-up. Just to make this issue easier to review and get committed. I have feeling we could 2 well scoped issues in faster that 1 issue that covers all cases.

    Added to Remaining tasks either way so it is not forgotten.

  11. fixed
  12. a)When showing the "Also available" release for the next major the update module will also show the latest version for the next major regards less of minors or what we now consider "support branches". I added a comment explaining this.
    This would be changed in #3100115: The update module should recommend updates based on supported_branches rather than major versions majors. I have added a todo here that we should determine if the expectation should change in that issue. I think it is currently agreed upon what the correct behavior should be that case but should definitely look at it that issue, even if we decide this is the correct behavior.

    b) Yes I agree this is a little confusing. 1 option would be to change all the semver_test*.xml to use not use 8 as the major version it is testing. But then to share code in \Drupal\Tests\update\Functional\UpdateSemverTestBase we would need class properties $currentMajor and $nextMajor because the core and contrib XML would be using different major versions. I think this would make the test methods more unreadable because we would have more string concatenation instead of string literals.Technically the major version should not matter.

    I personally think adding better comments to \Drupal\Tests\update\Functional\UpdateSemverContribTest is a better solution.

  13. Good suggestion. Adding to Remaining tasks. I think once we have more of remaining tasks for test cases it may be more clear if they should all be added to the existing method or if we should add more methods to UpdateSemverContribTest that deal with different types of Legacy -> Semver
  14. fixed
  15. 😞 We don't but this is code that is currently in 8.9.x UpdateCoreTest. This code and almost all the code in UpdateSemverTestBase was copied directly from UpdateCoreTest.

    My hope is that we do not have to fix all the problems that currently exist in 8.9.x UpdateCoreTest before can commit this issue with UpdateSemverTestBase. This is similar to not fixing all the problems with the drupal*.xml that we get because we are doing a straight copy of the XML. I know with the code is different because we don't have script to prove that these are straight copies but comparing the current version of 8.9.x UpdateCoreTest will show this is the same code.

    If we do more than just copy the code I also think we risk somehow losing test coverage for something without knowing it.

  16. sames as previous point

Ok stopping for now. a lot of the remaining points are covered by response to 15. Interested to see what @dww and others think of this argument.

Sorry the interdiff is huge because of the XML changes.

tedbow’s picture

StatusFileSize
new5.29 KB

Here is an interdiff for 19 without the xml changes

Status: Needs review » Needs work

The last submitted patch, 19: 3100386-19.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

tedbow’s picture

Assigned: Unassigned » tedbow

Talked to @tim.plunkett about the problem I mentioned in #19.15.

He suggested I tried created the diff so that it is more obvious what is being copied. I am working on that. Hopefully it will make it easier to review.

tedbow’s picture

Assigned: tedbow » Unassigned
Status: Needs work » Needs review
StatusFileSize
new761 bytes
new52.28 KB
new204.85 KB
  1. +++ b/core/modules/update/tests/src/Functional/UpdateSemverTestBase.php
    @@ -0,0 +1,445 @@
    +    $admin_user = $this->drupalCreateUser(['administer site configuration']);
    

    @dww mentioned this in #17.15 that we didn't need the other permissions.

    I am responded that we should leave it because it is copied code. But I had actually changed it locally for testing and forgot to undo.

    This is why the test failed. \Drupal\Tests\update\Functional\UpdateCoreTest::testModulePageRegularUpdate() needs this permission.

    Reverting that change for now but we should probably move that permission to just that test. I will do in a follow up patch

  2. So I created the same patch from #19 aside from this 1 change mentioned above but with a different git command

    git diff 8.9.x -C35 > ../3100386-19-C35.patch
    The -C35 makes git try harder to find copies. So it no finds

    similarity index 39%
    copy from core/modules/update/tests/src/Functional/UpdateCoreTest.php
    copy to core/modules/update/tests/src/Functional/UpdateSemverTestBase.php
    

    This means that a lot of the problems @dww flagged in #17 won't actually be in the patch as additions. They will be still be in UpdateSemverTestBase.php but git considers them a copy now. So that will make it more clear that a lot of it is existing problems.

  3. The patch as similarity index 39%
    because there are some functions that didn't get copied to UpdateSemverTestBase.php such as testClearDiskCache() which doesn't deal directly the core project(and maybe should have been another test anyways)

    We could move all those types of method to UpdateSemverTestBase.php and it won't hurt they don't need to be there. But I am fine doing that if it makes it easier to review.

  4. You will notice though the patch is actually bigger now 😞

    this is because using -C35 make all the XML be recognized as copies now as before git saw them as new files.
    So this actually makes the patch bigger.

    I will include a patch that only includes the core/modules/update/tests/src path to show the code only changes.

dww’s picture

Re: #19:

1. Thanks, I think that'll be better long term.

2. I already wrote a perl 1-liner to rip out <tag> in #3113798: Remove unused (and generally wrong) <tag> markup from Update module test XML fixtures. That's not the point. It's just a lot of churn to duplicate all this bogus data and then have to remove it all later. I was stating my preference that we fix that first, since it'd be trivial and easy if only we agreed. But I know it's not going to happen.

Since this feature is already released, and we already saw passing test results, what's the hurry? ;) Why rush in 200+ kb of tests and fixtures if they're hard to understand and maintain? Why not spend the effort to make this worth committing, by the standards applied to every other core issue (even critical bugs that have been fixed for weeks but we shipped multiple versions of core with them while we argued about perfect test coverage)?

3. /shrug
4. 👍
5. 👍
6. 👍
7. 👍
8. 👍
9. 👍-- indeed, the assertVersionUpdateLinks() stuff was a dreditor mis-fire, sorry about that.
10. Sure, #NeedsFollowup is fine with me. This patch and issue are already huge.
11. 👍
12a. 👍
12b. Sure, more comments is fine. It's slightly too bad, but pragmatism++ for this. These tests are hard enough to read as-is.
13. 👍
14. 👍
15. See 2 above. ;) I don't know why we'd want to massively expand the footprint of not-so-clearly-written-nor-easy-to-make-sense-of tests in update module. If we're refactoring code into a shared base class and making a bunch of changes so we can test core and contrib with it, why leave known problems broken? But I can rarely make sense of what's in scope when or why, so I give up.

Re: #24:

1. No, a bunch of test methods in UpdateCoreTest need 'administer modules'. Search for "admin/modules" and you'll find many hits. I was talking about UpdateSemverTestBase not needing them. Might as well keep those perms for all the tests in UpdateCoreTest, since it'll be a lot of bloat to selectively add it to each test that needs it. /shrug I find it ironic that you set #3113992-93: The 'Update' page has no idea that some updates are incompatible to NW over this exact point, but in this issue you're effectively saying "it was like this already, we're only copying code, and we shouldn't change it or we might break something.". ;)

2. Hah. ;) Play git games so the patch doesn't include the weirdness so no one can point it out and it'd be out of scope to fix anything. I'll have to remember this strategy for future issues. 😉

3. -1 to putting more functions in UpdateSemverTestBase for the sole reason of keeping the patch here smaller. Again, I think we should be optimizing for the end result code is easy to read and maintain, not the smallest number of bytes we can manage for each patch.

4. /shrug

tim.plunkett’s picture

Re: #24.2 / #25.2
I suggested using -C35 to @tedbow.
No one is playing games here.

The default value is 50%, but lowering the threshold is a common tactic used throughout core development's history.
It's not intended to hide *anything*, but instead to highlight what is actually a change being made by the patch author, instead of obfuscating the intention by placing it among a lot of copy/paste.

Finding the right percentage threshold is conveying *more* information, not less.

tedbow’s picture

re #25

  1. Since this feature is already released, and we already saw passing test results, what's the hurry? ;)

    We have tests here that are not RTBC or committed. So I personally am not 100% sure they are correct(90%?). You have already pointed out some good missing test cases that are not covered by the current test. I am much less confident that those cases are working.

    But mostly the problem is any change we make to the update module from now until this is committed has the potential to break this functionality without anyone being aware because this tests are not being run by all other Update module patches. There are also probably cases where other changes to other subsystems could break this functionality(though I can't think of any right now).

    Though the Update module is not changing quickly right now, there is always a chance any day that we will find a critical bug(or even security problem) with something else in the update module. In that case we would be forced to make a change to the update module without knowing if we are breaking this functionality. True we could run the tests in the current patch against any issue but that does not give me much confidence.

    Finally drupal.org is waiting on this issue to allow Semver for contrib modules(expect for limited modules for testing). This is because this we can't be 100% the update module will work with this. So this another reason we this is critical. Without Semver contrib modules are stuck making 8.x- releases even if they are attempting to make brand new module or a new major version of a module that is only compatible with Drupal 9(because is needs an updated dependency such as Symfony for example)

  2. Why rush in 200+ kb of tests and fixtures if they're hard to understand and maintain?

    I am not trying to rush this issue in. I just saying that this issue marked as critical for the reasons I just stated.

    There are other critical issues for the update module but they are not any of the of ones you mentioned in #17.2 and3. Therefore this is issue should not be delayed on those issues.

    I know we are creating more test fixtures that have the same problem as the current test fixtures but we are not making new types of problems and these fixtures can be cleaned up in the same issues.

  3. Why not spend the effort to make this worth committing, by the standards applied to every other core issue

    I am doing that to the best of my ability. I am not trying to loosen standards I am trying to treat this issue as the Critical issue that it is for the reasons I stated in 1)

dww’s picture

Issue tags: +Needs followup, +Adds technical debt

Re: #27: For the record, I flagged this issue in this week's #d9readiness meeting (although the notes aren't yet posted), asking if it should be critical. That's what prompted @xjm to add comment #15. I agree it's critical, and that's why I'm spending (a lot of) my free time on it. Unlike the rest of you, jumping through these hoops isn't paying any of my bills, it's a labor of "love". I understand the desire to get this in quickly (as I wrote in #6). I just don't understand why some issues (like #3113992: The 'Update' page has no idea that some updates are incompatible) are stalled for weeks on end while we argue about perfect test coverage, while others (like this one) get the "it's cool if the tests are weird and hard to make sense of, something is better than nothing!" treatment. If we were consistent (in either direction), it wouldn't bother me (much), and I'd adapt to our standards. What's causing me to lose my cool is that we're not consistent, so I get the sense that no matter what I do, it's considered out of scope (or not enough, depending on the reviewer), unhelpful, wrong, etc.

Re: #26: So I guess it's now supposed to be on me to re-review the -C35 version and figure out how much of #17 still counts as a legitimate concern vs. off-topic comments on "obfuscated intentions"? Are we done fiddling with the threshold value? Do y'all believe that #24 represents the accurate intentions of the patch author? Is it worth spending time reviewing it yet, or do you want to keep searching for the magic value that properly represents what's reviewable?

Inventing a new issue tag "Adds technical debt" for issues like this where we know we're adding technical debt, but agree it's best due to other considerations. Tagging for "Needs followup" since a lot of #17 is being called out of scope and should be addressed elsewhere. Please define scoped issues you're all happy with so I can spend time fixing things instead of arguing about scope.

Thanks,
-Derek

tedbow’s picture

Assigned: Unassigned » tedbow

Re: #26: So I guess it's now supposed to be on me to re-review the -C35 version and figure out how much of #17 still counts as a legitimate concern vs. off-topic comments on "obfuscated intentions"?

@dww if it helps I can go through number #17 again to double check what has been addressed in #24 and comment on what is no longer in the patch because #26 make it clear it is a copy(the lines that are no longer in the patch as additions or deletions at all). I can also fix anything I can that is left from #17 if I missed it in #24. Along with general self review.

UPDATE: To clear, I am currently reviewing #17.
so of it was already fixed, some not fixed and trying to fix now, some already in remain tasks and some I believe is still out of scope. Will post a patch soonish.

tedbow’s picture

Assigned: tedbow » Unassigned
StatusFileSize
new113.63 KB
new218.18 KB

Reviewing #17

  1. already fixed
  2. While I still don't think we should wait for agreement on #3113798: Remove unused (and generally wrong) <tag> markup from Update module test XML fixtures to do this issue(for reasons I have stated previously).

    I do agree that current tags are bogus because even with my argument on that issue the values don't match the values that we have on contribute module XML feeds from drupal.org and they don't match the drupal.org documented API

    So yes with the current patch it produces XML that we will have clean up in any case.

    So have updated the script I am using to create the XML to have correct <tag> values. Basically tag should always match version except for dev snapshots.

    I have also add logic to make <date> values. This may be overkill but it is easy to do. Just basically starting the release from particular date and minusing about a month for every previous release. I can remove this logic and recreate the xml if wanted.

    I have added the create-3100386-semver-xml.php script for directly to this patch to make it easier to review and for reviewers to confirm there no XML changes after the script(by deleting the new XML and running the script themselves).
    Obviously this will have to be remove before RTBC.

  3. I still don't think we should wait on.

    #3115435: Make clear why each XML update.module fixture is created the way it is
    #3121020: Move Update Manager XML test fixtures into a fixtures/release-history directory
    for this.

  4. already fixed
  5. I thought fixed but I guess I didn't or reverted it

    Agree, This was left over from when it was in UpdateSemverTestBase. Removed the conditional added to the above array.

  6. already fixed
  7. This is in the remaining tasks for this issue.
  8. 👍
  9. already fixed
  10. This is in the remaining tasks for this issue.
  11. See my comment on #19.12. It's long and no need to duplicate it here.

    tldr; I added what I hope is a inline better comment to explain this. Let me know if the comment is enough or needs to improved.

  12. This is in the remaining tasks for this issue.
  13. Already fixed
  14. I think all for the rest points in #17,expect for 29), 37) and 42), I have the same reasoning:
    This is all copied code as shown in #24 with further explanation in #26 by @tim.plunkett. I think it fine to not review all the code that is being copied.
    Related from @dww in#28

    Tagging for "Needs followup" since a lot of #17 is being called out of scope and should be addressed elsewhere.

    #17 found problems in the code. It seems to fall under, grammar problems, comment improvements, DRY preference, and standards. How should we create follow-ups? Should we create a general follow-up for clean up for all Update tests standards etc? I know these tests are very old so standards have changed and I am sure little problems crept in over the years.

    I am not sure if we scope these issues by per-module, per class, or per standards rule on an all core scope.

    Are we done fiddling with the threshold value?

    Yes, git recognizes as a copy it. That being said addressing #17.29 and 37 by change the value need because this further changes to the file. I think 1 reason git does use a lower value as a standard is it is more expensive(I have noticed the diff takes longer) not because it produces an inaccurate diff.

  15. #17.29 and 37
    I replace the fixtures in the comments
    -   * - drupal.sec.0.1_0.2.xml
    +   * - [::$updateProject].sec.0.1_0.2.xml

    According this format. I am open for other ideas.

    I have also added a class comment explaining this.

  16. #17.42
    My thought on putting these on UpdateTestBase instead of UpdateSemverTestBase was that these 2 functions are assertions based on \Drupal\Tests\update\Functional\UpdateTestBase::$updateTableLocator
    in the UpdateTestBase.
    They have nothing to do with Semver.
    These 2 new functions are the corresponding assertUpdateTable*NotContains() for 2 functions we already have on UpdateTestBase assertUpdateTableTextContains() and assertUpdateTableElementContains(). Although we are not using the new functions on UpdateContribTest, the only other class that extends UpdateTestBase but not UpdateSemverTestBase these new methods should be used in the future if they need these types of assert on the UPdate rather than inventing it's own. We could move them later but I think that could be easily missed and again the 2 new functions have nothing to do with Semver but are rather dealing with the update table which all classes that extend UpdateTestBase deal with.
  17. re #28

    Inventing a new issue tag "Adds technical debt" for issues like this where we know we're adding technical debt, but agree it's best due to other considerations.

    I tried to address some of the techinical debt by cleaning up the tag and date elements in the XML and updating the comments documenting the fixtures to be accurate.

    As far as the code that was moved from UpdateCoreTest to UpdateSemverTestBase in most cases I do not believe this adds to our technical. Although we created a new base class for this issue, would we also consider it new technical debt if we moved a functions with existing problems from 1 existing class to new base class that already existed? If not then I don't think should consider it new technical debt here, if so then yes. I would say no.

    Of course I know that isn't the exact same same case since we did have to change some things about the code such as assert and use of $this->updateProject vs string literal 'drupal'.

    But I am not removing the tag because I am the author of the patch so far so I don't think that is up to me to decide if it is technical debt or not. Just my opinion.

Status: Needs review » Needs work

The last submitted patch, 30: 3100386-30-C35.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

tedbow’s picture

Status: Needs work » Needs review

After ran the create XML script I forgot to update semver_test.1.0.xml for \Drupal\Tests\update\Functional\UpdateSemverContribTest::testUpdatesLegacyToSemver

I think did this before. So hacked the xml creating script to add these and do another update.

tedbow’s picture

StatusFileSize
new222.54 KB
new8.66 KB
tedbow’s picture

Issue summary: View changes
StatusFileSize
new26.95 KB
new248.41 KB

Addressing 2 the remaining tasks from test cases @dww suggested in #17

  1. Add a test cases for releases in 8.x-8. branch to \Drupal\Tests\update\Functional\UpdateSemverContribTest::testUpdatesLegacyToSemver() since this branch might expose bugs around "8" being a major version. see #17.7
  2. Add test cases to UpdateSemverContribTest where the current major is legacy and unsupported and the next major is semver, supported and recommended

This requires 2 new XML test files.

tedbow’s picture

I think this issue getting very big and hard to review, bigger than it needs to be.

I going to change this issue only duplicate the test coverage in UpdateCoreTest for contrib.

Adding 2 follow-ups

  1. #3127168: Create contrib Update test for legacy to semver releases
  2. #3127177: Move test methods not directly related to updates for the Drupal project into their own class

I need to add a 3rd for security release case that is the remaining tasks.

Here is patch that removes testUpdatesLegacyToSemver() and the xml fixture changes it needed.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

dww’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll

This will need a (hopefully trivial) re-roll now that #3121020: Move Update Manager XML test fixtures into a fixtures/release-history directory landed.

jofitz’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
StatusFileSize
new221.51 KB

Re-rolled patch from #35 for D9.1.x

dww’s picture

Status: Needs review » Needs work
PHP Fatal error:  Access level to Drupal\Tests\update\Functional\UpdateCoreTest::$modules must be public (as in class Drupal\Tests\update\Functional\UpdateSemverTestBase) in /var/www/html/core/modules/update/tests/src/Functional/UpdateCoreTest.php on line 13
3 coding standards messages
/var/lib/drupalci/workspace/jenkins-drupal_patches-45170/source/core/modules/update/tests/src/Functional/UpdateTestBase.php
line 288	Expected 1 blank line after function; 2 found
/var/lib/drupalci/workspace/jenkins-drupal_patches-45170/source/create-3100386-semver-xml.php
1	Missing file doc comment
1	The PHP open tag must be followed by exactly one blank line

A) The PHP fatal error needs help. Probably the base class should move $modules to be protected.
B) The patch shouldn't include create-3100386-semver-xml.php
C) The code standard violation for UpdateTestBase.php should be fixed.

narendra.rajwar27’s picture

Assigned: Unassigned » narendra.rajwar27
Status: Needs work » Needs review
StatusFileSize
new218.18 KB
new3.95 KB

Updated patch as mentioned in comment #39

narendra.rajwar27’s picture

StatusFileSize
new4.02 KB

Updated interdiff.txt for comment #40

narendra.rajwar27’s picture

Assigned: narendra.rajwar27 » Unassigned

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

pasqualle’s picture

Version: 9.2.x-dev » 9.1.x-dev
xjm’s picture

Version: 9.1.x-dev » 9.0.x-dev
Issue tags: -beta target, -Adds technical debt

Cleaning up pre-9.0.0 beta targets.

Test issues are patch-eligible.

Version: 9.0.x-dev » 9.1.x-dev

Drupal 9.0.10 was released on December 3, 2020 and is the final full bugfix release for the Drupal 9.0.x series. Drupal 9.0.x will not receive any further development aside from security fixes. Sites should update to Drupal 9.1.0 to continue receiving regular bugfixes.

Drupal-9-only bug reports should be targeted for the 9.1.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.2.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

daffie’s picture

Issue summary: View changes
daffie’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll
ravi.shankar’s picture

Issue tags: -Needs reroll
StatusFileSize
new168.63 KB
new265.88 KB

Added reroll of patch #40 on D-9.1.x

daffie’s picture

Version: 9.1.x-dev » 9.2.x-dev
Issue tags: +Needs reroll

@ravi.shankar: There is something wrong with your rerolled patch. The original has a size of 218kb and your patch is 168kb. It also needs to be rerolled against 9.2.x.

xjm’s picture

Removing credit for the problematic reroll. If you need assistance with how to reroll patches, you can reach out in the Drupal community Slack. Thanks!

ravi.shankar’s picture

Status: Needs work » Needs review
StatusFileSize
new217.93 KB

Thanks @daffie
Here I have again added a reroll, please review.

ravi.shankar’s picture

Issue tags: -Needs reroll
StatusFileSize
new217.93 KB
new1.18 KB

Trying to fix testbot issues of patch #52

daffie’s picture

Status: Needs review » Needs work

Patch is still failing the testbot.

ravi.shankar’s picture

StatusFileSize
new218.01 KB
new2.17 KB

Fixing failed tests.

ravi.shankar’s picture

StatusFileSize
new218.04 KB
new883 bytes

Fixing failed tests of patch #55.

nikitagupta’s picture

Status: Needs work » Needs review
StatusFileSize
new219.1 KB
new2 KB
daffie’s picture

Status: Needs review » Needs work

Just a couple of nitpicks:

  1. +++ b/core/modules/update/tests/src/Functional/UpdateCoreTest.php
    @@ -12,7 +10,7 @@
    +class UpdateCoreTest extends UpdateSemverTestBase {
    

    A better class name would be UpdateSemverCoreTest as we are extending the class UpdateSemverTestBase.

  2. +++ b/core/modules/update/tests/src/Functional/UpdateSemverTestBase.php
    @@ -0,0 +1,468 @@
    +          $this->assertUpdateTableTextContains(t('Up to date'));
    

    Could we not translate the text string or any other text string in this file. It happen multiple times in this class.

  3. +++ b/core/modules/update/tests/src/Functional/UpdateTestBase.php
    @@ -277,6 +277,29 @@ protected function assertUpdateTableElementContains($text) {
    +  /**
    +   * Asserts that the update table text does not contain the specified text.
    +   *
    +   * @param string $text
    +   *   The expected text.
    +   */
    +  protected function assertUpdateTableTextNotContains($text) {
    +    $this->assertSession()->elementTextNotContains('css', $this->updateTableLocator, $text);
    +  }
    

    Could this method be placed directly after the method assertUpdateTableTextContains() as the two method belong together.

@nikitagupta: Thank you for the reroll.

nikitagupta’s picture

Status: Needs work » Needs review
StatusFileSize
new221.07 KB
new45.89 KB
daffie’s picture

Issue summary: View changes
daffie’s picture

Status: Needs review » Reviewed & tested by the community

@nikitagupta: Thank you for fixing the patch!

The patch does what the proposed solution from the IS is saying that should be done.
All code changes look goo to me.
For me it is RTBC.

ilgnerfagundes’s picture

StatusFileSize
new99.9 KB

I reviewed the patch again, and it looks all right. RTBC +1

alexpott’s picture

@ilgnerfagundes I'm seeing quite a few single line comments where you are attaching a screenshot that provides no additional info beyond what the bot / dreditor / gitlab already gives us. So, I've removed the issue credit for that screenshot. In the future, you can get credit for issues by reading the issue to understand its purpose, and posting your review or testing of that purpose. Thank you!

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
+++ /dev/null
@@ -1,932 +0,0 @@
-  public function testSecurityCoverageMessage($installed_version, $fixture, $requirements_section_heading, $message, $mock_date) {
...
-  public function testDatestampMismatch() {
...
-  public function testModulePageRunCron() {
...
-  public function testClearDiskCache() {
...
-  public function testModulePageUpToDate() {
...
-  public function testModulePageRegularUpdate() {
...
-  public function testModulePageSecurityUpdate() {
...
-  public function testServiceUnavailable() {
...
-  public function testFetchTasks() {
...
-  public function testLanguageModuleUpdate() {
...
-  public function testLocalActions() {
...
-  public function testBrokenThenFixedUpdates() {

These tests are being removed by the patch with no obvious replacement. I've searched the issue for most of these tests and I can't see any reasons why they are being removed - only comments which say we need to decide where to put them (eg. testSecurityCoverageMessage). Either the issue summary needs updating to explain why they're not necessary anymore or we should add them to \Drupal\Tests\update\Functional\UpdateSemverCoreTest (or somewhere else).

ilgnerfagundes’s picture

Status: Needs work » Needs review
StatusFileSize
new38.12 KB

Hello guys, I put the methods mentioned in comment # 64 and I'm uploading the patch, but I don't know how I do it to test it.

daffie’s picture

Status: Needs review » Needs work

@Ilgner: Please adjust this patch according to @alexpott in comment #64.

ilgnerfagundes’s picture

StatusFileSize
new183.73 KB

sorry, i had done the wrong patch, i'm sending the new patch

ilgnerfagundes’s picture

Status: Needs work » Needs review
ravi.shankar’s picture

StatusFileSize
new183.73 KB
new571 bytes

Fixed custom commands issues of patch #67.

Status: Needs review » Needs work

The last submitted patch, 69: 3100386-69.patch, failed testing. View results

vsujeetkumar’s picture

Status: Needs work » Needs review
StatusFileSize
new183.75 KB
new424 bytes

Fixing tests.

Status: Needs review » Needs work

The last submitted patch, 71: 3100386_71.patch, failed testing. View results

vsujeetkumar’s picture

Status: Needs work » Needs review
StatusFileSize
new151.95 KB
new33.53 KB

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

phenaproxima’s picture

Assigned: Unassigned » tedbow
Status: Needs review » Needs work

At @tedbow's behest, I just "rerolled" patch #35 into the new merge request !465. I didn't make any changes beyond resolving the conflicts (and fixing coding standards violations so that the tests would run).

In doing so, I discovered the answer to @alexpott's question in #64: the test methods are not being removed; they are simply moved wholesale out of UpdateSemverTestBase and into UpdateCoreTest.

We still need to reapply @daffie's feedback in #58 to return this to RTBC, so I'm assigning this to @tedbow in order to complete it. Since this was very close to a straight-up reroll, hopefully I will still be within issue queue etiquette if I restore RTBC once that's done.

tedbow’s picture

Status: Needs work » Needs review
  1. Pushed up fixes to the test and address feedback in #58
  2. I included a interdiff for the tests from #79. I will explain why we don't want those changes.
tedbow’s picture

Assigned: tedbow » Unassigned
StatusFileSize
new11.95 KB

forgot to add the diff

tedbow’s picture

StatusFileSize
new11.73 KB

Looking at the diff in #78 I realized we did want a couple of the changes

Here is a new diff

tedbow’s picture

This explains the difference between #78 and current MR branch. So stuff probably just got mixed up in the many rerolls

  1. +++ b/core/modules/update/tests/src/Functional/UpdateSemverCoreTest.php
    @@ -13,25 +12,11 @@
    -  use CronRunTrait;
    -
    -  /**
    -   * Modules to enable.
    -   *
    -   * @var array
    -   */
    -  protected static $modules = ['update_test', 'update', 'language', 'block'];
    -
    -  /**
    -   * {@inheritdoc}
    -   */
    -  protected $defaultTheme = 'stark';
    -
    

    These are all the same in `UpdateSemverTestBase` so we don't need them here

  2. +++ b/core/modules/update/tests/src/Functional/UpdateSemverCoreTest.php
    @@ -13,25 +12,11 @@
    -  use CronRunTrait;
    -
    -  /**
    -   * Modules to enable.
    -   *
    -   * @var array
    -   */
    -  protected static $modules = ['update_test', 'update', 'language', 'block'];
    -
    -  /**
    -   * {@inheritdoc}
    -   */
    -  protected $defaultTheme = 'stark';
    -
    

    This is in the base class so doesn't need to be duplicated here.

  3. +++ b/core/modules/update/tests/src/Functional/UpdateSemverCoreTest.php
    @@ -13,25 +12,11 @@
    -
    +  ¶
    

    whitespace error from me. I fixed this.

  4. +++ b/core/modules/update/tests/src/Functional/UpdateSemverCoreTest.php
    @@ -48,7 +33,7 @@ class UpdateSemverCoreTest extends UpdateSemverTestBase {
    -  protected function setSystemInfo($version) {
    +  protected function setProjectInstalledVersion($version) {
    

    These 2 functions did the same thing. Added `setProjectInstalledVersion` so it could be used with the contrib project also and the name is clear what we are doing in relation to the test project.

  5. +++ b/core/modules/update/tests/src/Functional/UpdateSemverCoreTest.php
    @@ -57,13 +42,6 @@ protected function setSystemInfo($version) {
    -  /**
    -   * {@inheritdoc}
    -   */
    -  protected function setProjectInstalledVersion($version) {
    -    $this->setSystemInfo($version);
    -  }
    -
    
    @@ -309,7 +288,7 @@ public function testDatestampMismatch() {
    -    $this->setSystemInfo('8.0.0');
    +    $this->setProjectInstalledVersion('8.0.0');
    

    Also calling the 1 that works with contrib and core now.

  6. +++ b/core/modules/update/tests/src/Functional/UpdateSemverTestBase.php
    @@ -75,7 +72,7 @@ public function testNoUpdatesAvailable() {
    -          $this->assertUpdateTableElementContains('check.svg', 'Check icon was found.');
    +          $this->assertUpdateTableElementContains('check.svg');
    

    This method does not take a 2nd argument. This was left over from when were calling assertRaw() which no longer works because we have to assert on the specific table for core or contrib.

  7. +++ b/core/modules/update/tests/src/Functional/UpdateSemverTestBase.php
    @@ -89,8 +86,6 @@ public function testNormalUpdateAvailable() {
         $this->assertSession()->statusCodeEquals(403);
    

    Unrelated changes. This is not in 9.2.x and doesn't involve the change we are making here.

  8. +++ b/core/modules/update/tests/src/Functional/UpdateSemverTestBase.php
    @@ -241,11 +236,11 @@ public function testSecurityUpdateAvailability($site_patch_version, array $expec
    -   *   This file has the exact releases as [::$updateProject].sec.1.2_insecure
    -   *   .xml. It has a different value for 'supported_branches' that does not
    -   *   contain '8.0.'. It is used to ensure that the "Security update required!"
    -   *   is displayed even if the currently installed version is in an unsupported
    -   *   branch.
    +   *   This file has the exact releases as
    +   *   [::$updateProject].sec.1.2_insecure.xml. It has a different value for
    +   *   'supported_branches' that does not contain '8.0.'. It is used to ensure
    +   *   that the "Security update required!" is displayed even if the currently
    +   *   installed version is in an unsupported branch.
    

    Previous comment broke the file name across 2 lines

  9. +++ b/core/modules/update/tests/src/Functional/UpdateSemverTestBase.php
    @@ -258,7 +253,7 @@ public function testSecurityUpdateAvailability($site_patch_version, array $expec
    -   *   - 8.0.0 Insecure.
    +   *   - 8.0.0 Insecure
    

    Unneeded period

tedbow’s picture

re #64 these methods don't actually have to do with semver test for the core project. They were just in the original UpdateCoreTest. See the follow-up #3127177: Move test methods not directly related to updates for the Drupal project into their own class

tedbow’s picture

Needs follow up was added in #28 because of unaddressed items in #17. I am looking over that to see what is left.

follow-upsfrom #17

  1. -> 12 . code moved to follow-up #3127168: Create contrib Update test for legacy to semver releases
  2. created follow up #3205909: Ensure only needed permissions are used for Update module functional tests. We can't just remove it because some methods use it but we can only add it in those methods.
  3. and 23. re the need to call $this->checkForMetaRefresh();. This was existing code that was being copied but I checked 9.2.x and this branch and removing these calls will fail the test.
  4. existing meta: #1530652: [META] Switch from == to === to prevent mistakes and make brute force password attacks harder
  5. follow up #3205912: Move duplicate code in testNormalUpdateAvailable to a new method
phenaproxima’s picture

Status: Needs review » Reviewed & tested by the community

OK, everything looks good here. The merge request is green, and it appears all feedback is addressed and follow-ups are filed. I say we've done enough iterating. Since my work on this was just a straight-up reroll (and two minor coding standards fixes required to get tests to run), I feel okay re-RTBCing it.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

alexpott’s picture

Version: 9.3.x-dev » 9.2.x-dev
Status: Reviewed & tested by the community » Fixed

Committed and pushed 27070f4c91 to 9.3.x and a1822890bf to 9.2.x. Thanks!

The random xml indentation bugs me but it seems like all of the update xml has this so no reason to hold up this one.

  • alexpott committed 27070f4 on 9.3.x
    Issue #3100386 by tedbow, ravi.shankar, phenaproxima, nikitagupta,...

  • alexpott committed a182289 on 9.2.x
    Issue #3100386 by tedbow, ravi.shankar, phenaproxima, nikitagupta,...

Status: Fixed » Closed (fixed)

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