-
-
Notifications
You must be signed in to change notification settings - Fork 82
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
Implement "transactional fixtures" (or "transactional tests") #24
Comments
Would it simply work to just add another function like this
and replace the sql.DB with a sqlTx? I haven't looked at closely but with my limited go knowledge I suspect it would cause an explosion of code duplication internallly, but I'm mostly thinking out loud about the public API |
I am currently doing this using this library in conjunction with go-txdb i have a shell script that runs my tests, and i load the fixtures once using the testfixtures cli, and then run go test ./... I would be interested in seeing a go API to do this as well though. |
@KoduIsGreat I don't think there's a reason to specifically use the CLI to load fixtures. You could use the library to load fixtures once, and then use go-txdb to wrap each test in a transaction. |
In my company we run all tests using https://github.com/DATA-DOG/go-txdb with ease (parallel tests in single package x multiple parallel package) I think it would be nice to document and/or add some example/test for reference. Other than that: I don't think we should implement anything in this library. |
Originally asked in #23, but I've being thinking about it for some time.
Today, this lib cleans the database, load everything and then commit the changes for every test run. Rails has an option called "transactional fixtures" (or "transactional tests"), where fixtures are loaded once before all tests, and then each test runs inside a transaction. This would allow concurrent running of tests that touch the database.
Needs investigation on implementation and the better public interface to expose this.
Ideas and help would be very much appreciated.
The text was updated successfully, but these errors were encountered: