Skip to content

Commit

Permalink
Tag specific versions of driver adapters in excluded tests
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelff committed Nov 22, 2023
1 parent e215092 commit 1626ab6
Show file tree
Hide file tree
Showing 38 changed files with 134 additions and 97 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use query_engine_tests::*;

#[test_suite(schema(generic))]
mod raw_params {
#[connector_test(only(Postgres), exclude(JS))]
#[connector_test(only(Postgres), exclude(Postgres("neon.js"), Postgres("pg.js")))]
async fn value_too_many_bind_variables(runner: Runner) -> TestResult<()> {
let n = 32768;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use query_engine_tests::test_suite;
use std::borrow::Cow;

#[test_suite(schema(generic))]
#[test_suite(schema(generic), exclude(Vitess("planetscale.js")))]
mod interactive_tx {
use query_engine_tests::*;
use tokio::time;
Expand Down Expand Up @@ -573,7 +573,7 @@ mod itx_isolation {
use query_engine_tests::*;

// All (SQL) connectors support serializable.
#[connector_test(exclude(MongoDb))]
#[connector_test(exclude(MongoDb, Vitess("planetscale.js")))]
async fn basic_serializable(mut runner: Runner) -> TestResult<()> {
let tx_id = runner.start_tx(5000, 5000, Some("Serializable".to_owned())).await?;
runner.set_active_tx(tx_id.clone());
Expand All @@ -595,7 +595,7 @@ mod itx_isolation {
Ok(())
}

#[connector_test(exclude(MongoDb))]
#[connector_test(exclude(MongoDb, Vitess("planetscale.js")))]
async fn casing_doesnt_matter(mut runner: Runner) -> TestResult<()> {
let tx_id = runner.start_tx(5000, 5000, Some("sErIaLiZaBlE".to_owned())).await?;
runner.set_active_tx(tx_id.clone());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
use query_engine_tests::test_suite;

#[test_suite(schema(generic))]
#[test_suite(
schema(generic),
exclude(
Vitess("planetscale.js"),
Postgres("neon.js"),
Postgres("pg.js"),
Sqlite("libsql.js")
)
)]
mod metrics {
use query_engine_metrics::{
PRISMA_CLIENT_QUERIES_ACTIVE, PRISMA_CLIENT_QUERIES_TOTAL, PRISMA_DATASOURCE_QUERIES_TOTAL,
Expand All @@ -9,7 +17,7 @@ mod metrics {
use query_engine_tests::*;
use serde_json::Value;

#[connector_test(exclude(Js))]
#[connector_test]
async fn metrics_are_recorded(runner: Runner) -> TestResult<()> {
insta::assert_snapshot!(
run_query!(&runner, r#"mutation { createOneTestModel(data: { id: 1 }) { id }}"#),
Expand All @@ -27,7 +35,7 @@ mod metrics {
let total_operations = get_counter(&json, PRISMA_CLIENT_QUERIES_TOTAL);

match runner.connector_version() {
Sqlite => assert_eq!(total_queries, 9),
Sqlite(_) => assert_eq!(total_queries, 9),
SqlServer(_) => assert_eq!(total_queries, 17),
MongoDb(_) => assert_eq!(total_queries, 5),
CockroachDb(_) => (), // not deterministic
Expand All @@ -40,7 +48,7 @@ mod metrics {
Ok(())
}

#[connector_test(exclude(Js))]
#[connector_test]
async fn metrics_tx_do_not_go_negative(mut runner: Runner) -> TestResult<()> {
let tx_id = runner.start_tx(5000, 5000, None).await?;
runner.set_active_tx(tx_id.clone());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use query_engine_tests::test_suite;

#[test_suite(capabilities(MultiSchema), exclude(Mysql))]
#[test_suite(capabilities(MultiSchema), exclude(Mysql, Vitess("planetscale.js")))]
mod multi_schema {
use query_engine_tests::*;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ mod occ {
assert_eq!(booked_user_id, found_booked_user_id);
}

#[connector_test(schema(occ_simple), exclude(MongoDB, CockroachDb))]
#[connector_test(schema(occ_simple), exclude(MongoDB, CockroachDb, Vitess("planetscale.js")))]
async fn occ_update_many_test(runner: Runner) -> TestResult<()> {
let runner = Arc::new(runner);

Expand All @@ -127,7 +127,7 @@ mod occ {
Ok(())
}

#[connector_test(schema(occ_simple), exclude(CockroachDb))]
#[connector_test(schema(occ_simple), exclude(CockroachDb, Vitess("planetscale.js")))]
async fn occ_update_test(runner: Runner) -> TestResult<()> {
let runner = Arc::new(runner);

Expand Down Expand Up @@ -158,7 +158,7 @@ mod occ {
Ok(())
}

#[connector_test(schema(occ_simple))]
#[connector_test(schema(occ_simple), exclude(Vitess("planetscale.js")))]
async fn occ_delete_test(runner: Runner) -> TestResult<()> {
let runner = Arc::new(runner);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
use indoc::indoc;
use query_engine_tests::*;

#[test_suite(suite = "setdefault_onD_1to1_req", exclude(MongoDb, MySQL))]
#[test_suite(suite = "setdefault_onD_1to1_req", exclude(MongoDb, MySQL, Vitess("planetscale.js")))]
mod one2one_req {
fn required_with_default() -> String {
let schema = indoc! {
Expand Down Expand Up @@ -66,7 +66,7 @@ mod one2one_req {
}

/// Deleting the parent reconnects the child to the default and fails (the default doesn't exist).
#[connector_test(schema(required_with_default), exclude(MongoDb, MySQL))]
#[connector_test(schema(required_with_default), exclude(MongoDb, MySQL, Vitess("planetscale.js")))]
async fn delete_parent_no_exist_fail(runner: Runner) -> TestResult<()> {
insta::assert_snapshot!(
run_query!(&runner, r#"mutation { createOneParent(data: { id: 1, child: { create: { id: 1 }}}) { id }}"#),
Expand Down Expand Up @@ -103,7 +103,7 @@ mod one2one_req {
}
}

#[test_suite(suite = "setdefault_onD_1to1_opt", exclude(MongoDb, MySQL))]
#[test_suite(suite = "setdefault_onD_1to1_opt", exclude(MongoDb, MySQL, Vitess("planetscale.js")))]
mod one2one_opt {
fn optional_with_default() -> String {
let schema = indoc! {
Expand Down Expand Up @@ -167,7 +167,7 @@ mod one2one_opt {
}

/// Deleting the parent reconnects the child to the default and fails (the default doesn't exist).
#[connector_test(schema(optional_with_default), exclude(MongoDb, MySQL))]
#[connector_test(schema(optional_with_default), exclude(MongoDb, MySQL, Vitess("planetscale.js")))]
async fn delete_parent_no_exist_fail(runner: Runner) -> TestResult<()> {
insta::assert_snapshot!(
run_query!(&runner, r#"mutation { createOneParent(data: { id: 1, child: { create: { id: 1 }}}) { id }}"#),
Expand Down Expand Up @@ -206,7 +206,7 @@ mod one2one_opt {
}
}

#[test_suite(suite = "setdefault_onD_1toM_req", exclude(MongoDb, MySQL))]
#[test_suite(suite = "setdefault_onD_1toM_req", exclude(MongoDb, MySQL, Vitess("planetscale.js")))]
mod one2many_req {
fn required_with_default() -> String {
let schema = indoc! {
Expand Down Expand Up @@ -270,7 +270,7 @@ mod one2many_req {
}

/// Deleting the parent reconnects the child to the default and fails (the default doesn't exist).
#[connector_test(schema(required_with_default), exclude(MongoDb, MySQL))]
#[connector_test(schema(required_with_default), exclude(MongoDb, MySQL, Vitess("planetscale.js")))]
async fn delete_parent_no_exist_fail(runner: Runner) -> TestResult<()> {
insta::assert_snapshot!(
run_query!(&runner, r#"mutation { createOneParent(data: { id: 1, children: { create: { id: 1 }}}) { id }}"#),
Expand Down Expand Up @@ -307,7 +307,7 @@ mod one2many_req {
}
}

#[test_suite(suite = "setdefault_onD_1toM_opt", exclude(MongoDb, MySQL))]
#[test_suite(suite = "setdefault_onD_1toM_opt", exclude(MongoDb, MySQL, Vitess("planetscale.js")))]
mod one2many_opt {
fn optional_with_default() -> String {
let schema = indoc! {
Expand Down Expand Up @@ -344,7 +344,7 @@ mod one2many_opt {
}

/// Deleting the parent reconnects the child to the default.
#[connector_test(schema(optional_with_default))]
#[connector_test(schema(optional_with_default), exclude(Vitess("planetscale.js")))]
async fn delete_parent(runner: Runner) -> TestResult<()> {
insta::assert_snapshot!(
run_query!(&runner, r#"mutation { createOneParent(data: { id: 1, children: { create: { id: 1 }}}) { id }}"#),
Expand All @@ -371,7 +371,7 @@ mod one2many_opt {
}

/// Deleting the parent reconnects the child to the default and fails (the default doesn't exist).
#[connector_test(schema(optional_with_default), exclude(MongoDb, MySQL))]
#[connector_test(schema(optional_with_default), exclude(MongoDb, MySQL, Vitess("planetscale.js")))]
async fn delete_parent_no_exist_fail(runner: Runner) -> TestResult<()> {
insta::assert_snapshot!(
run_query!(&runner, r#"mutation { createOneParent(data: { id: 1, children: { create: { id: 1 }}}) { id }}"#),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
use indoc::indoc;
use query_engine_tests::*;

#[test_suite(suite = "setdefault_onU_1to1_req", exclude(MongoDb, MySQL))]
#[test_suite(suite = "setdefault_onU_1to1_req", exclude(MongoDb, MySQL, Vitess))]
mod one2one_req {
fn required_with_default() -> String {
let schema = indoc! {
Expand Down Expand Up @@ -68,7 +68,7 @@ mod one2one_req {
}

/// Updating the parent reconnects the child to the default and fails (the default doesn't exist).
#[connector_test(schema(required_with_default), exclude(MongoDb, MySQL))]
#[connector_test(schema(required_with_default), exclude(MongoDb, MySQL, Vitess))]
async fn update_parent_no_exist_fail(runner: Runner) -> TestResult<()> {
insta::assert_snapshot!(
run_query!(&runner, r#"mutation { createOneParent(data: { id: 1, uniq: "1", child: { create: { id: 1 }}}) { id }}"#),
Expand Down Expand Up @@ -105,7 +105,7 @@ mod one2one_req {
}
}

#[test_suite(suite = "setdefault_onU_1to1_opt", exclude(MongoDb, MySQL))]
#[test_suite(suite = "setdefault_onU_1to1_opt", exclude(MongoDb, MySQL, Vitess))]
mod one2one_opt {
fn optional_with_default() -> String {
let schema = indoc! {
Expand Down Expand Up @@ -171,7 +171,7 @@ mod one2one_opt {
}

/// Updating the parent reconnects the child to the default and fails (the default doesn't exist).
#[connector_test(schema(optional_with_default), exclude(MongoDb, MySQL))]
#[connector_test(schema(optional_with_default), exclude(MongoDb, MySQL, Vitess))]
async fn update_parent_no_exist_fail(runner: Runner) -> TestResult<()> {
insta::assert_snapshot!(
run_query!(&runner, r#"mutation { createOneParent(data: { id: 1, uniq: "1", child: { create: { id: 1 }}}) { id }}"#),
Expand Down Expand Up @@ -210,7 +210,7 @@ mod one2one_opt {
}
}

#[test_suite(suite = "setdefault_onU_1toM_req", exclude(MongoDb, MySQL))]
#[test_suite(suite = "setdefault_onU_1toM_req", exclude(MongoDb, MySQL, Vitess))]
mod one2many_req {
fn required_with_default() -> String {
let schema = indoc! {
Expand Down Expand Up @@ -276,7 +276,7 @@ mod one2many_req {
}

/// Updating the parent reconnects the child to the default and fails (the default doesn't exist).
#[connector_test(schema(required_with_default), exclude(MongoDb, MySQL))]
#[connector_test(schema(required_with_default), exclude(MongoDb, MySQL, Vitess))]
async fn update_parent_no_exist_fail(runner: Runner) -> TestResult<()> {
insta::assert_snapshot!(
run_query!(&runner, r#"mutation { createOneParent(data: { id: 1, uniq: "1", children: { create: { id: 1 }}}) { id }}"#),
Expand Down Expand Up @@ -313,7 +313,7 @@ mod one2many_req {
}
}

#[test_suite(suite = "setdefault_onU_1toM_opt", exclude(MongoDb, MySQL))]
#[test_suite(suite = "setdefault_onU_1toM_opt", exclude(MongoDb, MySQL, Vitess))]
mod one2many_opt {
fn optional_with_default() -> String {
let schema = indoc! {
Expand Down Expand Up @@ -379,7 +379,7 @@ mod one2many_opt {
}

/// Updating the parent reconnects the child to the default and fails (the default doesn't exist).
#[connector_test(schema(optional_with_default), exclude(MongoDb, MySQL))]
#[connector_test(schema(optional_with_default), exclude(MongoDb, MySQL, Vitess))]
async fn update_parent_no_exist_fail(runner: Runner) -> TestResult<()> {
insta::assert_snapshot!(
run_query!(&runner, r#"mutation { createOneParent(data: { id: 1, uniq: "1", children: { create: { id: 1 }}}) { id }}"#),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ mod max_integer {
schema.to_owned()
}

#[connector_test(schema(overflow_pg), only(Postgres), exclude(JS))]
#[connector_test(schema(overflow_pg), only(Postgres), exclude(Postgres("neon.js"), Postgres("pg.js")))]
async fn unfitted_int_should_fail_pg_quaint(runner: Runner) -> TestResult<()> {
// int
assert_error!(
Expand Down Expand Up @@ -235,7 +235,7 @@ mod max_integer {
}

// The driver adapter for neon provides different error messages on overflow
#[connector_test(schema(overflow_pg), only(JS, Postgres))]
#[connector_test(schema(overflow_pg), only(Postgres("neon.js"), Postgres("pg.js")))]
async fn unfitted_int_should_fail_pg_js(runner: Runner) -> TestResult<()> {
// int
assert_error!(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ mod conversion_error {
schema.to_owned()
}

#[connector_test(schema(schema_int), only(Sqlite), exclude(JS))]
#[connector_test(schema(schema_int), only(Sqlite), exclude(Sqlite("libsql.js")))]
async fn convert_to_int_sqlite_quaint(runner: Runner) -> TestResult<()> {
create_test_data(&runner).await?;

Expand All @@ -38,7 +38,7 @@ mod conversion_error {
Ok(())
}

#[connector_test(schema(schema_int), only(Sqlite, JS))]
#[connector_test(schema(schema_int), only(Sqlite("libsql.js")))]
async fn convert_to_int_sqlite_js(runner: Runner) -> TestResult<()> {
create_test_data(&runner).await?;

Expand All @@ -52,7 +52,7 @@ mod conversion_error {
Ok(())
}

#[connector_test(schema(schema_bigint), only(Sqlite), exclude(JS))]
#[connector_test(schema(schema_bigint), only(Sqlite), exclude(Sqlite("libsql.js")))]
async fn convert_to_bigint_sqlite_quaint(runner: Runner) -> TestResult<()> {
create_test_data(&runner).await?;

Expand All @@ -66,7 +66,7 @@ mod conversion_error {
Ok(())
}

#[connector_test(schema(schema_bigint), only(Sqlite, JS))]
#[connector_test(schema(schema_bigint), only(Sqlite("libsql.js")))]
async fn convert_to_bigint_sqlite_js(runner: Runner) -> TestResult<()> {
create_test_data(&runner).await?;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ mod prisma_17103 {
schema.to_owned()
}

#[connector_test]
#[connector_test(exclude(Vitess("planetscale.js")))]
async fn regression(runner: Runner) -> TestResult<()> {
run_query!(
&runner,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ mod aggregation_avg {
Ok(())
}

#[connector_test(exclude(MongoDb))]
#[connector_test(exclude(MongoDb, Vitess("planetscale.js")))]
async fn avg_with_all_sorts_of_query_args(runner: Runner) -> TestResult<()> {
create_row(&runner, r#"{ id: 1, float: 5.5, int: 5, bInt: "5" }"#).await?;
create_row(&runner, r#"{ id: 2, float: 4.5, int: 10, bInt: "10" }"#).await?;
Expand Down Expand Up @@ -126,7 +126,7 @@ mod decimal_aggregation_avg {
Ok(())
}

#[connector_test(exclude(MongoDb))]
#[connector_test(exclude(MongoDb, Vitess("planetscale.js")))]
async fn avg_with_all_sorts_of_query_args(runner: Runner) -> TestResult<()> {
create_row(&runner, r#"{ id: 1, decimal: "5.5" }"#).await?;
create_row(&runner, r#"{ id: 2, decimal: "4.5" }"#).await?;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ mod combinations {
}

// Mongo precision issue.
#[connector_test(exclude(MongoDB))]
#[connector_test(exclude(MongoDB, Vitess("planetscale.js")))]
async fn with_query_args(runner: Runner) -> TestResult<()> {
create_row(&runner, r#"{ id: "1", float: 5.5, int: 5 }"#).await?;
create_row(&runner, r#"{ id: "2", float: 4.5, int: 10 }"#).await?;
Expand Down Expand Up @@ -369,7 +369,7 @@ mod decimal_combinations {
}

// Mongo precision issue.
#[connector_test(exclude(MongoDB))]
#[connector_test(exclude(MongoDB, Vitess("planetscale.js")))]
async fn with_query_args(runner: Runner) -> TestResult<()> {
create_row(&runner, r#"{ id: "1", dec: "5.5" }"#).await?;
create_row(&runner, r#"{ id: "2", dec: "4.5" }"#).await?;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ mod aggregation_count {
Ok(())
}

#[connector_test]
#[connector_test(exclude(Vitess("planetscale.js")))]
async fn count_with_all_sorts_of_query_args(runner: Runner) -> TestResult<()> {
create_row(&runner, r#"{ id: 1, string: "1" }"#).await?;
create_row(&runner, r#"{ id: 2, string: "2" }"#).await?;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ mod aggregation_max {
Ok(())
}

#[connector_test]
#[connector_test(exclude(Vitess("planetscale.js")))]
async fn max_with_all_sorts_of_query_args(runner: Runner) -> TestResult<()> {
create_row(&runner, r#"{ id: 1, float: 5.5, int: 5, bInt: "5", string: "2" }"#).await?;
create_row(&runner, r#"{ id: 2, float: 4.5, int: 10, bInt: "10", string: "f" }"#).await?;
Expand Down Expand Up @@ -120,7 +120,7 @@ mod decimal_aggregation_max {
Ok(())
}

#[connector_test]
#[connector_test(exclude(Vitess("planetscale.js")))]
async fn max_with_all_sorts_of_query_args(runner: Runner) -> TestResult<()> {
create_row(&runner, r#"{ id: 1, decimal: "5.5" }"#).await?;
create_row(&runner, r#"{ id: 2, decimal: "4.5" }"#).await?;
Expand Down
Loading

0 comments on commit 1626ab6

Please sign in to comment.