Initial foray at integration embedded PostgreSQL.#40
Initial foray at integration embedded PostgreSQL.#40bobmcwhirter merged 11 commits intoguacsec:mainfrom
Conversation
|
I absolutely like that. If running tests, can they still run in parallel? |
|
Currently not on CI but I'm sure we can sort that out |
Initially only applies for #[cfg(test)] types of targets, to convert "integration tests" into "unit tests". The special system constructor returns a handle to the temporary database process, which *must be held onto* through the duration of a given test, as having it Drop'd causes the DB to shutdown. Note: this includes assigning it to _ or _db, hence using an actually named (but other unused) variable.
Formatting.
e9c45e3 to
d165483
Compare
|
I think ultimately we need to upstream a PR to the postgresql-embedded crate for 2 reasons:
|
|
(after a first run locally, when pgsql is installed/init'd, you can run tests concurrently no problem) |
mrizzi
left a comment
There was a problem hiding this comment.
Just a comment based on local testing.
|
|
||
| - name: Test | ||
| run: cargo test | ||
| run: cargo test -- --test-threads=1 --nocapture |
There was a problem hiding this comment.
Testing this locally for me it worked successfully with just cargo test. I'm wondering if, after your latest changes, --test-threads=1 is still required or it can be removed.
There was a problem hiding this comment.
I suspect it's only a problem on a perfectly-clean system that has never run the tests before (such as a CI worker).
mrizzi
left a comment
There was a problem hiding this comment.
@bobmcwhirter thanks a lot 👍
Initially only applies for #[cfg(test)] types of targets, to convert "integration tests" into "unit tests".
The special system constructor returns a handle to the temporary database process, which must be held onto through the duration of a given test, as having it Drop'd causes the DB to shutdown.
Note: this includes assigning it to _ or _db, hence using an actually named (but other unused) variable.