Problem/Motivation
If a module has a (manually created) composer.json in its repository (for example to use .tugboat) then the module dependencies from submodules are completely ignored and tests fail with message:
Unable to install modules cookies, etracker, cookies_etracker, test_page_test, block, js_deprecation_log_test, css_disable_transitions_test due to missing modules cookies.
eventhough the dependencies are present in the submodule .info.yml file:
dependencies:
- cookies:cookies
- etracker:etracker
The case for example occured in https://www.drupal.org/project/etracker module with the cookies_etracker submodule.
I found a workaround here: https://github.com/acquia/coding-standards-php/issues/6
and implemented the following workaround:
https://git.drupalcode.org/project/etracker/-/merge_requests/24/diffs?co...
Now the test is executed as expected:
https://www.drupal.org/pift-ci-job/2241319 (The now failing 2 tests are expected due to a current bug in cookies schema!)
Update: Workaround doesn't work!
Another workaround I tried was to add
test_dependencies:
- cookies:cookies
in the etracker.info.yml file in the parent module, but that didn't change things as it's not relevant to the composer.yml used by the testbot.
Also you can very handy compare the situation to the Userlike module: https://www.drupal.org/project/userlike which is a clone of etracker for a different service and with cookies_userlike submodule. It does NOT have a custom composer.json file and therefor everything works fine and the testbot downloads and enables the submodule dependencies correctly!
Steps to reproduce
- Create a module and a submodule within with Functional tests.
- Let the submodule depend (dependencies in .info.yml) on a different contrib module which has to be downloaded by the testbot. Add all dependencies to the
$modules
array in the FunctionalTest. - Run test and see in the console that all dependencies from the main module and submodule are downloaded correctly. => WORKS AS EXPECTED!
- Add a custom composer.json to the parent module, of course NOT containing the submodule dependencies, as you wouldn't want them!
- Run test and see in the console that all dependencies from the main module composer.json are downloaded correctly. But the submodules dependencies are missing completely and all submodule tests fail! => BROKEN!
Important update:
See my comment #7 below and examples in #3249459: Failing issue fork tests in submodule due to infrastructure issue with composer this problem does only seem to exist in issue forks, not for the project main tests!
Proposed resolution
Eventhough a composer.json exists in a module, dependencies from the submodules have to be considered and fulfilled for the test runs like composer.json wasn't existing.
Comments
Comment #2
AnybodySadly my workaround with the composer.json in the submodule doesn't work! I had forgotten to remove the dependency from the main module I added for testing before.
So the only workaround I currently see is to completely remove the composer.json from the main module... :(
Comment #3
AnybodyComment #4
AnybodyAny chance for feedback here? This affects us in several modules with submodules, can someone confirm the issue or tell me, what we're doing wrong?
Comment #5
AnybodyMoving this to "DrupalCI: Drupal.org Testing Infrastructure" project, hope to get some feedback there as the issue is blocking submodule tests to work correctly. If the issue is wrong there, please move it to the right place and excuse me.
Comment #6
AnybodyComment #7
AnybodyThis is crazy... as we just saw in #3249459: Failing issue fork tests in submodule due to infrastructure issue with composer the tests are green for the project (at https://www.drupal.org/node/475370/qa run with the same code) but fail in a fresh issue fork!
Comment #8
AnybodyComment #9
AnybodyChanged the title accordingly, I'm still confused, such a crazy thing... :D
Comment #10
AnybodyHere's another example from a different (sub)module:
https://www.drupal.org/project/cookies/issues/3294968#comment-14640535
So I'll set the priority to Major as any module with submodules and other contrib dependencies is potentially affected by this bug.
Comment #11
Grevil CreditAttribution: Grevil as a volunteer and at DROWL.de commentedThis problem just appeared again in #3323038: Submoduletests in issues broken without a change:
The testing suite inside the issue fork doesn't require the submodule's required module "drupal/facebook_pixel" and therefore can not install it.
Comment #12
Anybody@MegaChriz found the solution: Use
require-dev
in composer to make things work!See #3323038: Submoduletests in issues broken without a change or this commit for the appropriate change. So this can finally be closed! Thank you so much @MegaChriz! :)