Skip to content

feat!: honor database-url-var in #[sqlx::test] - #4437

Open
valkum wants to merge 5 commits into
transact-rs:mainfrom
valkum:feat/test-database-url-var
Open

valkum wants to merge 5 commits into
transact-rs:mainfrom
valkum:feat/test-database-url-var

Conversation

@valkum

@valkum valkum commented Oct 1, 2026

Copy link
Copy Markdown

Does your PR solve an issue?

It partially closes #3947. Instead of adding a new arg to the macro, with the recently added sqlx.toml support, we now use sqlx.toml and honor database-url-var in tests using #[sqlx::test].

TestArgs gains database_url_var injected by the macro.

This new functionality is covered by tests.

cleanup_test_dbs now also takes a database_url_var. It appears to be unused here but third party implementations might want to align this with the settings of the sqlx.toml.

Is this a breaking change?

Yes.

From a Rust API view, this is a breaking change because we changed the signature of cleanup_test_dbs.
But considering we now honor a new setting in a file in test macros, the other changes are also breaking changes.

So this probably needs to wait for 0.10.0.

I only found time now to update to sqlx 0.9 and wasn't able to test out any pre-release. I think it would be good to release 0.10 with this change soonish, because I think it was an oversight landing sqlx.toml without support for it in #[sqlx::test].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for specifying database URLs per test via an environment variable option in sqlx::test macro

2 participants