magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.53k stars 9.31k forks source link

API functional tests drop all tables from main database #36291

Open zunsakai opened 2 years ago

zunsakai commented 2 years ago

Preconditions and environment

Steps to reproduce

  1. Install magento live site into database magento_db
  2. Create separate database magento_functional_tests
  3. In folder dev/tests/api-functional/config, copy install-config-mysql.php.dist to install-config-mysql.php, post-install-setup-command-config.php.dist to post-install-setup-command-config.php
  4. Write down db name (magento_functional_tests), user, password,... into dev/tests/api-functional/config/install-config-mysql.php
  5. In dev/tests/api-functional/phpunit_graphql.xml.dist add new testsuite base on my module
    <testsuite name="MYVENDOR_FUNCTIONAL_TESTS_APP_CODE">
    <directory>../../../app/code/MyVendor/*/Test/Functional</directory>
    </testsuite>
  6. In dev/tests/api-functional/phpunit_graphql.xml.dist set TESTS_BASE_URL to local domain, TESTS_MAGENTO_INSTALLATION to enabled
  7. cd dev/tests/api-functional
  8. ../../../vendor/bin/phpunit --configuration ../../../dev/tests/api-functional/phpunit_graphql.xml.dist --testsuite "MYVENDOR_FUNCTIONAL_TESTS_APP_CODE"

Expected result

Web Api tests should run on test database as configured in step 4 (magento_functional_tests) Main database is intact.

Actual result

Test database is intact. All tables are deleted from main database (magento_db)

Additional information

I don't know why it affects the main database, but in the scope of testing, don't touch the main data.

Release note

No response

Triage and priority

m2-assistant[bot] commented 2 years ago

Hi @kylepham103. Thank you for your report. To speed up processing of this issue, make sure that you provided the following information:

Make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, review the Magento Contributor Assistant documentation.

Add a comment to assign the issue: @magento I am working on this

To learn more about issue processing workflow, refer to the Code Contributions.


:clock10: You can find the schedule on the Magento Community Calendar page.

:telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

zunsakai commented 2 years ago

I also found a few similar tickets here https://github.com/magento/magento2/issues/26875 https://github.com/magento/magento2/issues/18769 But I have not found any solution or explanation for this problem. I tried other configs, but main database is always affected

chalov-anton commented 2 years ago

@magento give me 2.4-develop instance

magento-deployment-service[bot] commented 2 years ago

Hi @chalov-anton. Thank you for your request. I'm working on Magento instance for you.

magento-deployment-service[bot] commented 2 years ago

Hi @chalov-anton, here is your Magento Instance: https://8f1a02000c0d783ab56d9c1b872b7876.instances.magento-community.engineering Admin access: https://8f1a02000c0d783ab56d9c1b872b7876.instances.magento-community.engineering/admin_5fbc Login: 8e4bf987 Password: 2c754f4e0522

gwharton commented 1 year ago

Also see the following related

https://github.com/magento/magento2/issues/27213

And the following with a detailed analysis of why it does what it does when I looked at it last year.

https://github.com/magento/magento2/issues/33696

m2-assistant[bot] commented 1 year ago

Hi @engcom-November. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

engcom-November commented 1 year ago

Verified the issue on Magento 2.4-develop instance and the issue is reproducible. On using separate database while running API functional tests, all the data from main database is removed. Hence confirming this issue.

github-jira-sync-bot commented 1 year ago

:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-7088 is successfully created for this GitHub issue.

m2-assistant[bot] commented 1 year ago

:white_check_mark: Confirmed by @engcom-November. Thank you for verifying the issue.
Issue Available: @engcom-November, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

cmuench commented 1 year ago

Where can we see the update of this issue? Anyone here?

cmuench commented 1 year ago

Anyone working on that issue?

JesKingDev commented 1 year ago

This is bananas. +1 on getting this fixed.

omarabdelaz1z commented 8 months ago

Any updates? Still occurs in 2.4.6 p-3