docs: align agent auth model and fix session test

This commit is contained in:
a.tolmachev
2026-05-03 10:38:12 +00:00
parent bf270336d9
commit 2d43db69c9
15 changed files with 578 additions and 61 deletions
+11 -5
View File
@@ -340,7 +340,7 @@ mod tests {
Executor,
postgres::{PgConnectOptions, PgPoolOptions},
};
use time::format_description::well_known::Rfc3339;
use time::{OffsetDateTime, format_description::well_known::Rfc3339};
use uuid::Uuid;
use super::{
@@ -353,6 +353,12 @@ mod tests {
time::OffsetDateTime::parse(value, &Rfc3339).unwrap()
}
fn truncate_to_micros(value: OffsetDateTime) -> OffsetDateTime {
value
.replace_nanosecond((value.nanosecond() / 1_000) * 1_000)
.unwrap()
}
#[tokio::test]
async fn creates_and_reads_transport_sessions() {
let store = InMemorySessionStore::default();
@@ -455,15 +461,15 @@ mod tests {
.await
.unwrap();
let created_at = timestamp("2026-05-01T10:00:00Z");
let initialized_at = timestamp("2026-05-01T10:00:05Z");
let created_at = OffsetDateTime::now_utc() - time::Duration::hours(1);
let initialized_at = created_at + time::Duration::seconds(5);
let session_id = store_a
.create(
"2025-11-25",
"default",
"sales",
created_at,
Some(timestamp("2026-05-02T10:00:00Z")),
Some(created_at + time::Duration::days(30)),
)
.await
.unwrap();
@@ -482,7 +488,7 @@ mod tests {
assert_eq!(session.id, session_id);
assert!(session.initialized);
assert_eq!(session.updated_at, initialized_at);
assert_eq!(session.updated_at, truncate_to_micros(initialized_at));
assert_eq!(session.workspace_slug, "default");
assert_eq!(session.agent_slug, "sales");
}