feat: recover workflow waits within original deadlines
This commit is contained in:
@@ -28,6 +28,14 @@ func (s *captureStore) RetryStep(context.Context, auth.Token, core.ID, string, R
|
||||
s.calls++
|
||||
return Result{}, nil
|
||||
}
|
||||
func (s *captureStore) ContinuePoll(context.Context, auth.Token, core.ID, string, ContinuePollInput) (Result, error) {
|
||||
s.calls++
|
||||
return Result{}, nil
|
||||
}
|
||||
func (s *captureStore) RearmWait(context.Context, auth.Token, core.ID, string, RearmWaitInput) (Result, error) {
|
||||
s.calls++
|
||||
return Result{}, nil
|
||||
}
|
||||
func TestRecoveryValidation(t *testing.T) {
|
||||
id := core.ID(strings.Repeat("a", 32))
|
||||
d := Decision{ExpectedRevision: 2, Reason: "核实外部结果", EvidenceRef: "evidence://case/1"}
|
||||
@@ -71,7 +79,19 @@ func TestRecoveryValidation(t *testing.T) {
|
||||
if _, err := s.RetryStep(ctx, token, id, "operation", RetryStepInput{StepDecision: step}); err == nil {
|
||||
t.Fatal("unsafe retry accepted")
|
||||
}
|
||||
if store.calls != 4 {
|
||||
if _, err := s.ContinuePoll(ctx, token, id, "operation", ContinuePollInput{StepDecision: step}); err == nil {
|
||||
t.Fatal("unconfirmed pending accepted")
|
||||
}
|
||||
if _, err := s.RearmWait(ctx, token, id, "operation", RearmWaitInput{StepDecision: step}); err == nil {
|
||||
t.Fatal("unverified wait accepted")
|
||||
}
|
||||
if _, err := s.ContinuePoll(ctx, token, id, "operation", ContinuePollInput{StepDecision: step, PendingConfirmed: true}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if _, err := s.RearmWait(ctx, token, id, "operation", RearmWaitInput{StepDecision: step, WaitVerified: true}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if store.calls != 6 {
|
||||
t.Fatal("invalid inputs reached storage", store.calls)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user