fix: gate sqlcipher testing behind cfg to make development less annoying

This commit is contained in:
Austin Bonander 2024-03-05 18:04:45 -08:00
parent dfb60141bd
commit e5c18b354e
3 changed files with 8 additions and 1 deletions

View file

@ -167,6 +167,9 @@ jobs:
matrix:
runtime: [async-std, tokio]
needs: check
env:
# Enable tests with SQLCipher
RUSTFLAGS: --cfg sqlite_test_sqlcipher
steps:
- uses: actions/checkout@v2

View file

@ -177,7 +177,10 @@ hex = "0.4.3"
tempfile = "3.9.0"
criterion = { version = "0.5.1", features = ["async_tokio"] }
# Needed to test SQLCipher
# If this is an unconditional dev-dependency then Cargo will *always* try to build `libsqlite3-sys`,
# even when SQLite isn't the intended test target, and fail if the build environment is not set up for compiling C code.
[target.'cfg(sqlite_test_sqlcipher)'.dev-dependencies]
# Enable testing with SQLCipher if specifically requested.
libsqlite3-sys = { version = "0.27", features = ["bundled-sqlcipher"] }
#

View file

@ -125,6 +125,7 @@ async fn it_fails_if_password_is_incorrect() -> anyhow::Result<()> {
Ok(())
}
#[cfg(sqlite_test_sqlcipher)]
#[sqlx_macros::test]
async fn it_honors_order_of_encryption_pragmas() -> anyhow::Result<()> {
let (url, _dir) = new_db_url().await?;