fix(web): job log polls while active, one service history limit (#7)
This commit is contained in:
@@ -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"} {
|
||||
|
||||
Reference in New Issue
Block a user