feat: Support for specifying multiple databases in test macros.#4050
feat: Support for specifying multiple databases in test macros.#4050masato-hi wants to merge 5 commits intolaunchbadge:mainfrom
Conversation
|
Any APIs that are only exported from I say that because this is unlikely to land in 0.9.0 as I'm really trying to fight feature creep because otherwise I'll never get it out the door. |
I agreed that this is a non-breaking change because the API is not used by general users.
What should I do?
|
|
This PR can stay as-is, I was just letting you know that I might take a while to review it properly. |
This makes it possible to specify multiple databases with the
sqlx::testmacro.Adds grouping by
envand specification of environment variable names byvaras macro arguments.This makes it easier to write tests for the following cases:
Sharded databases
Multiple types of databases (for example, the case below).
Uses Sqlite as local master data and stores variable data in remote PostgreSQL.
A relational database and a RDB compatible NoSQL database.
Concerns
Are the argument names
envandvarambiguous?Other changes.
TestArgs::no_migratorto simplify macro implementation.TestArgs::database_url_varto save the environment variable name when running tests.cleanup_test_dbs_by_urlfunction toTestSupport, which deletes test databases from the database_url argument.TestFnwith a macro, but this is not done as this is intended to be a reference implementation for macro implementation.Does your PR solve an issue?
closes #2220
closes #3947
Is this a breaking change?
Yes.
TestSupport::cleanup_testwill be changed to takeTestArgsas an argument.