feat: complete NX9-Auth management and integrity hardening
This commit is contained in:
1 parent
dc5417334b
commit
a969f9c571
59 files changed
+6508
-290
No files matched your search
@@ -0,0 +1,34 @@
|
||||
#![cfg(feature = "postgres")]
|
||||
|
||||
use sqlx::postgres::PgPoolOptions;
|
||||
use std::time::Duration;
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_postgres_fresh_migration_from_0001_to_latest() {
|
||||
let database_url = "postgres://postgres@127.0.0.1:5433/nx9_auth_test_fresh";
|
||||
|
||||
let pool = match PgPoolOptions::new()
|
||||
.acquire_timeout(Duration::from_secs(1))
|
||||
.connect(database_url)
|
||||
.await
|
||||
{
|
||||
Ok(p) => p,
|
||||
Err(e) => {
|
||||
println!("Skipping PostgreSQL live connection test (server not running): {e}");
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
let migrator = sqlx::migrate!("src/db/migrations/postgres");
|
||||
let res = migrator.run(&pool).await;
|
||||
|
||||
assert!(res.is_ok(), "Fresh PostgreSQL migration failed: {:?}", res);
|
||||
|
||||
// Test idempotency (re-running on migrated database)
|
||||
let res_idempotent = migrator.run(&pool).await;
|
||||
assert!(
|
||||
res_idempotent.is_ok(),
|
||||
"Re-running PostgreSQL migrations failed: {:?}",
|
||||
res_idempotent
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user