core: type streaming session timestamps

This commit is contained in:
a.tolmachev
2026-04-13 05:47:42 +00:00
parent edf318ba67
commit 03cb109b40
10 changed files with 254 additions and 228 deletions
+19 -19
View File
@@ -2015,7 +2015,7 @@ mod tests {
.await
.unwrap();
registry
.close_stream_session(&closable_session.id, "2026-04-06T12:00:30Z")
.close_stream_session(&closable_session.id, &timestamp("2026-04-06T12:00:30Z"))
.await
.unwrap();
@@ -2033,14 +2033,14 @@ mod tests {
next_status: StreamStatus::Failed,
cursor: Some(&json!({"cursor":"next"})),
state: &json!({"phase":"failed"}),
expires_at: Some("2026-04-06T12:10:00Z"),
last_poll_at: Some("2026-04-06T12:01:00Z"),
closed_at: Some("2026-04-06T12:01:00Z"),
expires_at: Some(&timestamp("2026-04-06T12:10:00Z")),
last_poll_at: Some(&timestamp("2026-04-06T12:01:00Z")),
closed_at: Some(&timestamp("2026-04-06T12:01:00Z")),
})
.await
.unwrap();
assert_eq!(updated.status, StreamStatus::Failed);
assert_eq!(updated.closed_at.as_deref(), Some("2026-04-06T12:01:00Z"));
assert_eq!(updated.closed_at, Some(timestamp("2026-04-06T12:01:00Z")));
let page = registry
.list_stream_sessions(StreamSessionFilter {
@@ -2062,7 +2062,7 @@ mod tests {
.create_stream_session(CreateStreamSessionRequest {
session: &StreamSession {
id: expired_session.id.clone(),
expires_at: "2026-04-06T11:00:00Z".to_owned(),
expires_at: timestamp("2026-04-06T11:00:00Z"),
..expired_session
},
})
@@ -2070,7 +2070,7 @@ mod tests {
.unwrap();
let deleted = registry
.delete_expired_stream_sessions("2026-04-06T12:00:00Z")
.delete_expired_stream_sessions(&timestamp("2026-04-06T12:00:00Z"))
.await
.unwrap();
assert_eq!(deleted, 1);
@@ -2140,7 +2140,7 @@ mod tests {
.await
.unwrap();
registry
.cancel_async_job(&cancellable_job.id, "2026-04-06T12:00:30Z")
.cancel_async_job(&cancellable_job.id, &timestamp("2026-04-06T12:00:30Z"))
.await
.unwrap();
@@ -2159,9 +2159,9 @@ mod tests {
progress: &json!({"percent":100}),
result: Some(&json!({"ok":true})),
error: None,
expires_at: Some("2026-04-06T12:15:00Z"),
updated_at: "2026-04-06T12:01:00Z",
finished_at: Some("2026-04-06T12:01:00Z"),
expires_at: Some(&timestamp("2026-04-06T12:15:00Z")),
updated_at: &timestamp("2026-04-06T12:01:00Z"),
finished_at: Some(&timestamp("2026-04-06T12:01:00Z")),
})
.await
.unwrap();
@@ -2185,7 +2185,7 @@ mod tests {
let expired_job = AsyncJobHandle {
id: crank_core::AsyncJobId::new("job_expired"),
expires_at: Some("2026-04-06T11:00:00Z".to_owned()),
expires_at: Some(timestamp("2026-04-06T11:00:00Z")),
..test_async_job("job_expired", "op_job_01", JobStatus::Cancelled)
};
registry
@@ -2194,7 +2194,7 @@ mod tests {
.unwrap();
let deleted = registry
.delete_expired_async_jobs("2026-04-06T12:00:00Z")
.delete_expired_async_jobs(&timestamp("2026-04-06T12:00:00Z"))
.await
.unwrap();
assert_eq!(deleted, 1);
@@ -2227,7 +2227,7 @@ mod tests {
result: None,
error: None,
expires_at: None,
updated_at: "2026-04-06T12:01:00Z",
updated_at: &timestamp("2026-04-06T12:01:00Z"),
finished_at: None,
})
.await
@@ -2432,9 +2432,9 @@ mod tests {
status,
cursor: Some(json!({"cursor":"initial"})),
state: json!({"phase":"running"}),
expires_at: "2026-04-06T12:05:00Z".to_owned(),
expires_at: timestamp("2026-04-06T12:05:00Z"),
last_poll_at: None,
created_at: "2026-04-06T12:00:00Z".to_owned(),
created_at: timestamp("2026-04-06T12:00:00Z"),
closed_at: None,
}
}
@@ -2510,9 +2510,9 @@ mod tests {
progress: json!({"percent": 25}),
result: None,
error: None,
expires_at: Some("2026-04-06T12:05:00Z".to_owned()),
created_at: "2026-04-06T12:00:00Z".to_owned(),
updated_at: "2026-04-06T12:00:00Z".to_owned(),
expires_at: Some(timestamp("2026-04-06T12:05:00Z")),
created_at: timestamp("2026-04-06T12:00:00Z"),
updated_at: timestamp("2026-04-06T12:00:00Z"),
finished_at: None,
}
}