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

Multi-database tests #407

Open
1 of 2 tasks
YC opened this issue Sep 8, 2022 · 3 comments
Open
1 of 2 tasks

Multi-database tests #407

YC opened this issue Sep 8, 2022 · 3 comments

Comments

@YC
Copy link
Collaborator

YC commented Sep 8, 2022

An issue that has occurred in the past is the failure of migrations given different target dbs (sqlite, postgres, mysql).
Most of these should be detectable by doing some automated testing.
i.e. Download and launch previous version of wakapi (and somehow exit), run new version of wakapi.

Databases:

  • postgres
  • mysql/mariadb
  • sqlite

Tasks:

  • Execution of migrations
  • Execution of tests
@muety
Copy link
Owner

muety commented Sep 8, 2022

Thanks for bringing this up. The question is what exactly to test here.

We currently have (a few) unit tests and (a bit more) API tests. But they are only run on Linux and only with SQLite database. I think primary goal would be to extend testing in a way that especially the cross-database compatibility is verified with every CI run. Running the API test suite on MySQL and Postgres as well would probably suffice.

However, I don't know about good practices to automate testing with a fully-fledged database server. CI would have to:

  • Start a temporary MySQL / Postgres server
  • Import initial test data / fixtures (from an SQL file)
  • Start Wakapi
  • Run the newman tests
  • Tear everything down

Has anyone got any experiences about automating this in CI (specifically GH Actions)?

@muety muety changed the title Upgrade Testing Multi-database tests Sep 8, 2022
@muety
Copy link
Owner

muety commented Sep 8, 2022

Just randomly came across https://github.com/dolthub/go-mysql-server. Might actually be interesting, at least for testing the MySQL part.

@YC
Copy link
Collaborator Author

YC commented Sep 8, 2022

It's possible to use service containers when it comes to spawning dbs.
https://docs.github.com/en/actions/using-containerized-services/creating-postgresql-service-containers
There wouldn't be any teardown required if test data is imported/populated on each execution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants