Skip to content
This repository has been archived by the owner on Sep 2, 2021. It is now read-only.

Create test database and run migrations from Rust #67

Open
jimmycuadra opened this issue Jun 11, 2016 · 2 comments
Open

Create test database and run migrations from Rust #67

jimmycuadra opened this issue Jun 11, 2016 · 2 comments

Comments

@jimmycuadra
Copy link
Member

I'd like to support a workflow where Ruma can be developed with only Docker Compose, not requiring Postgres, diesel-cli, or even Rust to be installed on the host computer.

Right now the procedure for running the test suite looks like this:

  1. cargo test --no-run to make sure there are no compilation errors before starting the heavy machinery.
  2. Start the test database in a Docker container.
  3. Run diesel-cli's commands to create the database and run the migrations.
  4. cargo test

A better flow would be to have the test code itself manage the creation (or drop and recreation) of the test database and migrations. Then everything could be wired up with Docker Compose and there could be a script that did something like docker-compose run --rm cargo test, which would start a dependent "postgres" service, but not require any external tooling to manage stuff.

@jimmycuadra
Copy link
Member Author

In order to do this nicely, it'll be necessary for diesel_cli's database setup functionality to be exposed via a Rust API. See diesel-rs/diesel#357

@jimmycuadra
Copy link
Member Author

This is done, but I'm gonna leave this issue open so that the internals of the test module can be cleaned up a bit in the event that diesel_cli adds a public API as mentioned in the comment above.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

1 participant