Feature gated mysql tests

This commit is contained in:
Billy Chan 2021-07-26 12:43:46 +08:00
parent b205fc48aa
commit 8013f92261
No known key found for this signature in database
GPG Key ID: A2D690CAC7DF3CC7
4 changed files with 15 additions and 0 deletions

View File

@ -7,6 +7,7 @@ mod crud;
// cargo test --test bakery_chain_tests -- --nocapture
#[async_std::test]
#[cfg(feature = "sqlx-mysql")]
async fn main() {
let base_url = "mysql://root:@localhost";
let db_name = "bakery_chain_schema_crud_tests";

View File

@ -6,6 +6,7 @@ pub mod common;
pub use common::{bakery_chain::*, setup::*, TestContext};
#[async_std::test]
#[cfg(feature = "sqlx-mysql")]
pub async fn find_one_with_no_result() {
let ctx = TestContext::new("mysql://root:@localhost", "find_one_with_no_result").await;
@ -16,6 +17,7 @@ pub async fn find_one_with_no_result() {
}
#[async_std::test]
#[cfg(feature = "sqlx-mysql")]
pub async fn find_one_with_result() {
let ctx = TestContext::new("mysql://root:@localhost", "find_one_with_result").await;
@ -36,6 +38,7 @@ pub async fn find_one_with_result() {
}
#[async_std::test]
#[cfg(feature = "sqlx-mysql")]
pub async fn find_by_id_with_no_result() {
let ctx = TestContext::new("mysql://root:@localhost", "find_by_id_with_no_result").await;
@ -46,6 +49,7 @@ pub async fn find_by_id_with_no_result() {
}
#[async_std::test]
#[cfg(feature = "sqlx-mysql")]
pub async fn find_by_id_with_result() {
let ctx = TestContext::new("mysql://root:@localhost", "find_by_id_with_result").await;
@ -70,6 +74,7 @@ pub async fn find_by_id_with_result() {
}
#[async_std::test]
#[cfg(feature = "sqlx-mysql")]
pub async fn find_all_with_no_result() {
let ctx = TestContext::new("mysql://root:@localhost", "find_all_with_no_result").await;
@ -80,6 +85,7 @@ pub async fn find_all_with_no_result() {
}
#[async_std::test]
#[cfg(feature = "sqlx-mysql")]
pub async fn find_all_with_result() {
let ctx = TestContext::new("mysql://root:@localhost", "find_all_with_result").await;
@ -109,6 +115,7 @@ pub async fn find_all_with_result() {
}
#[async_std::test]
#[cfg(feature = "sqlx-mysql")]
pub async fn find_all_filter_no_result() {
let ctx = TestContext::new("mysql://root:@localhost", "find_all_filter_no_result").await;
@ -142,6 +149,7 @@ pub async fn find_all_filter_no_result() {
}
#[async_std::test]
#[cfg(feature = "sqlx-mysql")]
pub async fn find_all_filter_with_results() {
let ctx = TestContext::new("mysql://root:@localhost", "find_all_filter_with_results").await;

View File

@ -9,6 +9,7 @@ pub mod common;
pub use common::{bakery_chain::*, setup::*, TestContext};
#[async_std::test]
#[cfg(feature = "sqlx-mysql")]
pub async fn left_join() {
let ctx = TestContext::new("mysql://root:@localhost", "test_left_join").await;
@ -85,6 +86,7 @@ pub async fn left_join() {
}
#[async_std::test]
#[cfg(feature = "sqlx-mysql")]
pub async fn right_join() {
let ctx = TestContext::new("mysql://root:@localhost", "test_right_join").await;
@ -165,6 +167,7 @@ pub async fn right_join() {
}
#[async_std::test]
#[cfg(feature = "sqlx-mysql")]
pub async fn inner_join() {
let ctx = TestContext::new("mysql://root:@localhost", "test_inner_join").await;
@ -249,6 +252,7 @@ pub async fn inner_join() {
}
#[async_std::test]
#[cfg(feature = "sqlx-mysql")]
pub async fn group_by() {
let ctx = TestContext::new("mysql://root:@localhost", "test_group_by").await;
@ -348,6 +352,7 @@ pub async fn group_by() {
}
#[async_std::test]
#[cfg(feature = "sqlx-mysql")]
pub async fn having() {
// customers with orders with total equal to $90
let ctx = TestContext::new("mysql://root:@localhost", "test_having").await;

View File

@ -8,6 +8,7 @@ pub mod common;
pub use common::{bakery_chain::*, setup::*, TestContext};
#[async_std::test]
#[cfg(feature = "sqlx-mysql")]
pub async fn test_multiple_operations() {
let ctx = TestContext::new("mysql://root:@localhost", "multiple_sequential_operations").await;