NEXT
Checks / test (push) Failing after 2m25s

This commit is contained in:
Ultradesu committed 2026-10-07 15:30:31 +01:00
1 parent e37d583179
commit 5260c2828b
65 files changed
+8469 -380

No files matched your search

+36 -6
View File
@@ -1,8 +1,8 @@
use chrono::{Duration, Utc};
use cot::db::Model;
use cot::db::{Model, query};
use meguri::{
domain::*,
models::UserRow,
models::{HistoryRow, UserRow},
service,
store::{Store, WorkspaceRecord},
};
@@ -24,19 +24,26 @@ impl Fixture {
for name in ["Alice", "Bob", "Carol"] {
let user = User {
language: None,
id: Uuid::new_v4(),
person: Person {
id: Uuid::new_v4(),
user_id: None,
display_name: name.into(),
email: Some(format!("{}@example.com", Uuid::new_v4())),
country: Some("CY".into()),
},
username: format!("test-{}", Uuid::new_v4().simple()),
display_name: name.into(),
country: "CY".into(),
timezone: None,
};
let mut user = user;
user.person.user_id = Some(user.id);
UserRow {
language: None,
demo_deleted_at: None,
id: user.id.to_string(),
username: user.username.clone(),
display_name: user.display_name.clone(),
country: user.country.clone(),
country: user.country.clone().unwrap(),
email: user.email.clone().unwrap(),
timezone: None,
password_hash: "test-only-unusable-password".into(),
created_at: Utc::now(),
@@ -121,6 +128,29 @@ impl Fixture {
}
}
pub async fn prioritize_publication(&self) {
let revision = self.db.workspace(self.team.id).await.unwrap().revision;
self.db
.retry(self.team.id, self.people[0].id, revision)
.await
.unwrap();
// PostgreSQL and the worker can run on different host clocks. Publish only
// once this test's latest committed revision has actually become effective.
let workspace = self.team.id.to_string();
let effective = query!(HistoryRow, $workspace_id == workspace)
.all(&self.db.db)
.await
.unwrap()
.into_iter()
.map(|row| row.effective_at)
.max()
.unwrap();
if let Ok(delay) = (effective - Utc::now()).to_std() {
assert!(
delay < std::time::Duration::from_secs(2),
"Database clock is too far ahead of the test worker"
);
tokio::time::sleep(delay + std::time::Duration::from_millis(1)).await;
}
// The worker takes a bounded batch. Repeated runs leave other test tenants
// in this disposable database, so explicitly put this test's job first.
self.db