Skip to content
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

Abstract database specific tests and fixtures #19647

Open
bx80 opened this issue Aug 19, 2022 · 0 comments
Open

Abstract database specific tests and fixtures #19647

bx80 opened this issue Aug 19, 2022 · 0 comments
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc.

Comments

@bx80
Copy link
Contributor

bx80 commented Aug 19, 2022

Our test suite contains tests and fixtures which execute MySQL specific DDL statements. In order to support alternative databases we need to abstract these statements to the core/Db class or PDO adapter. Ideally tests and fixtures should never execute DDL statements directly.

Suggested Approach

  • Identify MySQL specific tests that only make sense to run on MySQL, adjust these tests to check which PDO adapter is in use and markTestSkipped if not running the MySQL PDO adapter.

  • Non-db specific tests and fixtures that directly create tables or databases need to be abstracted to methods in core/Db which could then abstract to the PDO adapter as needed.

  • Integration tests depend on the OmniFixture database dump which is MySQL specific:

    • Rename the OmniFixture dump based on the database adapter name is it suited for, ie. OmniFixture-dump-mysql.sql.

    • A new getOmniFixtureFilename() method should be added to core/Db/AdapterInterface this will return the OmniFixture filename to use so PDO Adapters can share the same dump if required. The standard Matomo MySQL PDO adapter should return OmniFixture-dump-mysql.sql.

    • Integration testing code should use the chosen PDO Adapter getOmniFixtureFilename() method to determine the OmniFixture data to load. Future PDO adapters can then override this method load data suitable for their schema.

    • Clean up the instructions and commands around generating new OmniFixture dumps.

@bx80 bx80 added the Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. label Aug 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc.
Projects
None yet
Development

No branches or pull requests

2 participants