Skip to content

Commit

Permalink
fix: gate sqlcipher testing behind cfg to make development less a…
Browse files Browse the repository at this point in the history
…nnoying
  • Loading branch information
abonander committed Mar 6, 2024
1 parent dfb6014 commit e5c18b3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .github/workflows/sqlx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }

#
Expand Down
1 change: 1 addition & 0 deletions tests/sqlite/sqlcipher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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?;
Expand Down

0 comments on commit e5c18b3

Please sign in to comment.