Skip to content

Integration tests create stub modules in app/code #12696

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Vinai opened this issue Dec 14, 2017 · 9 comments
Closed

Integration tests create stub modules in app/code #12696

Vinai opened this issue Dec 14, 2017 · 9 comments
Assignees
Labels
Component: Framework/Code Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release

Comments

@Vinai
Copy link
Contributor

Vinai commented Dec 14, 2017

When even a single integration test is executed, the following files and directories are created:

app/code/Magento
├── TestModuleDirectoryZipCodes
│   ├── etc
│   │   ├── module.xml
│   │   └── zip_codes.xml
│   └── registration.php
├── TestModuleFakePaymentMethod
│   ├── Gateway
│   │   └── Command
│   │       └── DoNothingCommand.php
│   ├── etc
│   │   ├── config.xml
│   │   ├── di.xml
│   │   └── module.xml
│   └── registration.php
└── TestModuleSample
    ├── composer.json
    ├── etc
    │   └── module.xml
    └── registration.php

(Note: the module Magento_TestModuleFakePaymentMethod is not generated in Magento 2.2.0).
This is a problem because running integration tests should not affect the installed Magento instance.

Preconditions

Reproduced on fresh installations of Magento 2.2.0 and 2.2.2. I haven't tried on Magento 2.2.1.

Steps to reproduce

  1. Install Magento, e.g. composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition . and so on.
  2. Run all integration tests or create a custom module with nothing but a single integration test.
  3. Run the test, e.g. /var/www/example/vendor/phpunit/phpunit/phpunit --configuration /var/www/example/dev/tests/integration/phpunit.xml /var/www/example/app/code/Example/Foo/Test/Integration

Expected result

  1. Only the specified tests should run in isolation.
  2. Potential production code should not be affected.

Actual result

The modules are created in app/code/Magento potentially affect production code and are created independently if they are used in any test.

It should be possible to create the modules under dev/tests/integration/tmp in the sandbox directory and register them in the test process with the component registrar instead, leaving the app/code directory unmodified.

@magento-engcom-team
Copy link
Contributor

Hi @Vinai. Thank you for the report. We are moving your feature request to the special project. You can track this issue here: magento/community-features#38

@avstudnitz
Copy link
Contributor

@magento-engcom-team This is not a feature request, but clearly a bug. Please reopen and fix.

@miguelbalparda
Copy link
Contributor

Reopening this, sorry about that.

@miguelbalparda miguelbalparda reopened this Aug 2, 2018
@avstudnitz
Copy link
Contributor

The problem with this behavior: I can add app/code/Magento to my .gitignore , but even if I do, and I call bin/magento setup:upgrade some time after running the integration tests, the modules are being added to app/etc/config.php which is not in my .gitignore (and shouldn't be).

@ghost ghost self-assigned this Aug 3, 2018
@ghost ghost added Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release Component: Framework/Code labels Aug 3, 2018
@ghost ghost removed their assignment Aug 3, 2018
@ghost
Copy link

ghost commented Aug 3, 2018

@Vinai, thank you for your report.
We've acknowledged the issue and added to our backlog.

@jalogut
Copy link
Contributor

jalogut commented Sep 4, 2018

There is another mayor problem with that. If you use a build pipeline, these modules might go to your production environment as you create a zip of the code after successfully executing integration tests. If that happens, checkout gets broken in your production environment.

See: #12679

Of course, people can remove these modules before creating the artifact to deploy but it would help if they will not be created at all. People will probably face this issue the first time and they will get a broken checkout for several hours as the bug is really difficult to figure out.

@schmengler
Copy link
Contributor

schmengler commented Oct 1, 2018

The problem is even bigger as soon as queue tests come into play:

    'Magento_TestModuleAsyncAmqp' => 1,
    'Magento_TestModuleDirectoryZipCodes' => 1,
    'Magento_TestModuleFakePaymentMethod' => 1,
    'Magento_TestModuleMessageQueueConfigOverride' => 1,
    'Magento_TestModuleMessageQueueConfiguration' => 1,
    'Magento_TestModuleSample' => 1,
    'Magento_TestModuleSynchronousAmqp' => 1,

Those test modules fire up a "few" queue consumers:

$ bin/magento queue:consumer:list
quoteItemCleaner
inventoryQtyCounter
queue.for.multiple.topics.test.c.deprecated
mixed.sync.and.async.queue.consumer.deprecated
queue.for.multiple.topics.test.d.deprecated
deprecatedConfigAsyncStringConsumer
deprecatedConfigAsyncMixedConsumer
deprecatedConfigAsyncBoolConsumer
deprecatedConfigSyncBoolConsumer
overlappingConsumerDeclaration
synchronousRpcTestConsumer.deprecated
queue.for.multiple.topics.test.c
queue.for.multiple.topics.test.d
queue.for.multiple.topics.test.y
queue.for.multiple.topics.test.z
mixed.sync.and.async.queue.consumer
mtmh.queue.1.consumer
mtmh.queue.2.consumer
wildcard.queue.one.consumer
wildcard.queue.two.consumer
wildcard.queue.three.consumer
wildcard.queue.four.consumer
consumer1
consumer2
consumer3
consumer4
consumer5
synchronousRpcTestConsumer
RemoteServiceTestConsumer
queue.for.multiple.topics.test.a
queue.for.multiple.topics.test.b

That's one PHP process per entry, hogging resources...

@avstudnitz
Copy link
Contributor

I am working on this #squashtoberfest

@magento-engcom-team
Copy link
Contributor

@magento-engcom-team magento-engcom-team added the Fixed in 2.3.x The issue has been fixed in 2.3 release line label May 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Framework/Code Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release
Projects
None yet
Development

No branches or pull requests

8 participants