Use DATABASE_URL env variable for relational_tests
This commit is contained in:
parent
b2ed13868e
commit
c240ebba77
263
.github/workflows/rust.yml
vendored
263
.github/workflows/rust.yml
vendored
@ -4,6 +4,7 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
|
- origin/ss/test_suite_refactor
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
@ -50,95 +51,95 @@ jobs:
|
|||||||
--all
|
--all
|
||||||
--features default,runtime-${{ matrix.runtime }}
|
--features default,runtime-${{ matrix.runtime }}
|
||||||
|
|
||||||
sqlite:
|
# sqlite:
|
||||||
name: SQLite
|
# name: SQLite
|
||||||
runs-on: ubuntu-20.04
|
# runs-on: ubuntu-20.04
|
||||||
strategy:
|
# strategy:
|
||||||
matrix:
|
# matrix:
|
||||||
# runtime: [async-std-native-tls, async-std-rustls, actix-native-tls, actix-rustls, tokio-native-tls, tokio-rustls]
|
# # runtime: [async-std-native-tls, async-std-rustls, actix-native-tls, actix-rustls, tokio-native-tls, tokio-rustls]
|
||||||
runtime: [async-std-native-tls]
|
# runtime: [async-std-native-tls]
|
||||||
steps:
|
# steps:
|
||||||
- uses: actions/checkout@v2
|
# - uses: actions/checkout@v2
|
||||||
|
|
||||||
- uses: actions-rs/toolchain@v1
|
# - uses: actions-rs/toolchain@v1
|
||||||
with:
|
# with:
|
||||||
profile: minimal
|
# profile: minimal
|
||||||
toolchain: stable
|
# toolchain: stable
|
||||||
override: true
|
# override: true
|
||||||
|
|
||||||
- uses: actions/cache@v2
|
# - uses: actions/cache@v2
|
||||||
with:
|
# with:
|
||||||
path: |
|
# path: |
|
||||||
~/.cargo/registry
|
# ~/.cargo/registry
|
||||||
~/.cargo/git
|
# ~/.cargo/git
|
||||||
target
|
# target
|
||||||
key: ${{ runner.os }}-sqlite-${{ matrix.runtime }}-${{ hashFiles('**/Cargo.lock') }}
|
# key: ${{ runner.os }}-sqlite-${{ matrix.runtime }}-${{ hashFiles('**/Cargo.lock') }}
|
||||||
|
|
||||||
- uses: actions-rs/cargo@v1
|
# - uses: actions-rs/cargo@v1
|
||||||
with:
|
# with:
|
||||||
command: build
|
# command: build
|
||||||
args: >
|
# args: >
|
||||||
--all
|
# --all
|
||||||
--features default,runtime-${{ matrix.runtime }}
|
# --features default,runtime-${{ matrix.runtime }}
|
||||||
|
|
||||||
- uses: actions-rs/cargo@v1
|
# - uses: actions-rs/cargo@v1
|
||||||
with:
|
# with:
|
||||||
command: test
|
# command: test
|
||||||
args: >
|
# args: >
|
||||||
--all
|
# --all
|
||||||
--features default,sqlx-sqlite,runtime-${{ matrix.runtime }}
|
# --features default,sqlx-sqlite,runtime-${{ matrix.runtime }}
|
||||||
|
|
||||||
postgres:
|
# postgres:
|
||||||
name: Postgres
|
# name: Postgres
|
||||||
runs-on: ubuntu-20.04
|
# runs-on: ubuntu-20.04
|
||||||
strategy:
|
# strategy:
|
||||||
matrix:
|
# matrix:
|
||||||
# runtime: [async-std-native-tls, async-std-rustls, actix-native-tls, actix-rustls, tokio-native-tls, tokio-rustls]
|
# # runtime: [async-std-native-tls, async-std-rustls, actix-native-tls, actix-rustls, tokio-native-tls, tokio-rustls]
|
||||||
runtime: [async-std-native-tls]
|
# runtime: [async-std-native-tls]
|
||||||
services:
|
# services:
|
||||||
postgres:
|
# postgres:
|
||||||
image: postgres:11
|
# image: postgres:11
|
||||||
env:
|
# env:
|
||||||
POSTGRES_HOST: 127.0.0.1
|
# POSTGRES_HOST: 127.0.0.1
|
||||||
POSTGRES_USER: root
|
# POSTGRES_USER: root
|
||||||
POSTGRES_PASSWORD: root
|
# POSTGRES_PASSWORD: root
|
||||||
ports:
|
# ports:
|
||||||
- "5432:5432"
|
# - "5432:5432"
|
||||||
options: >-
|
# options: >-
|
||||||
--health-cmd pg_isready
|
# --health-cmd pg_isready
|
||||||
--health-interval 10s
|
# --health-interval 10s
|
||||||
--health-timeout 5s
|
# --health-timeout 5s
|
||||||
--health-retries 5
|
# --health-retries 5
|
||||||
steps:
|
# steps:
|
||||||
- uses: actions/checkout@v2
|
# - uses: actions/checkout@v2
|
||||||
|
|
||||||
- uses: actions-rs/toolchain@v1
|
# - uses: actions-rs/toolchain@v1
|
||||||
with:
|
# with:
|
||||||
profile: minimal
|
# profile: minimal
|
||||||
toolchain: stable
|
# toolchain: stable
|
||||||
override: true
|
# override: true
|
||||||
|
|
||||||
- uses: actions/cache@v2
|
# - uses: actions/cache@v2
|
||||||
with:
|
# with:
|
||||||
path: |
|
# path: |
|
||||||
~/.cargo/registry
|
# ~/.cargo/registry
|
||||||
~/.cargo/git
|
# ~/.cargo/git
|
||||||
target
|
# target
|
||||||
key: ${{ runner.os }}-postgres-${{ matrix.runtime }}-${{ hashFiles('**/Cargo.lock') }}
|
# key: ${{ runner.os }}-postgres-${{ matrix.runtime }}-${{ hashFiles('**/Cargo.lock') }}
|
||||||
|
|
||||||
- uses: actions-rs/cargo@v1
|
# - uses: actions-rs/cargo@v1
|
||||||
with:
|
# with:
|
||||||
command: build
|
# command: build
|
||||||
args: >
|
# args: >
|
||||||
--all
|
# --all
|
||||||
--features default,runtime-${{ matrix.runtime }}
|
# --features default,runtime-${{ matrix.runtime }}
|
||||||
|
|
||||||
- uses: actions-rs/cargo@v1
|
# - uses: actions-rs/cargo@v1
|
||||||
with:
|
# with:
|
||||||
command: test
|
# command: test
|
||||||
args: >
|
# args: >
|
||||||
--all
|
# --all
|
||||||
--features default,sqlx-postgres,runtime-${{ matrix.runtime }}
|
# --features default,sqlx-postgres,runtime-${{ matrix.runtime }}
|
||||||
|
|
||||||
mysql:
|
mysql:
|
||||||
name: MySQL
|
name: MySQL
|
||||||
@ -147,6 +148,8 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
# runtime: [async-std-native-tls, async-std-rustls, actix-native-tls, actix-rustls, tokio-native-tls, tokio-rustls]
|
# runtime: [async-std-native-tls, async-std-rustls, actix-native-tls, actix-rustls, tokio-native-tls, tokio-rustls]
|
||||||
runtime: [async-std-native-tls]
|
runtime: [async-std-native-tls]
|
||||||
|
env:
|
||||||
|
DATABASE_URL: mysql://root:@localhost
|
||||||
services:
|
services:
|
||||||
mysql:
|
mysql:
|
||||||
image: mysql:8.0
|
image: mysql:8.0
|
||||||
@ -195,57 +198,57 @@ jobs:
|
|||||||
--all
|
--all
|
||||||
--features default,sqlx-mysql,runtime-${{ matrix.runtime }}
|
--features default,sqlx-mysql,runtime-${{ matrix.runtime }}
|
||||||
|
|
||||||
mariadb:
|
# mariadb:
|
||||||
name: MariaDB
|
# name: MariaDB
|
||||||
runs-on: ubuntu-20.04
|
# runs-on: ubuntu-20.04
|
||||||
strategy:
|
# strategy:
|
||||||
matrix:
|
# matrix:
|
||||||
# runtime: [async-std-native-tls, async-std-rustls, actix-native-tls, actix-rustls, tokio-native-tls, tokio-rustls]
|
# # runtime: [async-std-native-tls, async-std-rustls, actix-native-tls, actix-rustls, tokio-native-tls, tokio-rustls]
|
||||||
runtime: [async-std-native-tls]
|
# runtime: [async-std-native-tls]
|
||||||
services:
|
# services:
|
||||||
mysql:
|
# mysql:
|
||||||
image: mariadb:10.5
|
# image: mariadb:10.5
|
||||||
env:
|
# env:
|
||||||
MYSQL_HOST: 127.0.0.1
|
# MYSQL_HOST: 127.0.0.1
|
||||||
MYSQL_DB: mysql
|
# MYSQL_DB: mysql
|
||||||
MYSQL_USER: sea
|
# MYSQL_USER: sea
|
||||||
MYSQL_PASSWORD: sea
|
# MYSQL_PASSWORD: sea
|
||||||
MYSQL_ALLOW_EMPTY_PASSWORD: yes
|
# MYSQL_ALLOW_EMPTY_PASSWORD: yes
|
||||||
MYSQL_ROOT_PASSWORD:
|
# MYSQL_ROOT_PASSWORD:
|
||||||
ports:
|
# ports:
|
||||||
- "3306:3306"
|
# - "3306:3306"
|
||||||
options: >-
|
# options: >-
|
||||||
--health-cmd="mysqladmin ping"
|
# --health-cmd="mysqladmin ping"
|
||||||
--health-interval=10s
|
# --health-interval=10s
|
||||||
--health-timeout=5s
|
# --health-timeout=5s
|
||||||
--health-retries=3
|
# --health-retries=3
|
||||||
steps:
|
# steps:
|
||||||
- uses: actions/checkout@v2
|
# - uses: actions/checkout@v2
|
||||||
|
|
||||||
- uses: actions-rs/toolchain@v1
|
# - uses: actions-rs/toolchain@v1
|
||||||
with:
|
# with:
|
||||||
profile: minimal
|
# profile: minimal
|
||||||
toolchain: stable
|
# toolchain: stable
|
||||||
override: true
|
# override: true
|
||||||
|
|
||||||
- uses: actions/cache@v2
|
# - uses: actions/cache@v2
|
||||||
with:
|
# with:
|
||||||
path: |
|
# path: |
|
||||||
~/.cargo/registry
|
# ~/.cargo/registry
|
||||||
~/.cargo/git
|
# ~/.cargo/git
|
||||||
target
|
# target
|
||||||
key: ${{ runner.os }}-mariadb-${{ matrix.runtime }}-${{ hashFiles('**/Cargo.lock') }}
|
# key: ${{ runner.os }}-mariadb-${{ matrix.runtime }}-${{ hashFiles('**/Cargo.lock') }}
|
||||||
|
|
||||||
- uses: actions-rs/cargo@v1
|
# - uses: actions-rs/cargo@v1
|
||||||
with:
|
# with:
|
||||||
command: build
|
# command: build
|
||||||
args: >
|
# args: >
|
||||||
--all
|
# --all
|
||||||
--features default,runtime-${{ matrix.runtime }}
|
# --features default,runtime-${{ matrix.runtime }}
|
||||||
|
|
||||||
- uses: actions-rs/cargo@v1
|
# - uses: actions-rs/cargo@v1
|
||||||
with:
|
# with:
|
||||||
command: test
|
# command: test
|
||||||
args: >
|
# args: >
|
||||||
--all
|
# --all
|
||||||
--features default,sqlx-mysql,runtime-${{ matrix.runtime }}
|
# --features default,sqlx-mysql,runtime-${{ matrix.runtime }}
|
||||||
|
@ -9,9 +9,13 @@ pub mod common;
|
|||||||
pub use common::{bakery_chain::*, setup::*, TestContext};
|
pub use common::{bakery_chain::*, setup::*, TestContext};
|
||||||
|
|
||||||
#[async_std::test]
|
#[async_std::test]
|
||||||
#[cfg(feature = "sqlx-mysql")]
|
#[cfg(any(
|
||||||
|
feature = "sqlx-mysql",
|
||||||
|
feature = "sqlx-sqlite",
|
||||||
|
feature = "sqlx-postgres"
|
||||||
|
))]
|
||||||
pub async fn left_join() {
|
pub async fn left_join() {
|
||||||
let ctx = TestContext::new("mysql://root:@localhost", "test_left_join").await;
|
let ctx = TestContext::new("test_left_join").await;
|
||||||
|
|
||||||
let bakery = bakery::ActiveModel {
|
let bakery = bakery::ActiveModel {
|
||||||
name: Set("SeaSide Bakery".to_owned()),
|
name: Set("SeaSide Bakery".to_owned()),
|
||||||
@ -86,9 +90,13 @@ pub async fn left_join() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[async_std::test]
|
#[async_std::test]
|
||||||
#[cfg(feature = "sqlx-mysql")]
|
#[cfg(any(
|
||||||
|
feature = "sqlx-mysql",
|
||||||
|
feature = "sqlx-sqlite",
|
||||||
|
feature = "sqlx-postgres"
|
||||||
|
))]
|
||||||
pub async fn right_join() {
|
pub async fn right_join() {
|
||||||
let ctx = TestContext::new("mysql://root:@localhost", "test_right_join").await;
|
let ctx = TestContext::new("test_right_join").await;
|
||||||
|
|
||||||
let bakery = bakery::ActiveModel {
|
let bakery = bakery::ActiveModel {
|
||||||
name: Set("SeaSide Bakery".to_owned()),
|
name: Set("SeaSide Bakery".to_owned()),
|
||||||
@ -167,9 +175,13 @@ pub async fn right_join() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[async_std::test]
|
#[async_std::test]
|
||||||
#[cfg(feature = "sqlx-mysql")]
|
#[cfg(any(
|
||||||
|
feature = "sqlx-mysql",
|
||||||
|
feature = "sqlx-sqlite",
|
||||||
|
feature = "sqlx-postgres"
|
||||||
|
))]
|
||||||
pub async fn inner_join() {
|
pub async fn inner_join() {
|
||||||
let ctx = TestContext::new("mysql://root:@localhost", "test_inner_join").await;
|
let ctx = TestContext::new("test_inner_join").await;
|
||||||
|
|
||||||
let bakery = bakery::ActiveModel {
|
let bakery = bakery::ActiveModel {
|
||||||
name: Set("SeaSide Bakery".to_owned()),
|
name: Set("SeaSide Bakery".to_owned()),
|
||||||
@ -252,9 +264,13 @@ pub async fn inner_join() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[async_std::test]
|
#[async_std::test]
|
||||||
#[cfg(feature = "sqlx-mysql")]
|
#[cfg(any(
|
||||||
|
feature = "sqlx-mysql",
|
||||||
|
feature = "sqlx-sqlite",
|
||||||
|
feature = "sqlx-postgres"
|
||||||
|
))]
|
||||||
pub async fn group_by() {
|
pub async fn group_by() {
|
||||||
let ctx = TestContext::new("mysql://root:@localhost", "test_group_by").await;
|
let ctx = TestContext::new("test_group_by").await;
|
||||||
|
|
||||||
let bakery = bakery::ActiveModel {
|
let bakery = bakery::ActiveModel {
|
||||||
name: Set("SeaSide Bakery".to_owned()),
|
name: Set("SeaSide Bakery".to_owned()),
|
||||||
@ -352,10 +368,14 @@ pub async fn group_by() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[async_std::test]
|
#[async_std::test]
|
||||||
#[cfg(feature = "sqlx-mysql")]
|
#[cfg(any(
|
||||||
|
feature = "sqlx-mysql",
|
||||||
|
feature = "sqlx-sqlite",
|
||||||
|
feature = "sqlx-postgres"
|
||||||
|
))]
|
||||||
pub async fn having() {
|
pub async fn having() {
|
||||||
// customers with orders with total equal to $90
|
// customers with orders with total equal to $90
|
||||||
let ctx = TestContext::new("mysql://root:@localhost", "test_having").await;
|
let ctx = TestContext::new("test_having").await;
|
||||||
|
|
||||||
let bakery = bakery::ActiveModel {
|
let bakery = bakery::ActiveModel {
|
||||||
name: Set("SeaSide Bakery".to_owned()),
|
name: Set("SeaSide Bakery".to_owned()),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user