Skip to content

API functional tests drop all tables from main database #36291

Open
@zunsakai

Description

@zunsakai

Preconditions and environment

  • Magento 2.4.5
  • PHP 8.1
  • Mysql 8.0

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>
  1. In dev/tests/api-functional/phpunit_graphql.xml.dist set TESTS_BASE_URL to local domain, TESTS_MAGENTO_INSTALLATION to enabled
  2. cd dev/tests/api-functional
  3. ../../../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

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: Test frameworkComponent: WebapiUse with concrete module component label E.g. "Component: Webapi" + "Catalog"Issue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P2A defect with this priority could have functionality issues which are not to expectations.Progress: ready for devReported on 2.4.5Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchTriage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject it

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions