From 114c47b62dd01bd0ec34ad6568a00a7a31a42373 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=89=E6=BE=9C?= Date: Tue, 14 Jul 2026 01:30:59 +0800 Subject: [PATCH] test(event): align restart hint with safe stop flow --- internal/event/consume/validate.go | 2 +- internal/event/consume/validate_test.go | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/internal/event/consume/validate.go b/internal/event/consume/validate.go index e25e6a5a..33eafe0b 100644 --- a/internal/event/consume/validate.go +++ b/internal/event/consume/validate.go @@ -36,7 +36,7 @@ var ( // --foreground, --force would silently produce two daemons writing // to the same socket — refuse upfront. ErrForceRequiresForeground = &ValidationError{ - Msg: "--force is only meaningful with --foreground (in daemon mode it would produce multiple bus instances; cloud events would be randomly split across connections). To restart the bus: preview dws event stop --all --dry-run, confirm with --yes, then run dws event consume", + Msg: "--force is only meaningful with --foreground (in daemon mode it would produce multiple bus instances; cloud events would be randomly split across connections). To restart the bus: preview dws event stop --all --dry-run, confirm with dws event stop --all --yes, then run dws event consume", } // ErrJSONFormatRequiresBounded is the plan §3.1 contract: --format diff --git a/internal/event/consume/validate_test.go b/internal/event/consume/validate_test.go index 525e9250..4da7dff0 100644 --- a/internal/event/consume/validate_test.go +++ b/internal/event/consume/validate_test.go @@ -65,7 +65,10 @@ func TestValidate_ForceRequiresForeground(t *testing.T) { if !errors.Is(err, ErrForceRequiresForeground) { t.Fatalf("err = %v, want ErrForceRequiresForeground", err) } - if !strings.Contains(err.Error(), "event stop && dws event consume") { + for _, recoveryStep := range []string{"event stop --all --dry-run", "event stop --all --yes", "event consume"} { + if strings.Contains(err.Error(), recoveryStep) { + continue + } t.Errorf("error message must include the recovery hint, got: %s", err.Error()) }