Repository navigation
Create "empty" test database in unit tests - #113
Merged
Merged
Conversation
* Work off empty database (tables populated in tests) * Simplify CI configuration, and run PG tests on python 3
dnadeau-lanl
approved these changes
Jan 7, 2022
8 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
To date, the unit tests proceed mostly by working on a "reference" sqlite database checked into the repository. One of these is "empty", i.e. contains only the dbprocessing table structure but no data.
This PR removes the checked-in empty database. All tests which use an empty database now create the database structure on the fly at the beginning of the test and destroy it at the end.
This PR also checks for
PGDATABASE. If it is set, the empty database tests work on an empty Postgresl database instead of sqlite. The database itself must exist, but not the tables. Other tests continue to use sqlite (this is a task for the future). Because of this, a few test failures in Postgresql were also fixed. Only about 20 of the unit tests work on the empty database, but it's a start.There was some special handling for Postgres testing in the CI suite; that's gone now. The only difference is the setting of the environment variable.
A note on performance: Obviously all this setup/teardown takes some time. Comparison of timing, for running the entire test suite:
So there isn't much of a performance penalty for tests we already had, and the "slow" bit is brand-new tests of the Postgres functionality, which may just plain have more overhead anyhow.
PR Checklist
Closes #if this PR closes the issue, or some other reference, such asSee #if it is related in some other way)At this point I'm not putting something in release notes because it isn't a substantial improvement in Postgres support, but it's a step towards #14. I want to get this in the bag before converting the rest of the tests. (Also make sure the CI works properly.)