Skip to content

Commit

Permalink
fix(tests): fix tests rebasing
Browse files Browse the repository at this point in the history
  • Loading branch information
saiintbrisson committed Feb 3, 2023
1 parent b98e986 commit 3df5653
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 57 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
28 changes: 0 additions & 28 deletions tests/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions tests/sqlite/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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();

Expand All @@ -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();

Expand All @@ -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();

Expand Down
Binary file modified tests/sqlite/sqlite.db
Binary file not shown.
38 changes: 13 additions & 25 deletions tests/x.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
)
Expand All @@ -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}"
)
Expand All @@ -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}",
Expand All @@ -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}",
Expand All @@ -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}",
Expand All @@ -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}",
Expand All @@ -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

0 comments on commit 3df5653

Please sign in to comment.