W2 second-end-nothing-new: a second record-ended of a cleared record raises and clears nothing
Builds: design 47 H2 H-A-617 (the watchman's part; the code already took it as nothing new, the row proves it); row W2
This commit is contained in:
@@ -360,6 +360,34 @@ func TestWatchmanWhole(t *testing.T) { // 1135/AC8
|
|||||||
sayStep("step-ended", time.Now().UTC())
|
sayStep("step-ended", time.Now().UTC())
|
||||||
until("the step's end clears it", func() bool { return !finding(stepFinding) })
|
until("the step's end clears it", func() bool { return !finding(stepFinding) })
|
||||||
|
|
||||||
|
// H-A-617: a record open for over a day raises `record-open` and its end clears it; a second end of it (`ends` 2) raises and
|
||||||
|
// clears nothing. A later record's finding, heard after the second end on the one stream, shows the second end was taken.
|
||||||
|
recordSay := func(event, record, call string, ends int) {
|
||||||
|
t.Helper()
|
||||||
|
body := fmt.Sprintf(`{"record":%q,"milestone":"main.42","branch":"main","source":42,"call":%q,"ends":%d,"at":%q}`, record, call, ends,
|
||||||
|
time.Now().UTC().Add(-25*time.Hour).Format(time.RFC3339))
|
||||||
|
subject := "mesh.seat.mesh-delivery.event." + event
|
||||||
|
if event == "record-opened" {
|
||||||
|
subject += "." + call
|
||||||
|
}
|
||||||
|
if _, err := js.Publish(ctx, subject, []byte(body)); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
recordFinding := func(record string) bool {
|
||||||
|
return finding(watch.FindingKey(watch.ScopeDelivery, record, watch.KindRecordOpen))
|
||||||
|
}
|
||||||
|
recordSay("record-opened", "r-first", "aaaaaaaaaaaaaaaa", 0)
|
||||||
|
until("the record open for over a day", func() bool { return recordFinding("r-first") })
|
||||||
|
recordSay("record-ended", "r-first", "aaaaaaaaaaaaaaaa", 1)
|
||||||
|
until("the record's end clears it", func() bool { return !recordFinding("r-first") })
|
||||||
|
recordSay("record-ended", "r-first", "aaaaaaaaaaaaaaaa", 2)
|
||||||
|
recordSay("record-opened", "r-second", "bbbbbbbbbbbbbbbb", 0)
|
||||||
|
until("the next record open for over a day", func() bool { return recordFinding("r-second") })
|
||||||
|
if recordFinding("r-first") {
|
||||||
|
t.Error("a second end of a cleared record raised its finding again")
|
||||||
|
}
|
||||||
|
|
||||||
// A step the runner's stands named at the start (seeded through the seat verb) and that no progress follows is
|
// A step the runner's stands named at the start (seeded through the seat verb) and that no progress follows is
|
||||||
// `pipeline-stands`; the approval waiting on a person is owed none.
|
// `pipeline-stands`; the approval waiting on a person is owed none.
|
||||||
seeded := func(step string) string {
|
seeded := func(step string) string {
|
||||||
|
|||||||
Reference in New Issue
Block a user