trilogy-libraries / trilogy

Trilogy is a client library for MySQL-compatible database servers, designed for performance, flexibility, and ease of embedding.
MIT License
697 stars 68 forks source link

Add tasks to drop and create test database #188

Open nickborromeo opened 3 months ago

nickborromeo commented 3 months ago

In the CONTRIBUTING.md it says

To shorten the development loop you can:

a) run trilogy tests locally with: make test b) run ruby binding tests with cd contrib/ruby, bundle exec rake test. It's possible to run a test single example by passing a TESTOPTS environment variable like so: TESTOPTS=-n/test_packet_size_greater_than_trilogy_max_packet_len/.

When you follow these instructions, it will fail if you do not have a test database created. This change adds tasks the following tasks:

When running the ruby binding tests, it will run the db:clean task to drop the test database first (if it exists) and creates it.

I think it will also be helpful to have a similar task in the Makefile so that make test can setup the DB if the user chooses not to use the docker approach. However, I am not sure how to do this 🤔

It might also be useful to push forward with https://github.com/trilogy-libraries/trilogy/issues/170 as we can pontentially move away from Docker for the CI builds.