Problem/Motivation

The keys tasks in the parent issue, #2974445: [Meta] Refactor Migrate Drupal UI Functional tests, are complete. The next and hopefully final step in the refactoring is to review and check if anything was overlooked in the other child issues.

Steps to reproduce

N/A

Proposed resolution

  1. Split testMigrateUpgradeExecute() into two helpers:
    • MigrateUpgradeExecuteTestBase::doUpgradeAndIncremental()
    • MigrateUpgradeTestBase::submitCredentialForm()

    and use everywhere possible. This was suggested in #21.3 and reduces the amount of duplicate code significantly.

  2. Remove duplicate tests about missing source provider
    • MultilingualReviewPageTestBase
    • NoMultilingualReviewPageTestBase
  3. Remove duplicate tests of IdConflictForm. The base class should not
    assume that the d6 and d7 database will cause the same id conflicts.
    That form is tested in d6 and d7 IdConflictTest.
    • MigrateUpgradeExecuteTestBase
    • NoMultilingualReviewPageTest
  4. MigrateUpgradeExecuteTestBase
    • Update documentation
    • Remove remnants of running three upgrades since it now doing
      two. The removed one is now in CredentialFormTest
  5. d6 and d7 IdConflictTest and Upgrade tests
    • tidy the $modules variable, correct the doc block, alphabetize and remove modules that are install by the profile.
      pdate documentation

Remaining tasks

Review
RTBC
Commit

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

quietone created an issue. See original summary.

quietone’s picture

Issue summary: View changes
FileSize
5.14 KB

This patch fixes two things.

  1. The test for missing modules is done more than once, it should only be in the SourceProviderTest.
  2. The SourceProviderTest should be using the new helper method, getCredentials.
quietone’s picture

Status: Active » Needs review

NR for testing

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.

quietone’s picture

A few more

  1. MigrateUpgradeExecuteTestBase
    • Update documentation
    • Remove remnants of running three upgrades since it now doing two. The removed one is now in CredentialFormTest
  2. MigrateUpgradeExecuteTestBase and NoMultilingualReviewPageTestBase.php
    • Remove tests of IdConflictForm. The base class should not assume that the d6 and d7 database will cause the same id conflicts. That form is tested in d6 and d7 IdConflictTest.
quietone’s picture

Assigned: Unassigned » quietone

I plan on doing another review of this in a day or two.

quietone’s picture

Rerolled because #3145005: [November 9, 2020] Remove uses of t() in drupalPostForm() calls was committed.

Removed $connection_options in SourceProviderTest since it is no longer used, it was moved to the method \Drupal\Tests\migrate_drupal_ui\Functional\MigrateUpgradeTestBase::getCredentials in #3143719: Add a getCredentials helper method to migrate_drupal_ui functional tests.

