-
Notifications
You must be signed in to change notification settings - Fork 645
Following contribution guidelines, test database not migrated #988
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
Comments
I think my recent PR #987 will resolve this. It ensures that the build script is run again when the timestamp on the migrations/ directory changes. |
@jtgeibel unfortunately i don't think your PR will help this :( Here's how I'm able to reproduce, I'm not sure exactly what steps @autodidaddict took but I suspect it's similar to this:
I think we want to attempt to run the migrations every time we run |
I originally ran into this in #762 and the build script was added in #767. I think the main issue is that there is no way to wire in to My guess to the problem here is that the steps in the Starting the server and the frontend section appear before the Running the backend tests section. So when following the steps in order, the first time the build script is run the test database does not yet exist. Once the test database is created, there is no timestamp change to cause the migrations to run. I wonder if we could resolve this by simply swapping the order of these two subsections (although currently the first one is h5 and the second h4). Also related is that the TEST_DATABASE_URL environment variable is typically defined in The only alternative I see is going back to an implementation similar to what existed before #767 and including the hook in each test binary so that it doesn't matter which order cargo executes them in. |
@LawnGnome since you went through the contribution guidelines a while ago, do you know if this issue is still relevant? feel free to close, if it is not :) |
Pretty sure this is all good now. |
I was following step-by-step in the
CONTRIBUTING
file and doing things in the order specified. It did not migrate the test database, so when I went to run the tests viacargo test
, it failed complaining about a missing relationship.My workaround was to set the
DATABASE_URL
to the test database URL and run the diesel migrate , then set the url back to the regular one. I was then able to runcargo test
. I don't know whether there's a problem in the tests or whether the problem is in the instructions for contributing. Either way, this could be discouraging if someone stumbles on this and doesn't think to hack the URLs for a workaround.The text was updated successfully, but these errors were encountered: