K2 again-delays: the default is 15s,90s, whose sum spans the tool runner's restart
Builds: design 47 H2 H-A-603
This commit is contained in:
@@ -8,11 +8,10 @@ import (
|
||||
|
||||
// AgainDelaysSetting is the setting each build module declares for the delay it passes with a run's `again` (design 47
|
||||
// H2 §799): how long the bus waits before it gives an ask again after its first, then its second run ended on a
|
||||
// transport fault, as Go durations separated by commas. DefaultAgainDelays is its default, so three runs span a
|
||||
// one-minute absence of a holder.
|
||||
// transport fault, as Go durations separated by commas. DefaultAgainDelays is its default, so three runs span the tool runner's restart, 105 s (design 47 H2 H-A-603).
|
||||
const (
|
||||
AgainDelaysSetting = "again-delays"
|
||||
DefaultAgainDelays = "15s,60s"
|
||||
DefaultAgainDelays = "15s,90s"
|
||||
)
|
||||
|
||||
// AgainDelays reads the setting again-delays into a Puller's Delay (§799): the run-th delay of the list, its last for a
|
||||
|
||||
@@ -15,11 +15,11 @@ import (
|
||||
// that exited, end their run `again` after again-delays' delay, with no seat call; a third run's fault ends the step failed
|
||||
// with the why `fetch: <words>` or `publish: <words>`. ADR 0664 §1 with the bus's count above the runs that started: an ask
|
||||
// given back twice before its first run (the bus says delivered 3, the step key 1 run began) meets its fault in run 2,
|
||||
// given again after again-delays' second, 60 s, not 3. A publish met by a stopping tool runner is met by no responders (H-A-570 (3)), so it
|
||||
// given again after again-delays' second, 90 s, not 3. A publish met by a stopping tool runner is met by no responders (H-A-570 (3)), so it
|
||||
// is one too; a bare timeout is not.
|
||||
func TestAFetchOrAPublishMetAwayIsATransportFault(t *testing.T) {
|
||||
delay, err := AgainDelays("")
|
||||
if err != nil || delay(1) != 15*time.Second || delay(2) != time.Minute || delay(3) != time.Minute {
|
||||
if err != nil || delay(1) != 15*time.Second || delay(2) != 90*time.Second || delay(3) != 90*time.Second {
|
||||
t.Fatalf("the default again-delays: %v", err)
|
||||
}
|
||||
if own, err := AgainDelays("2s, 5s"); err != nil || own(1) != 2*time.Second || own(2) != 5*time.Second {
|
||||
@@ -53,7 +53,7 @@ func TestAFetchOrAPublishMetAwayIsATransportFault(t *testing.T) {
|
||||
if !sdkstep.IsPassing(tc.err) || !strings.HasPrefix(tc.err.Error(), tc.why) {
|
||||
t.Fatalf("%v: want a transport fault opening with %q", tc.err, tc.why)
|
||||
}
|
||||
// Its first run ends again after 15 s; its second, delivered three times, again after 60 s; its third ends the step failed.
|
||||
// Its first run ends again after 15 s; its second, delivered three times, again after 90 s; its third ends the step failed.
|
||||
for _, run := range []struct {
|
||||
prior int
|
||||
delivered uint64
|
||||
@@ -78,8 +78,8 @@ func TestAFetchOrAPublishMetAwayIsATransportFault(t *testing.T) {
|
||||
if prior == 0 && (s.State != sdkstep.StepAgain || len(delays) != 1 || delays[0] != 15*time.Second) {
|
||||
t.Errorf("the first run: step %+v, delays %v, want again after 15s", s, delays)
|
||||
}
|
||||
if prior == 1 && (s.State != sdkstep.StepAgain || s.Run != 2 || len(delays) != 1 || delays[0] != time.Minute) {
|
||||
t.Errorf("the second run, delivered %d times: step %+v, delays %v, want again in run 2 after 60s", run.delivered, s, delays)
|
||||
if prior == 1 && (s.State != sdkstep.StepAgain || s.Run != 2 || len(delays) != 1 || delays[0] != 90*time.Second) {
|
||||
t.Errorf("the second run, delivered %d times: step %+v, delays %v, want again in run 2 after 90s", run.delivered, s, delays)
|
||||
}
|
||||
if prior == 2 && (s.State != sdkstep.StepFailed || !strings.HasPrefix(s.Reason, tc.why)) {
|
||||
t.Errorf("the third run: step %+v, want failed with the why %q", s, tc.why)
|
||||
|
||||
@@ -569,7 +569,7 @@ func TestAPoisonedAskIsSaidAndRunNoMore(t *testing.T) {
|
||||
ackedOnly bool
|
||||
}{
|
||||
{"a transport fault in run 1", 1, &sdkstep.Passing{Err: errors.New("lookup proxy: i/o timeout")}, sdkstep.StepAgain, 15 * time.Second, true, false},
|
||||
{"a transport fault in run 2", 2, &sdkstep.Passing{Err: errors.New("lookup proxy: i/o timeout")}, sdkstep.StepAgain, time.Minute, true, false},
|
||||
{"a transport fault in run 2", 2, &sdkstep.Passing{Err: errors.New("lookup proxy: i/o timeout")}, sdkstep.StepAgain, 90 * time.Second, true, false},
|
||||
{"a transport fault in the last run", sdkstep.AskRuns, &sdkstep.Passing{Err: errors.New("lookup proxy: i/o timeout")}, sdkstep.StepFailed, 0, true, true},
|
||||
{"a compile error in run 1", 1, errors.New("undefined: x"), sdkstep.StepFailed, 0, false, true},
|
||||
} {
|
||||
|
||||
Reference in New Issue
Block a user