fix(19.8-03): conga worker tests read the startup summary from diary records

- queue:work and schedule:run print their summary block only on a
  terminal; off one (the test's buffer) they log 'startup summary' and
  'shutdown report' records of component queue/schedule, so the tests
  still asserted the pre-19.8 Info lines
- captureDiary bootstraps diary on a buffer; TestQueueWork and
  TestScheduleRunForeground wait for the startup summary record and
  check the shutdown report record
This commit is contained in:
Jakub Zych
2026-10-21 14:01:14 +02:00
parent 7170c5bac6
commit 205764300e
2 changed files with 51 additions and 6 deletions

View File

@@ -564,6 +564,7 @@ func TestScheduleRunForeground(t *testing.T) {
}})); err != nil {
t.Fatal(err)
}
logs := captureDiary(t)
out := newSyncBuffer()
root, err := bonfire.NewRoot("acme", RuntimeCommands(app, schedulePlugins(
pact.ScheduledCommand{Command: "acme:tick", Cadence: pact.Every(time.Second)},
@@ -579,12 +580,19 @@ func TestScheduleRunForeground(t *testing.T) {
select {
case <-ticked:
case err := <-done:
t.Fatalf("schedule:run returned early: %v (%q)", err, out.String())
t.Fatalf("schedule:run returned early: %v (%q)\n%s", err, out.String(), logs.String())
case <-time.After(10 * time.Second):
t.Fatalf("scheduled command did not run: %q", out.String())
t.Fatalf("scheduled command did not run: %q\n%s", out.String(), logs.String())
}
if !strings.Contains(out.String(), "scheduler started") {
t.Fatalf("out = %q", out.String())
// Off a terminal the startup summary is a record of component schedule.
var summary string
for _, line := range strings.Split(logs.String(), "\n") {
if strings.Contains(line, `msg="startup summary"`) && strings.Contains(line, "component=schedule") {
summary = line
}
}
if summary == "" || !strings.Contains(summary, `next="acme:tick at `) {
t.Fatalf("no schedule startup summary record (out %q):\n%s", out.String(), logs.String())
}
m, err := From(app)
if err != nil {
@@ -605,6 +613,15 @@ func TestScheduleRunForeground(t *testing.T) {
case <-time.After(15 * time.Second):
t.Fatal("schedule:run did not stop")
}
reported := false
for _, line := range strings.Split(logs.String(), "\n") {
if strings.Contains(line, `msg="shutdown report"`) && strings.Contains(line, "component=schedule") {
reported = true
}
}
if !reported {
t.Fatalf("no schedule shutdown report record:\n%s", logs.String())
}
}
// TestScheduleValidation covers the CLI-04 refusals: an empty command, a