aboutsummaryrefslogtreecommitdiffstats
path: root/crates/atuin-daemon/tests
diff options
context:
space:
mode:
authorEllie Huxtable <ellie@atuin.sh>2026-04-11 01:32:24 +0100
committerGitHub <noreply@github.com>2026-04-11 01:32:24 +0100
commit7e47f4df6ceb0fe7e32c166776e4e3b960039b67 (patch)
tree5e512c17c6c9d36c6e347a579a9baacc56832817 /crates/atuin-daemon/tests
parentchore: Prepare 18.14.0-beta.1 release (#3393) (diff)
downloadatuin-7e47f4df6ceb0fe7e32c166776e4e3b960039b67.zip
feat: add history tail for live monitoring view (#3389)
Useful for watching what agents are doing, or viewing live info from other machines. Regardless I am liking it for debugging ## Checks - [ ] I am happy for maintainers to push small adjustments to this PR, to speed up the review cycle - [ ] I have checked that there are no existing pull requests for the same thing
Diffstat (limited to 'crates/atuin-daemon/tests')
-rw-r--r--crates/atuin-daemon/tests/lifecycle.rs50
1 files changed, 50 insertions, 0 deletions
diff --git a/crates/atuin-daemon/tests/lifecycle.rs b/crates/atuin-daemon/tests/lifecycle.rs
index 3b6952de..4a91e5cb 100644
--- a/crates/atuin-daemon/tests/lifecycle.rs
+++ b/crates/atuin-daemon/tests/lifecycle.rs
@@ -146,6 +146,56 @@ mod unix {
}
#[tokio::test]
+ async fn test_tail_history_streams_started_and_ended_events() {
+ use atuin_client::history::History;
+ use atuin_daemon::history::HistoryEventKind;
+
+ let (mut client, _handle, _tmp) = start_test_daemon().await;
+ let mut stream = client.tail_history().await.unwrap();
+
+ let history = History::daemon()
+ .timestamp(time::OffsetDateTime::now_utc())
+ .command("git status".to_string())
+ .cwd("/tmp/repo".to_string())
+ .session("tail-session".to_string())
+ .hostname("test-host:ellie".to_string())
+ .author("claude".to_string())
+ .intent("inspect repository state".to_string())
+ .build()
+ .into();
+
+ let start_reply = client.start_history(history).await.unwrap();
+
+ let started = stream.message().await.unwrap().unwrap();
+ assert_eq!(
+ HistoryEventKind::try_from(started.kind).unwrap(),
+ HistoryEventKind::Started
+ );
+ let started_history = started.history.unwrap();
+ assert_eq!(started_history.id, start_reply.id);
+ assert_eq!(started_history.command, "git status");
+ assert_eq!(started_history.cwd, "/tmp/repo");
+ assert_eq!(started_history.hostname, "test-host:ellie");
+ assert_eq!(started_history.author, "claude");
+ assert_eq!(started_history.intent, "inspect repository state");
+
+ client
+ .end_history(start_reply.id.clone(), 1_000_000, 0)
+ .await
+ .unwrap();
+
+ let ended = stream.message().await.unwrap().unwrap();
+ assert_eq!(
+ HistoryEventKind::try_from(ended.kind).unwrap(),
+ HistoryEventKind::Ended
+ );
+ let ended_history = ended.history.unwrap();
+ assert_eq!(ended_history.id, start_reply.id);
+ assert_eq!(ended_history.exit, 0);
+ assert_eq!(ended_history.duration, 1_000_000);
+ }
+
+ #[tokio::test]
async fn test_end_unknown_history_fails() {
let (mut client, _handle, _tmp) = start_test_daemon().await;