fix(web): job log polls while active, one service history limit (#7)

This commit is contained in:
2026-10-12 19:13:01 +02:00
parent 88d5507217
commit 8b2c10cc05
3 changed files with 22 additions and 5 deletions
+13
View File
@@ -482,6 +482,19 @@ func TestJobFragment_RereadsFromStore(t *testing.T) {
assert.Contains(t, body, "step 2")
}
func TestJobFragment_PollsOnlyWhileActive(t *testing.T) {
srv, store, _, _, _ := newTestEnv(t)
store.jobs = []model.Job{
{ID: 42, ServiceID: 1, Status: model.JobRunning, CreatedAt: time.Now()},
{ID: 43, ServiceID: 1, Status: model.JobSucceeded, CreatedAt: time.Now()},
}
_, body := get(t, srv, "/fragments/jobs/42")
assert.Contains(t, body, `hx-trigger="sse:job-42, every 2s"`)
_, body = get(t, srv, "/fragments/jobs/43")
assert.Contains(t, body, `hx-trigger="sse:job-43"`)
assert.NotContains(t, body, "every 2s")
}
func TestJob_NotFound(t *testing.T) {
srv, _, _, _ := newTestServer(t)
for _, path := range []string{"/jobs/99", "/fragments/jobs/99"} {