Wait out a forge not served for a moment when registering a build (novox/hq issue 486)
A registration asked the forge while node-tools re-served after a tool-runner rollout, heard "nothing serves gitea.gitea_api", and failed a good build's plan. The bus's not-served answer is now link.ErrNothingServes (and a timeout link.ErrNoAnswer), and the registration asks again for up to 90 s on those alone, never on a refusal; past the bound it fails saying how long it waited.
This commit is contained in:
@@ -3,6 +3,7 @@ package link
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
@@ -115,6 +116,15 @@ func TestAskingAToolNobodyServesFailsAtOnce(t *testing.T) {
|
||||
if !strings.Contains(err.Error(), "nothing serves") {
|
||||
t.Errorf("the refusal does not say nobody is there: %v", err)
|
||||
}
|
||||
// And it is ErrNothingServes, through Ask too, so an asker can wait out a tool runner re-serving and
|
||||
// never a refusal (novox/hq issue 486).
|
||||
if !errors.Is(err, ErrNothingServes) {
|
||||
t.Errorf("nothing serving the tool is not ErrNothingServes: %v", err)
|
||||
}
|
||||
if _, err := Ask(context.Background(), bus, "nobody", "home", nil, 30*time.Second); !errors.Is(err, ErrNothingServes) ||
|
||||
!strings.Contains(err.Error(), "nothing serves nobody.home") {
|
||||
t.Errorf("Ask does not say ErrNothingServes in its words: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// And a served tool answers, with no reply queue to declare and no correlation to check.
|
||||
|
||||
Reference in New Issue
Block a user