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

Add tests based on SQLite database #105

Open
PGijsbers opened this issue Nov 17, 2023 · 1 comment
Open

Add tests based on SQLite database #105

PGijsbers opened this issue Nov 17, 2023 · 1 comment
Labels
dev-tools Anything related to the developer tooling (CI, pre-commit, etc.)

Comments

@PGijsbers
Copy link
Contributor

Having tests that are not dependent on the MySQL database would be a nice addition because:

  • the fewer tests rely on a test database, the fewer changes need to be made when the test database needs to be modified
  • it's easier to parallelize tests, as they can run on separate instances of a database

The disadvantage is that a lot of tests will be "hard" to set up with a SQLite database, requiring many different tables with populated data that cover many edge cases. This likely will make it harder to interpret what is going on again, so perhaps using it only for tests which require at most a few tables with a few rows is best.

An example of a test which seems suited to run on SQLite is validating the subquery in data/list:

SELECT ds1.`did`, ds1.`status`
FROM dataset_status as ds1
WHERE ds1.`status_date`=(
    SELECT MAX(ds2.`status_date`)
    FROM dataset_status as ds2
    WHERE ds1.`did`=ds2.`did`
)

because it relies only on a single table and a few rows to test all expected permutations.

@PGijsbers PGijsbers added the dev-tools Anything related to the developer tooling (CI, pre-commit, etc.) label Nov 17, 2023
@PGijsbers
Copy link
Contributor Author

Jos advised against using SQLite if it is (easily) avoidable, since you will have to account for "minor" implementation differences (such as handling errors). Differences in behavior might also be functional (e.g., keys may be case-sensitive in one, but not the other).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dev-tools Anything related to the developer tooling (CI, pre-commit, etc.)
Projects
None yet
Development

No branches or pull requests

1 participant