Restore durable log ingest and typed plugin projections
This commit is contained in:
@@ -81,26 +81,6 @@ func TestLogIngestAPIWorkflow(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestLiveLogRelayAPIForwardsWithoutStoredOutput(t *testing.T) {
|
||||
router := newTestRouter()
|
||||
hello := createLogIngestAPIFixtures(t, router)
|
||||
batch := validLogBatchRequest(t, hello.SessionToken, 1, 1)
|
||||
|
||||
relay := performJSON(t, router, http.MethodPost, "/api/v1/run/logs/relay", batch)
|
||||
assertStatus(t, relay, http.StatusOK)
|
||||
ack := decodeBody[dto.LogBatchIngestResponse](t, relay)
|
||||
if !ack.Accepted || ack.AcceptedFrom != 1 || ack.AcceptedTo != 1 {
|
||||
t.Fatalf("unexpected live relay ack: %+v", ack)
|
||||
}
|
||||
|
||||
query := performJSON(t, router, http.MethodPost, "/api/v1/log-streams/query", dto.LogStreamCursorRequest{LogStreamID: batch.LogStreamID, AfterSeq: 0, Limit: 10})
|
||||
assertStatus(t, query, http.StatusOK)
|
||||
body := decodeBody[dto.LogStreamCursorResponse](t, query)
|
||||
if len(body.Entries) != 0 || body.LatestSeq != 1 {
|
||||
t.Fatalf("live relay stored platform log output: %+v", body)
|
||||
}
|
||||
}
|
||||
|
||||
func TestLogEventsSSEDoesNotReplayHistory(t *testing.T) {
|
||||
router := newTestRouter()
|
||||
hello := createLogIngestAPIFixtures(t, router)
|
||||
@@ -173,41 +153,6 @@ func TestLogEventsSSELiveOnlyStartsAfterSnapshotTail(t *testing.T) {
|
||||
assertSSEEvent(t, reader, "log", `"seq":2`)
|
||||
}
|
||||
|
||||
func TestLogEventsSSERelaysLiveBatchesWithoutSequenceGate(t *testing.T) {
|
||||
router := newTestRouter()
|
||||
hello := createLogIngestAPIFixtures(t, router)
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
request := httptest.NewRequest(http.MethodGet, "/api/v1/server-instances/server-1/logs/events", nil).WithContext(ctx)
|
||||
streamWriter, streamReader := newSSEPipeResponseWriter()
|
||||
done := make(chan struct{})
|
||||
go func() {
|
||||
router.ServeHTTP(streamWriter, request)
|
||||
_ = streamWriter.Close()
|
||||
close(done)
|
||||
}()
|
||||
t.Cleanup(func() {
|
||||
cancel()
|
||||
_ = streamReader.Close()
|
||||
<-done
|
||||
})
|
||||
if status := <-streamWriter.status; status != http.StatusOK {
|
||||
t.Fatalf("unexpected SSE status: %d", status)
|
||||
}
|
||||
reader := bufio.NewReader(streamReader)
|
||||
assertSSEEvent(t, reader, "session", `"logSessionId":"session-current"`)
|
||||
assertSSEEvent(t, reader, "stream", `"id":"log-1"`)
|
||||
assertSSEEvent(t, reader, "ready", `"streamCount":1`)
|
||||
|
||||
first := validLogBatchRequest(t, hello.SessionToken, 4, 4)
|
||||
assertStatus(t, performJSON(t, router, http.MethodPost, "/api/v1/run/logs/relay", first), http.StatusOK)
|
||||
assertSSEEvent(t, reader, "log", `"seq":4`)
|
||||
|
||||
second := validLogBatchRequest(t, hello.SessionToken, 1, 1)
|
||||
assertStatus(t, performJSON(t, router, http.MethodPost, "/api/v1/run/logs/relay", second), http.StatusOK)
|
||||
assertSSEEvent(t, reader, "log", `"seq":1`)
|
||||
}
|
||||
|
||||
func TestLogEventsSSESkipsBufferedBackfillAfterOpen(t *testing.T) {
|
||||
router := newTestRouter()
|
||||
hello := createLogIngestAPIFixtures(t, router)
|
||||
|
||||
Reference in New Issue
Block a user