litellm/litellm-rust/crates/db-testing/tests/postgres.rs
devin-ai-integration[bot] 9b08112ed2
feat(rust): add litellm-db and litellm-db-testing workspace scaffolding (#43504)
* feat(rust): add litellm-db and litellm-db-testing workspace scaffolding

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(db-testing): apply the real Prisma migrations in a test and drop the sort mutation

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

---------

Co-authored-by: Yujong Lee <yujong@berri.ai>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-27 18:48:45 -07:00

24 lines
715 B
Rust

use std::path::Path;
use litellm_db_testing::{MigratedPostgres, PRISMA_MIGRATIONS_DIR, prisma_migrations};
use rstest::rstest;
#[rstest]
#[tokio::test]
async fn real_prisma_migrations_apply_to_a_fresh_postgres() {
let postgres = MigratedPostgres::start().await.unwrap();
#[expect(
clippy::disallowed_methods,
reason = "the test schema has no offline query data"
)]
let applied: i64 = sqlx::query_scalar("SELECT count(*) FROM _sqlx_migrations WHERE success")
.fetch_one(postgres.pool())
.await
.unwrap();
let expected = prisma_migrations(Path::new(PRISMA_MIGRATIONS_DIR))
.unwrap()
.len();
assert_eq!(applied as usize, expected);
}