feat: introduce docker-compose based testing for running locally against many database combinations

This commit is contained in:
Ryan Leckey
2020-05-30 14:51:57 -07:00
parent afd831b0d3
commit e5b6047009
56 changed files with 2192 additions and 2326 deletions

View File

@@ -1,22 +1,31 @@
use std::ptr::null_mut;
use std::sync::atomic::{spin_loop_hint, AtomicI32, AtomicPtr, Ordering};
use std::sync::Arc;
use std::thread::{self, park, spawn, JoinHandle};
use either::Either;
use libsqlite3_sys::{sqlite3_step, sqlite3_stmt, SQLITE_DONE, SQLITE_ROW};
use sqlx_rt::yield_now;
use libsqlite3_sys::{sqlite3_step, SQLITE_DONE, SQLITE_ROW};
use crate::error::Error;
use crate::sqlite::statement::StatementHandle;
#[cfg(not(feature = "runtime-tokio"))]
use {
libsqlite3_sys::sqlite3_stmt,
sqlx_rt::yield_now,
std::ptr::null_mut,
std::sync::atomic::{spin_loop_hint, AtomicI32, AtomicPtr, Ordering},
std::sync::Arc,
std::thread::{self, park, spawn, JoinHandle},
};
// For async-std and actix, the worker maintains a dedicated thread for each SQLite connection
// All invocations of [sqlite3_step] are run on this thread
// For tokio, the worker is a thin wrapper around an invocation to [block_in_place]
#[cfg(not(feature = "runtime-tokio"))]
const STATE_CLOSE: i32 = -1;
#[cfg(not(feature = "runtime-tokio"))]
const STATE_READY: i32 = 0;
#[cfg(not(feature = "runtime-tokio"))]
const STATE_INITIAL: i32 = 1;
#[cfg(not(feature = "runtime-tokio"))]
@@ -156,7 +165,7 @@ impl StatementWorker {
pub(crate) async fn step(&self, statement: &StatementHandle) -> Result<Either<u64, ()>, Error> {
let statement = *statement;
let status = sqlx_rt::blocking!({ unsafe { sqlite3_step(statement.0.as_ptr()) } });
let status = sqlx_rt::blocking!(unsafe { sqlite3_step(statement.0.as_ptr()) });
match status {
// a row was found