The only thing that I see that could be still be done in the test refactoring is to make an IdConflictTestBase. While that would be nice and be consistent with the other Functional tests and it would make maintenance a little easier I am not able to convince myself that it is worth the effort. The additional of the helper methods and pulling duplicate code into two new tests have (see #2974445: [Meta] Refactor Migrate Drupal UI Functional tests) have significantly improved the readability and the maintainability of the functional tests. If, for some reason, we decide later that the IdConflict tests need more work we can revisit making a base class then.

quietone’s picture

Assigned: quietone » Unassigned
Issue summary: View changes
quietone’s picture

Issue summary: View changes
quietone’s picture

Issue tags: +Needs reroll
quietone’s picture

Status: Needs review » Needs work
adityasingh’s picture

Working on reroll.

adityasingh’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
FileSize
8.32 KB

Reroll the patch for 9.2.x.

quietone’s picture

@adityasingh, thanks for the reroll. Can you provide and interdiff as well. If needed there are instructions for creating an interdiff in the handbook.

adityasingh’s picture

Thanks @quietone for your feedback... this being reroll interdiff is not required
Also the link you shared too has guideline for the same.

quietone’s picture

@adityasingh, I agree that the reroll section on that says that it is not a requirement but that it is nice to have. However, the interdiff or diff is the only thing that will provide proof that another change has not been accidentally introduced in the rerolled patch. I have found that when I have neglected to make a diff a reviewer will request one before they do a review. And now that I do more reviews I understand the point, so that now I almost always make a diff (unless the patch is very small in size) to make life easier for the reviewer and to move the issue along.

That is why I am asking for an interdiff here.

quietone’s picture

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

This needs and diff for the latest patch. There are instructions for creating an interdiff in the handbook.

Suitable for a noivce.

adityasingh’s picture

FileSize
5.76 KB

Hi @quietone
Sorry for late response. Thanks for your valuable suggestion. I agree with you, It is nice to have interdiff for every patch.

Now adding diff.

Thanks..

adityasingh’s picture

Status: Needs work » Needs review
Issue tags: -Novice

Removing the novice tag.

quietone’s picture

@adityasingh, that for coming back and adding the diff. The confirms the reroll is fine and this is ready for review.

benjifisher’s picture

Status: Needs review » Needs work

I think there are some more things we can do to clean up these functional tests beyond what is already done in the patches so far. I do not see another open issue for this, and the title of this issue (and the fact that this is the last open issue on the parent meta issue) suggest that what I want to do is in scope.

  1. Before I get to new suggestions: the issue summary mentions removing IdConflictForm tests from NoMultilingualReviewPageTestBase.php. Maybe that has already been done in some other issue? Unless I am missing something, please remove that from the issue description.

  2. In theory, a test class could extend MigrateUpgradeExecuteTestBase, override the abstract methods from MigrateUpgradeTestBase, and then testMigrateUpgradeExecute() would become a test method in the child class. In the current code, we never do that. I think it would be a good idea to rename testMigrateUpgradeExecute() in the base class to something that does not start with test, and rename the test methods in the child classes to something more specific.

  3. There are five classes that extend MigrateUpgradeExecuteTestBase:

    1. d6\IdConflictTest
    2. d6\NodeClassicTest
    3. d6\Upgrade6Test
    4. d7\IdConflictTest
    5. d7\Upgrade7Test

    Of these, (3) and (5) override testMigrateUpgradeExecute() by calling the function from the parent class and adding a few more assertions. That is reasonable. The other three override testMigrateUpgradeExecute() without calling the method from the parent class. That makes for a lot of duplicated code. It also means that the only thing they inherit from the base class is the setUp() method.

    I think it makes sense to split up testMigrateUpgradeExecute() in the base class into two parts (and rename it). The first part would include everything up to the $this->submitForm($edits, 'Review upgrade'); line. That would be useful in all of the child classes. The second part, with the rest of the code, would be used by (3) and (5).

    While you are at it, make sure that (1), (2), and (4) do not repeat all the steps from the initial drupalGet() to asserting the field mysql[host]. Maybe that is left over from #3143720: Create a separate CredentialFormTest?

  4. Minor point: MigrateUpgradeTestBase uses CreateTestContentEntitiesTrait, but it looks like the methods from that trait are used only in MigrateUpgradeExecuteTestBase, which also uses the trait.

quietone’s picture

Issue summary: View changes
Status: Needs work » Needs review
FileSize
13.92 KB
19.64 KB

@benjifisher, thanks. thorough as usual!

This patch address all the points in #22. It is late in the day and I haven't done a proper self review but let's make sure the tests pass.

Status: Needs review » Needs work

The last submitted patch, 22: 3175953-22.patch, failed testing. View results

quietone’s picture

Issue summary: View changes
Status: Needs work » Needs review

Just updating the IS.

#21.3 testMigrateUpgradeExecute is split into two methods, MigrateUpgradeExecuteTestBase::doUpgradeAndIncremental and MigrateUpgradeTestBase::submitCredentialForm. Note the latter is moved to MigrateUpgradeTestBase and so it can then be used in MultilingualReviewPageTestBase and NoMultilingualReviewPageTestBase.

This is ready for another review.

benjifisher’s picture

Assigned: Unassigned » benjifisher
Issue summary: View changes

I am reviewing the patch in #22.

I notice that the patch in #22 is more than twice as large as the one in #13. That means more simplification! More detail: compared to 9.2.x,

  • Patch from #13 is +7, -80, for net -73.
  • Patch from #22 is +45, -188 for net -143.
benjifisher’s picture

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

@quietone, thanks for the updates! I just notice two more tiny issues that should be easy to handle:

  1. Can we fix this adjacent comment?

     +++ b/core/modules/migrate_drupal_ui/tests/src/Functional/d6/NodeClassicTest.php
     @@ -77,31 +77,12 @@ protected function getMissingPaths() {
        /**
         * Tests ID Conflict form.
         */
     -  public function testMigrateUpgradeExecute() {
     +  public function testNodeClassicUpgrade() {
  2. I compared the two IdConflictTest classes. In addition to the 6/7 difference, they have different modules enabled. I assume there is a reason for enabling file and rdf in the D7 test but not the D6 test. Can you make the others in the same order? In fact, can we sort both lists or do they have to be in dependency order?

    Same question for Upgrade6Test and Upgrade7Test. I assume there is a reason that update is included for D6 but not D7. Of course, these two classes are not nearly as similar as the other two.

quietone’s picture

Issue summary: View changes
Status: Needs work » Needs review
FileSize
4.06 KB
21.76 KB

Sure. Here are the changes.

26.1. Fixed.
26.2. The file and rdf modules do not need to be in the list at all. These tests use the standard install profile which includes file and rdf. So, I have removed those and alphabetized the list if the two IdConflict tests and Upgrade tests as well as correcting the doc block for $modules.

I never did the match before but this patch is +68, -219 for net -151.

benjifisher’s picture

Status: Needs review » Reviewed & tested by the community

@quietone, thanks for indulging me with those little changes. I think this is good to go!

catch’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs reroll

Looks like good clean-up but needs a re-roll.

ayushmishra206’s picture

Assigned: Unassigned » ayushmishra206

Working on this.

ayushmishra206’s picture

Assigned: ayushmishra206 » Unassigned
Status: Needs work » Needs review
Issue tags: -Needs reroll
FileSize
21.9 KB

Rerolled patch #27.

Status: Needs review » Needs work

The last submitted patch, 31: 3175953-31.patch, failed testing. View results

quietone’s picture

@ayushmishra206, can you add the diff?

ayushmishra206’s picture

FileSize
1.79 KB
quietone’s picture

FileSize
2.4 KB

@ayushmishra206, thanks. But that diff looks wrong to me. I downloaded the last two patches and made a diff with diff 3175953-27.patch 3175953-31_0.patch > diff-27-31.txt. That looks better and it helps to identify the error, which is here

311,316c313,318
< -    $this->drupalGet('/upgrade');
< -    $session->responseContains("Upgrade a site by importing its files and the data from its database into a clean and empty new install of Drupal $this->destinationSiteVersion.");
< -
< -    $this->submitForm([], 'Continue');
< -    $session->pageTextContains('Provide credentials for the database of the Drupal site you want to upgrade.');
< -    $session->fieldExists('mysql[host]');
---
>      $this->drupalGet('/upgrade');
>      $session->responseContains("Upgrade a site by importing its files and the data from its database into a clean and empty new install of Drupal $this->destinationSiteVersion.");
> @@ -89,8 +78,8 @@ public function testMigrateUpgradeExecute() {
>      $this->submitForm([], 'Continue');
>      $session->pageTextContains('Provide credentials for the database of the Drupal site you want to upgrade.');
>      $session->fieldExists('mysql[host]');
324c326

The patch in #27 removed lines which are restored in #31. Once they are removed the test should pass.

Cheers.

quietone’s picture

Status: Needs work » Needs review
FileSize
944 bytes
21.83 KB

This was brought up at the migrate meeting noting that it has stalled. To get back on track I am rerolling from #27.

Status: Needs review » Needs work

The last submitted patch, 36: 3175953-36.patch, failed testing. View results

quietone’s picture

Status: Needs work » Needs review
benjifisher’s picture

Status: Needs review » Reviewed & tested by the community

I compared the patches in #27 (which I reviewed and declared RTBC) and #38. The only difference is a few lines of context in MigrateUpgradeExecuteTestBase.php. It looks as though you changed your mind about where to put the new method submitCredentialForm(): in #27, it was the last method in the class, and in #38 it is the second (after setUp()).

Back to RTBC.

  • catch committed 88272ae on 9.2.x
    Issue #3175953 by quietone, adityasingh, ayushmishra206, benjifisher:...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed 88272ae and pushed to 9.2.x. Thanks!

quietone’s picture

This commit was lovely to see this morning. Thanks catch!

Status: Fixed » Closed (fixed)

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