test(event): align restart hint with safe stop flow

This commit is contained in:
玉澜
2026-07-14 01:30:59 +08:00
parent 6d97bf7204
commit 114c47b62d
2 changed files with 5 additions and 2 deletions
+1 -1
View File
@@ -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
+4 -1
View File
@@ -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())
}