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

Migrate test database at build time instead of runtime #767

Merged
merged 1 commit into from
Jun 12, 2017

Conversation

sgrif
Copy link
Contributor

@sgrif sgrif commented Jun 9, 2017

While we're running these in the integration tests, they weren't run
before unit tests. Rather than duplicating the logic for this everywhere
that we have a test that interacts with the database, we can just do
this at compile time.

As best I can tell, Cargo doesn't give you any environment variable to
know that you're building for tests and not just a debug build, so I've
set this up to only try to migrate if the env var is present, and not
error in its absense.

Fixes #762.

While we're running these in the integration tests, they weren't run
before unit tests. Rather than duplicating the logic for this everywhere
that we have a test that interacts with the database, we can just do
this at compile time.

As best I can tell, Cargo doesn't give you any environment variable to
know that you're building for tests and not just a debug build, so I've
set this up to only try to migrate if the env var is present, and not
error in its absense.

Fixes rust-lang#762.
@carols10cents carols10cents merged commit 4b05f7e into rust-lang:master Jun 12, 2017
@sgrif sgrif deleted the sg-migrate-test-database branch June 12, 2017 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants