Skip to content

Commit e044c06

Browse files
fix(mst2): observe renewal locks without exhausting the test pool (#61)
Observe pg_locks through the transaction already holding the retention lock, and clear its statistics snapshot before each poll. Keep all original expiry, root-release and byte-count assertions. Stream repository test diagnostics before a possible CI cancellation. Native regression validation is pending.
1 parent 4a33d1f commit e044c06

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

‎.github/workflows/repository-gates.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ jobs:
7272
set -euo pipefail
7373
source .env.test
7474
export no_proxy="$NO_PROXY"
75-
cargo test --all
75+
cargo test --all -- --nocapture
7676
7777
- name: Stop isolated test dependencies
7878
if: always()

‎src/api/router/snapshot_session_tests.rs‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use sea_orm::{DatabaseConnection, DbBackend, Statement, TransactionTrait};
1+
use sea_orm::{ConnectionTrait, DatabaseConnection, DbBackend, Statement, TransactionTrait};
22
use tokio::sync::Barrier;
33

44
use super::*;
@@ -22,7 +22,7 @@ fn resolve_request(scope: &str) -> Request<Body> {
2222
.unwrap()
2323
}
2424

25-
async fn scalar(db: &DatabaseConnection, sql: &str) -> i64 {
25+
async fn scalar<C: ConnectionTrait>(db: &C, sql: &str) -> i64 {
2626
db.query_one_raw(Statement::from_string(DbBackend::Postgres, sql.to_owned()))
2727
.await
2828
.unwrap()
@@ -575,8 +575,14 @@ async fn mst2_durable_http_renew_waits_for_lock_before_checking_database_deadlin
575575
};
576576
tokio::time::timeout(Duration::from_secs(30), async {
577577
loop {
578+
held.execute_raw(Statement::from_string(
579+
DbBackend::Postgres,
580+
"SELECT pg_stat_clear_snapshot()".to_owned(),
581+
))
582+
.await
583+
.unwrap();
578584
let blocked = scalar(
579-
db,
585+
&held,
580586
"SELECT count(*) FROM pg_locks l JOIN pg_stat_activity a ON a.pid=l.pid
581587
WHERE l.locktype='advisory' AND NOT l.granted AND a.datname=current_database()
582588
AND a.application_name=current_schema()",

0 commit comments

Comments
 (0)