| index 348624efd..117769a62 100644 |
| --- a/internal/e2e/selfserve/job_boundary_test.go |
| +++ b/internal/e2e/selfserve/job_boundary_test.go |
| @@ -3,6 +3,7 @@ |
| package selfserve |
| |
| import ( |
| + "fmt" |
| "strings" |
| "testing" |
| "time" |
| @@ -151,6 +152,7 @@ func everyBoundary(t *testing.T, b jobBoundary, f jobFault, second bool) { |
| return true |
| } |
| var nonce string |
| + var expect uint64 |
| if f.put != putRun { |
| fired := false |
| w.fs.setPut(func(key string, body []byte) putFault { |
| @@ -158,7 +160,7 @@ func everyBoundary(t *testing.T, b jobBoundary, f jobFault, second bool) { |
| if fired || !inFlight(r) { |
| return putRun |
| } |
| - fired, nonce = true, r.Request.Nonce |
| + fired, nonce, expect = true, r.Request.Nonce, r.Request.ExpectSeq |
| return f.put |
| }) |
| } |
| @@ -172,8 +174,30 @@ func everyBoundary(t *testing.T, b jobBoundary, f jobFault, second bool) { |
| if f.point == "" { |
| w.fs.setPut(nil) |
| } |
| - if c := w.crashed; c != nil && inFlight(c) { |
| - nonce = c.Request.Nonce |
| + if c := w.crashed; c != nil && c.Request.Kind == b.kind && c.Request.Phase == b.phase && !c.RequestIssued.IsZero() && !c.Request.Consumed { |
| + // The request at the crash, confirmed already at the bump points. |
| + nonce, expect = c.Request.Nonce, c.Request.ExpectSeq |
| + } |
| + // The faulted write lands at expect_seq + 1: notified_seq reaches it |
| + // before the job's next record write is attempted. |
| + var unannounced []string |
| + if nonce != "" { |
| + landed := expect + 1 |
| + checked := false |
| + w.observe = func(point string, r *console.SelfServeMove) { |
| + if checked || !strings.HasSuffix(point, ":write") || r.Request.Nonce == nonce { |
| + return |
| + } |
| + checked = true |
| + if r.NotifiedSeq < landed { |
| + unannounced = append(unannounced, fmt.Sprintf("%s with notified_seq %d below the faulted write's %d", point, r.NotifiedSeq, landed)) |
| + } |
| + } |
| + defer func() { |
| + if final := w.row(row.ID); final.NotifiedSeq < landed { |
| + t.Errorf("notified_seq %d, below the faulted write's landed record_seq %d", final.NotifiedSeq, landed) |
| + } |
| + }() |
| } |
| if f.point != "" { |
| w.fs.setPut(nil) |
| @@ -246,8 +270,8 @@ func everyBoundary(t *testing.T, b jobBoundary, f jobFault, second bool) { |
| // finaliser can share one tick; every other must be seen. |
| t.Fatalf("request %s was never confirmed (final %s)", nonce, describe(final)) |
| } |
| - if final.NotifiedSeq == 0 { |
| - t.Fatalf("notified_seq is 0 after the landed write") |
| + if len(unannounced) > 0 { |
| + t.Fatalf("the next write came before the faulted write was announced: %v", unannounced) |
| } |
| } |
| if w.fs.bumpCount() <= bumpsBefore { |