diff --git a/Cargo.toml b/Cargo.toml index e92c64fc93..da437616d6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -223,6 +223,7 @@ name = "sqlite-derives" path = "tests/sqlite/derives.rs" required-features = ["sqlite", "macros"] +[[test]] name = "sqlite-error" path = "tests/sqlite/error.rs" required-features = ["sqlite"] diff --git a/tests/docker-compose.yml b/tests/docker-compose.yml index bd8ce46297..8651ff5a43 100644 --- a/tests/docker-compose.yml +++ b/tests/docker-compose.yml @@ -173,34 +173,6 @@ services: - "./postgres/setup.sql:/docker-entrypoint-initdb.d/setup.sql" command: > -c ssl=on -c ssl_cert_file=/var/lib/postgresql/server.crt -c ssl_key_file=/var/lib/postgresql/server.key - # - # Microsoft SQL Server (MSSQL) - # https://hub.docker.com/_/microsoft-mssql-server - # - - mssql_2019: - build: - context: . - dockerfile: mssql/Dockerfile - args: - VERSION: 2019-latest - ports: - - 1433 - environment: - ACCEPT_EULA: "Y" - SA_PASSWORD: Password123! - - mssql_2017: - build: - context: . - dockerfile: mssql/mssql-2017.dockerfile - args: - VERSION: 2017-latest - ports: - - 1433 - environment: - ACCEPT_EULA: "Y" - SA_PASSWORD: Password123! # # IBM Db2 diff --git a/tests/sqlite/error.rs b/tests/sqlite/error.rs index efbdcc6837..21a075c417 100644 --- a/tests/sqlite/error.rs +++ b/tests/sqlite/error.rs @@ -7,7 +7,7 @@ async fn it_fails_with_unique_violation() -> anyhow::Result<()> { let mut tx = conn.begin().await?; let res: Result<_, sqlx::Error> = sqlx::query("INSERT INTO tweet VALUES (1, 'Foo', true, 1);") - .execute(&mut tx) + .execute(&mut *tx) .await; let err = res.unwrap_err(); @@ -25,7 +25,7 @@ async fn it_fails_with_foreign_key_violation() -> anyhow::Result<()> { let res: Result<_, sqlx::Error> = sqlx::query("INSERT INTO tweet_reply (id, tweet_id, text) VALUES (2, 2, 'Reply!');") - .execute(&mut tx) + .execute(&mut *tx) .await; let err = res.unwrap_err(); @@ -42,7 +42,7 @@ async fn it_fails_with_not_null_violation() -> anyhow::Result<()> { let mut tx = conn.begin().await?; let res: Result<_, sqlx::Error> = sqlx::query("INSERT INTO tweet (text) VALUES (null);") - .execute(&mut tx) + .execute(&mut *tx) .await; let err = res.unwrap_err(); @@ -60,7 +60,7 @@ async fn it_fails_with_check_violation() -> anyhow::Result<()> { let res: Result<_, sqlx::Error> = sqlx::query("INSERT INTO products VALUES (1, 'Product 1', 0);") - .execute(&mut tx) + .execute(&mut *tx) .await; let err = res.unwrap_err(); diff --git a/tests/sqlite/sqlite.db b/tests/sqlite/sqlite.db index da8aac9fe3..905fbbe8ef 100644 Binary files a/tests/sqlite/sqlite.db and b/tests/sqlite/sqlite.db differ diff --git a/tests/x.py b/tests/x.py index 75791b5392..1d03ed7a99 100755 --- a/tests/x.py +++ b/tests/x.py @@ -127,10 +127,10 @@ def run(command, comment=None, env=None, service=None, tag=None, args=None, data # check # -for runtime in ["async-std", "tokio", "actix"]: - for tls in ["native-tls", "rustls"]: +for runtime in ["async-std", "tokio"]: + for tls in ["native-tls", "rustls", "none"]: run( - f"cargo c --no-default-features --features all-databases,all-types,offline,macros,runtime-{runtime}-{tls}", + f"cargo c --no-default-features --features all-databases,_unstable-all-types,macros,runtime-{runtime},tls-{tls}", comment="check with async-std", tag=f"check_{runtime}_{tls}" ) @@ -139,10 +139,10 @@ def run(command, comment=None, env=None, service=None, tag=None, args=None, data # unit test # -for runtime in ["async-std", "tokio", "actix"]: - for tls in ["native-tls", "rustls"]: +for runtime in ["async-std", "tokio"]: + for tls in ["native-tls", "rustls", "none"]: run( - f"cargo test --no-default-features --manifest-path sqlx-core/Cargo.toml --features all-databases,all-types,runtime-{runtime}-{tls}", + f"cargo test --no-default-features --manifest-path sqlx-core/Cargo.toml --features json,offline,migrate,_rt-{runtime},_tls-{tls}", comment="unit test core", tag=f"unit_{runtime}_{tls}" ) @@ -151,15 +151,15 @@ def run(command, comment=None, env=None, service=None, tag=None, args=None, data # integration tests # -for runtime in ["async-std", "tokio", "actix"]: - for tls in ["native-tls", "rustls"]: +for runtime in ["async-std", "tokio"]: + for tls in ["native-tls", "rustls", "none"]: # # sqlite # run( - f"cargo test --no-default-features --features macros,offline,any,all-types,sqlite,runtime-{runtime}-{tls}", + f"cargo test --no-default-features --features macros,any,_unstable-all-types,sqlite,runtime-{runtime},tls-{tls}", comment=f"test sqlite", service="sqlite", tag=f"sqlite" if runtime == "async-std" else f"sqlite_{runtime}", @@ -171,7 +171,7 @@ def run(command, comment=None, env=None, service=None, tag=None, args=None, data for version in ["14", "13", "12", "11", "10"]: run( - f"cargo test --no-default-features --features macros,offline,any,all-types,postgres,runtime-{runtime}-{tls}", + f"cargo test --no-default-features --features macros,any,unstable-all-types,postgres,runtime-{runtime},tls-{tls}", comment=f"test postgres {version}", service=f"postgres_{version}", tag=f"postgres_{version}" if runtime == "async-std" else f"postgres_{version}_{runtime}", @@ -180,7 +180,7 @@ def run(command, comment=None, env=None, service=None, tag=None, args=None, data ## +ssl for version in ["14", "13", "12", "11", "10"]: run( - f"cargo test --no-default-features --features macros,offline,any,all-types,postgres,runtime-{runtime}-{tls}", + f"cargo test --no-default-features --features macros,any,_unstable-all-types,postgres,runtime-{runtime},tls-{tls}", comment=f"test postgres {version} ssl", database_url_args="sslmode=verify-ca&sslrootcert=.%2Ftests%2Fcerts%2Fca.crt", service=f"postgres_{version}", @@ -193,7 +193,7 @@ def run(command, comment=None, env=None, service=None, tag=None, args=None, data for version in ["8", "5_7"]: run( - f"cargo test --no-default-features --features macros,offline,any,all-types,mysql,runtime-{runtime}-{tls}", + f"cargo test --no-default-features --features macros,any,_unstable-all-types,mysql,runtime-{runtime},tls-{tls}", comment=f"test mysql {version}", service=f"mysql_{version}", tag=f"mysql_{version}" if runtime == "async-std" else f"mysql_{version}_{runtime}", @@ -205,23 +205,11 @@ def run(command, comment=None, env=None, service=None, tag=None, args=None, data for version in ["10_6", "10_5", "10_4", "10_3", "10_2"]: run( - f"cargo test --no-default-features --features macros,offline,any,all-types,mysql,runtime-{runtime}-{tls}", + f"cargo test --no-default-features --features macros,any,_unstable-all-types,mysql,runtime-{runtime},tls-{tls}", comment=f"test mariadb {version}", service=f"mariadb_{version}", tag=f"mariadb_{version}" if runtime == "async-std" else f"mariadb_{version}_{runtime}", ) - # - # mssql - # - - for version in ["2019", "2017"]: - run( - f"cargo test --no-default-features --features macros,offline,any,all-types,mssql,runtime-{runtime}-{tls}", - comment=f"test mssql {version}", - service=f"mssql_{version}", - tag=f"mssql_{version}" if runtime == "async-std" else f"mssql_{version}_{runtime}", - ) - # TODO: Use [grcov] if available # ~/.cargo/bin/grcov tests/.cache/target/debug -s sqlx-core/ -t html --llvm --branch -o ./target/debug/coverage