Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mkalkbrenner created an issue. See original summary.

idebr’s picture

Is this issue specifically for the changes to search_api_solr_defaults tests currently included in #3042605-5: Drupal 9 Deprecated Code Report?

mkalkbrenner’s picture

You gave the starting point but unfortunately it is more than this :-(

I created a branch on github: https://github.com/mkalkbrenner/search_api_solr/tree/3042605
And a PR: https://github.com/mkalkbrenner/search_api_solr/pull/46

It contains the drupal 9 deprecation things and a lot of fixes for the tests. But the tests still fail on travis. Help is appreciated!

idebr’s picture

\Drupal\Tests\search_api_solr_defaults\Functional\IntegrationTest tries to install the 'Solr Search Defaults' module through the Extend (admin/modules ) page. This page shows

Requires: Comment TextField Filter User System Image File Node Views Search API Solr (disabled) Language Search API (>=8.x-1.14) (incompatible with version )

This is caused by this line in .travis.yml:59, since -dev version do not include a version number
composer require drupal/search_api:1.x-dev

There are a few ways to work around this:

  1. Test \Drupal\Tests\search_api_solr_defaults\Functional\IntegrationTest with a stable release of Search API that includes a version number
  2. Rely on https://www.drupal.org/project/composer_deploy to provide a version number for a dev release
  3. Remove the Search API version requirement from search_api_solr.info.yml
mkalkbrenner’s picture

Status: Active » Needs review
FileSize
7.17 KB

Thanks for your input!

We already use composer_deploy. But you're right, it's not used in this Integration test.

idebr’s picture

This interdiff to https://github.com/mkalkbrenner/search_api_solr/pull/46 fixed the errors for me locally.

idebr’s picture

FileSize
1.07 KB
mkalkbrenner’s picture

Status: Needs review » Needs work

Thanks, that helped.
But there were more things required to get it to work on travis. The test now passes until the index should be deleted:

1) Drupal\Tests\search_api_solr_defaults\Functional\IntegrationTest::testInstallAndDefaultSetupWorking
1765
Error: Call to undefined function Drupal\search_api_solr\Utility\search_api_solr_merge_default_index_third_party_settings()
1766
1767
/home/travis/build/mkalkbrenner/drupal/modules/contrib/search_api_solr/src/Utility/Utility.php:965
1768
/home/travis/build/mkalkbrenner/drupal/modules/contrib/search_api_solr/src/Plugin/search_api/backend/SearchApiSolrBackend.php:3561
1769
/home/travis/build/mkalkbrenner/drupal/modules/contrib/search_api_solr/src/Plugin/search_api/backend/SearchApiSolrBackend.php:3570
1770
/home/travis/build/mkalkbrenner/drupal/modules/contrib/search_api_solr/src/Plugin/search_api/backend/SearchApiSolrBackend.php:1100
1771
/home/travis/build/mkalkbrenner/drupal/modules/contrib/search_api_solr/src/Plugin/search_api/backend/SearchApiSolrBackend.php:893
1772
/home/travis/build/mkalkbrenner/drupal/modules/contrib/search_api/src/Entity/Server.php:317
1773
/home/travis/build/mkalkbrenner/drupal/modules/contrib/search_api/src/Entity/Index.php:1575
1774
/home/travis/build/mkalkbrenner/drupal/core/lib/Drupal/Core/Entity/EntityStorageBase.php:414
1775
/home/travis/build/mkalkbrenner/drupal/core/lib/Drupal/Core/Entity/EntityBase.php:403
1776
/home/travis/build/mkalkbrenner/drupal/modules/contrib/search_api_solr/modules/search_api_solr_defaults/tests/src/Functional/IntegrationTest.php:168

I wonder why that passes on your local environment?

(Note that the PR on github has new code.)

  • mkalkbrenner committed 19af602 on 8.x-3.x
    Issue #3071739 by idebr, mkalkbrenner: fix search_api_solr_defaults...
  • mkalkbrenner committed 1d98ee7 on 8.x-3.x
    Issue #3071739 by mkalkbrenner: fix search_api_solr_defaults tests
    
  • mkalkbrenner committed 2130c15 on 8.x-3.x
    Issue #3071739 by idebr, mkalkbrenner: fix search_api_solr_defaults...
  • mkalkbrenner committed 434f893 on 8.x-3.x
    Issue #3071739 by idebr, mkalkbrenner: fix search_api_solr_defaults...
  • mkalkbrenner committed 4decfe9 on 8.x-3.x
    Issue #3071739 by idebr, mkalkbrenner: fix search_api_solr_defaults...
  • mkalkbrenner committed 55ff261 on 8.x-3.x
    Issue #3071739 by idebr, mkalkbrenner: fix search_api_solr_defaults...
  • mkalkbrenner committed a2b5119 on 8.x-3.x
    Issue #3071739 by idebr, mkalkbrenner: fix search_api_solr_defaults...
  • mkalkbrenner committed df10af7 on 8.x-3.x
    Issue #3071739 by idebr, mkalkbrenner: fix search_api_solr_defaults...
  • mkalkbrenner committed f970276 on 8.x-3.x
    Issue #3071739 by idebr, mkalkbrenner: fix search_api_solr_defaults...
mkalkbrenner’s picture

So the essential stuff of the test is working again and will now be tested on travis on every run.
But we still have a failure I mentioned in #8 which I skipped now in the test code to not block the release.

mkalkbrenner’s picture

Assigned: mkalkbrenner » Unassigned
idebr’s picture

I probably had a different version of your PR. I'm still getting used to working with remote branches.

Anyway, to fix the failure you mentioned in #8:


    // Install the search_api_solr_defaults module.
    $edit_enable = [
      'modules[search_api_solr_defaults][enable]' => TRUE,
    ];
    $this->drupalPostForm('admin/modules', $edit_enable, 'Install');
    $this->assertSession()->responseContains('Some required modules must be enabled');
    $this->drupalPostForm(NULL, [], 'Continue');
    $this->assertSession()->responseContains('modules have been enabled');
    $this->rebuildContainer();

Add a line after this:

$this->resetAll();

/**
* Resets all data structures after having enabled new modules.
*
* This method is called by FunctionalTestSetupTrait::rebuildAll() after
* enabling the requested modules. It must be called again when additional
* modules are enabled later.
*
* @see \Drupal\Core\Test\FunctionalTestSetupTrait::rebuildAll()
* @see \Drupal\Tests\BrowserTestBase::installDrupal()
* @see \Drupal\simpletest\WebTestBase::setUp()
*/
protected function resetAll() {

\Drupal\Core\Test\FunctionalTestSetupTrait::resetAll

mkalkbrenner’s picture

  • mkalkbrenner committed 14ba0f3 on 8.x-3.x
    Issue #3071739 by mkalkbrenner, idebr: fix search_api_solr_defaults...
  • mkalkbrenner committed e70069c on 8.x-3.x
    Issue #3071739 by mkalkbrenner, idebr: fix search_api_solr_defaults...
mkalkbrenner’s picture

Status: Needs work » Fixed
idebr’s picture

Love it, nice work!

Status: Fixed » Closed (fixed)

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