-
-
Notifications
You must be signed in to change notification settings - Fork 48
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
Refactor tests to work with testcontainers #59
Conversation
8fe15dd
to
db1b183
Compare
@Yiling-J Have a look. This is now working, though I have some additional cleanups to do before it's ready to merge. But I'm happy to get your preliminary thoughts. No longer is the use of docker-compose needed for testing. Instead, for the simple case, simply run: MYSQL_DSN=auto PSQL_DSN=auto go test ./... If you want to use an existing, persistent, database (i.e. to avoid the startup time of a docker container for rapid testing), you can do that by providing the dsn: MYSQL_DSN=root:pass@/ PSQL_DSN=postgres://postgres:pass@localhost/ go test ./... Or if you want to test only against MySQL for example: MYSQL_DSN=auto go test ./... I've also updated CI to no longer use services in GitHub actions. While there's nothing wrong with that approach, I like excercising the testcontainers approach in CI as well, just to keep local and CI as similar as possible. Curious to hear your reaction. |
I just went through my PR agian, to look for any cleanups, and didn't find much more than some typo corrections and clarifications. I think this is ready for a proper review now. |
lint failed because of golangci-lint version? I already merge that PR |
Rather than initializing them all at once on startup, we now register the driver on first use. This will allow selectivly disabling some drivers during different test runs.
No description provided.