Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
600 changes: 218 additions & 382 deletions Cargo.lock

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions opsqueue/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ required-features = ["server-logic"]

[dependencies]
# Datatypes and concurrency:
itertools = "0.14.0"
itertools = "0.15.0"
arc-swap = {version = "1.9.1", optional = true}
moka = { version = "0.12.15", features = ["sync"], optional = true }
chrono = { version = "0.4.44", features = ["serde"]}
Expand All @@ -32,7 +32,7 @@ ux = "0.1.6"
# Error handling:
anyhow = "1.0.102"
# Database:
sqlx = { version = "0.8.2", features = ["sqlite", "runtime-tokio", "chrono"], optional = true }
sqlx = { version = "0.9.0", features = ["sqlite", "runtime-tokio", "chrono"], optional = true }
# Serialization:
serde = { version = "1.0.203", features = ["derive"] }
serde_json = "1.0.149"
Expand All @@ -46,12 +46,12 @@ axum = { version = "0.8.9", features = ["ws", "macros"], optional = true }
reqwest = { version = "0.13.2", default-features = false, features = ["json"], optional = true }
url = {version = "2.5.2"}
tokio-util = { version = "0.7.18", features = ["io", "rt", "time"] }
tower-http = { version = "0.6.8", features = ["trace", "catch-panic"], optional = true }
tower-http = { version = "0.7.0", features = ["trace", "catch-panic"], optional = true }
# Logging and tracing:
tracing = {version = "0.1", features = ["log"] }
tracing-subscriber = {version = "0.3", features = ["std", "env-filter"] }
sentry = {version = "0.47", optional = true, default-features=false, features=["rustls", "reqwest", "anyhow", "backtrace", "contexts", "tracing", "panic"]}
sentry-tracing = {version = "0.47", optional = true}
sentry = {version = "0.48", optional = true, default-features=false, features=["rustls", "reqwest", "anyhow", "backtrace", "contexts", "tracing", "panic"]}
sentry-tracing = {version = "0.48", optional = true}
# Exporting traces to Opentelemetry:
opentelemetry = { version = "0.32", default-features = false, features = ["trace"] }
opentelemetry_sdk = { version = "0.32", default-features = false, features = ["trace", "rt-tokio"] }
Expand Down
14 changes: 7 additions & 7 deletions opsqueue/src/common/chunk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,14 +228,14 @@ pub mod db {
impl<'q> sqlx::Encode<'q, Sqlite> for super::ChunkIndex {
fn encode_by_ref(
&self,
buf: &mut <Sqlite as sqlx::Database>::ArgumentBuffer<'q>,
buf: &mut <Sqlite as sqlx::Database>::ArgumentBuffer,
) -> Result<sqlx::encode::IsNull, sqlx::error::BoxDynError> {
<i64 as sqlx::Encode<'q, Sqlite>>::encode_by_ref(&i64::from(*self), buf)
}

fn encode(
self,
buf: &mut <Sqlite as sqlx::Database>::ArgumentBuffer<'q>,
buf: &mut <Sqlite as sqlx::Database>::ArgumentBuffer,
) -> Result<sqlx::encode::IsNull, sqlx::error::BoxDynError>
where
Self: Sized,
Expand Down Expand Up @@ -694,7 +694,7 @@ pub mod test {
use super::db::*;
use super::*;

#[sqlx::test]
#[sqlx::test(migrator = "crate::MIGRATOR")]
pub async fn test_insert_chunk(db: sqlx::SqlitePool) {
let db = WriterPool::new(db);
let mut conn = db.writer_conn().await.unwrap();
Expand All @@ -711,7 +711,7 @@ pub mod test {
assert!(count_chunks(&mut conn).await.unwrap() == u63::new(1));
}

#[sqlx::test]
#[sqlx::test(migrator = "crate::MIGRATOR")]
pub async fn test_get_chunk(db: sqlx::SqlitePool) {
let db = WriterPool::new(db);
let mut conn = db.writer_conn().await.unwrap();
Expand All @@ -731,7 +731,7 @@ pub mod test {
assert!(chunk == fetched_chunk);
}

#[sqlx::test]
#[sqlx::test(migrator = "crate::MIGRATOR")]
pub async fn test_complete_chunk_raw(db: sqlx::SqlitePool) {
let db = WriterPool::new(db);
let mut conn = db.writer_conn().await.unwrap();
Expand Down Expand Up @@ -769,7 +769,7 @@ pub mod test {
assert!(count_chunks_failed(&mut conn).await.unwrap() == u63::new(0));
}

#[sqlx::test]
#[sqlx::test(migrator = "crate::MIGRATOR")]
pub async fn test_complete_chunk_raw_updates_submissions_chunk_total(db: sqlx::SqlitePool) {
let db = WriterPool::new(db);
let mut conn = db.writer_conn().await.unwrap();
Expand Down Expand Up @@ -812,7 +812,7 @@ pub mod test {
}
}

#[sqlx::test]
#[sqlx::test(migrator = "crate::MIGRATOR")]
pub async fn test_fail_chunk(db: sqlx::SqlitePool) {
let db = WriterPool::new(db);
let mut conn = db.writer_conn().await.unwrap();
Expand Down
28 changes: 14 additions & 14 deletions opsqueue/src/common/submission.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,14 +284,14 @@ pub mod db {
impl<'q> sqlx::Encode<'q, Sqlite> for SubmissionId {
fn encode_by_ref(
&self,
buf: &mut <Sqlite as sqlx::Database>::ArgumentBuffer<'q>,
buf: &mut <Sqlite as sqlx::Database>::ArgumentBuffer,
) -> Result<sqlx::encode::IsNull, sqlx::error::BoxDynError> {
<i64 as sqlx::Encode<'q, Sqlite>>::encode_by_ref(&i64::from(*self), buf)
}

fn encode(
self,
buf: &mut <Sqlite as sqlx::Database>::ArgumentBuffer<'q>,
buf: &mut <Sqlite as sqlx::Database>::ArgumentBuffer,
) -> Result<sqlx::encode::IsNull, sqlx::error::BoxDynError>
where
Self: Sized,
Expand Down Expand Up @@ -1050,7 +1050,7 @@ pub mod test {
use super::*;

async fn explain_query_plan(query: &str, conn: &mut SqliteConnection) -> String {
sqlx::raw_sql(&format!("EXPLAIN QUERY PLAN {query}"))
sqlx::raw_sql(sqlx::AssertSqlSafe(format!("EXPLAIN QUERY PLAN {query}")))
.fetch_all(&mut *conn)
.await
.unwrap_or_else(|_| panic!("Invalid query: \n{query}\n"))
Expand All @@ -1075,7 +1075,7 @@ pub mod test {
);
}

#[sqlx::test]
#[sqlx::test(migrator = "crate::MIGRATOR")]
pub async fn test_query_plan_submission_status_in_progress(db: sqlx::SqlitePool) {
let mut conn = db.acquire().await.unwrap();
let query = r#"
Expand Down Expand Up @@ -1103,7 +1103,7 @@ pub mod test {
");
}

#[sqlx::test]
#[sqlx::test(migrator = "crate::MIGRATOR")]
pub async fn test_query_plan_submission_status_completed(db: sqlx::SqlitePool) {
let mut conn = db.acquire().await.unwrap();
let query = r#"
Expand Down Expand Up @@ -1131,7 +1131,7 @@ pub mod test {
");
}

#[sqlx::test]
#[sqlx::test(migrator = "crate::MIGRATOR")]
pub async fn test_query_plan_submission_status_failed(db: sqlx::SqlitePool) {
let mut conn = db.acquire().await.unwrap();
let query = r#"
Expand Down Expand Up @@ -1161,7 +1161,7 @@ pub mod test {
");
}

#[sqlx::test]
#[sqlx::test(migrator = "crate::MIGRATOR")]
pub async fn test_query_plan_submission_status_cancelled(db: sqlx::SqlitePool) {
let mut conn = db.acquire().await.unwrap();
let query = r#"
Expand All @@ -1188,7 +1188,7 @@ pub mod test {
");
}

#[sqlx::test]
#[sqlx::test(migrator = "crate::MIGRATOR")]
pub async fn test_insert_submission(db: sqlx::SqlitePool) {
let db = WriterPool::new(db);
let mut conn = db.writer_conn().await.unwrap();
Expand All @@ -1208,7 +1208,7 @@ pub mod test {
assert_matches!(count_submissions(&mut conn).await, Ok(1));
}

#[sqlx::test]
#[sqlx::test(migrator = "crate::MIGRATOR")]
pub async fn test_get_submission(db: sqlx::SqlitePool) {
let db = WriterPool::new(db);
let mut conn = db.writer_conn().await.unwrap();
Expand All @@ -1231,7 +1231,7 @@ pub mod test {
assert_eq!(fetched_submission, submission);
}

#[sqlx::test]
#[sqlx::test(migrator = "crate::MIGRATOR")]
pub async fn test_submission_strategic_metadata(db: sqlx::SqlitePool) {
let strategic_metadata: StrategicMetadataMap =
[("company_id".to_string(), 123), ("flavour".to_string(), 42)]
Expand Down Expand Up @@ -1275,7 +1275,7 @@ pub mod test {
assert_eq!(chunk_fetched_metadata, strategic_metadata);
}

#[sqlx::test]
#[sqlx::test(migrator = "crate::MIGRATOR")]
pub async fn test_complete_submission_raw(db: sqlx::SqlitePool) {
let db = WriterPool::new(db);
let mut conn = db.writer_conn().await.unwrap();
Expand All @@ -1300,7 +1300,7 @@ pub mod test {
assert_matches!(count_submissions_failed(&mut conn).await, Ok(0));
}

#[sqlx::test]
#[sqlx::test(migrator = "crate::MIGRATOR")]
pub async fn test_fail_submission_raw(db: sqlx::SqlitePool) {
let db = WriterPool::new(db);
let mut conn = db.writer_conn().await.unwrap();
Expand All @@ -1327,7 +1327,7 @@ pub mod test {
assert_matches!(count_submissions_failed(&mut conn).await, Ok(1));
}

#[sqlx::test]
#[sqlx::test(migrator = "crate::MIGRATOR")]
pub async fn test_cleanup_old(db: sqlx::SqlitePool) {
let db = WriterPool::new(db);
let mut conn = db.writer_conn().await.unwrap();
Expand Down Expand Up @@ -1454,7 +1454,7 @@ pub mod test {
let _sub2 = submission_status(old_four_unfailed, &mut conn).await;
}

#[sqlx::test]
#[sqlx::test(migrator = "crate::MIGRATOR")]
/// Test whether empty submissions are marked as completed right away by `insert_submission_from_chunks`.
pub async fn auto_complete_empty_submission(db: sqlx::SqlitePool) {
let db = WriterPool::new(db);
Expand Down
2 changes: 1 addition & 1 deletion opsqueue/src/consumer/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ mod tests {

use super::*;

#[sqlx::test]
#[sqlx::test(migrator = "crate::MIGRATOR")]
pub async fn test_fetch_chunks(pool: sqlx::SqlitePool) {
let db_pools = db::DBPools::from_test_pool(&pool);
let uri = "0.0.0.0:10083";
Expand Down
Loading
Loading