mesh-sdk holds no go/asks, go/asker, vault answers or compose-candidate types (A1d, J1): each module now names the operator-channel contract and client, the channel benches (mesh-sdk/go/channel), mesh-vault's contract, and node-engine's contract and client (a1-progress.md, the A1d and J1 rewrite maps). - assigner, teller, view: delivery.Ask.Ask and AssignerAsk.Ask are the router's ask as JSON; the refusals mesh-sdk dropped (an id other than AskingID(key, asking), no option) are each reader's and writer's: assign.EncodeAsk/DecodeAsk (askjson.go), the teller's routerAskOf (teller.go) and the view's routerAsk (view.go); the teller refuses an option the asking does not offer and one whose level is not acknowledge (viewanswers.go), the two refusals ViewAnswerFits gave. Row: subtest of TestTheHoldAskIsValid (another id, no option, no ask; each written before). - enrolment, grants: the vault's verbs and answers from meshvault; asks' conditions from the contract and client. - checker, assigner's judge: compose-candidate from nodeengine/nodeengineclient (nec.Own for "node"). - mesh-grants' user-lists golden: the node-engine's users now subscribe to mesh-delivery-view's settled (mesh-sdk's NodeAgentHears, A7's ENG-8 retry). go.mod: each module requires the mesh-contracts modules it imports (and nodeengineclient, which mesh-sdk imports) at the zero version, for the group pin. Claude-Session: https://claude.ai/code/session_01JG73KJNrH5EgFXMKKYSrig
54 lines
2.0 KiB
Go
54 lines
2.0 KiB
Go
package main
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"testing"
|
|
"time"
|
|
|
|
nec "git.novox.be/novox/mesh-contracts/go/clients/nodeengineclient"
|
|
"git.novox.be/novox/mesh-sdk/go/process"
|
|
|
|
"mesh-delivery-checker/internal/check"
|
|
)
|
|
|
|
// ADR 0593 §7: the answer bound is the checker's setting compose-answer-bound, 60 s when the file or the value is
|
|
// absent; a value that is no whole number of seconds from 1 to 600 stops the start, naming it. ADR 0603 §10: the wait for
|
|
// the candidate's builds is build-wait-bound, 30 minutes when absent, from 60 to 7200 seconds.
|
|
func TestTheAnswerBoundIsTheCheckersSetting(t *testing.T) {
|
|
dir := t.TempDir()
|
|
for _, row := range []struct {
|
|
body string
|
|
want time.Duration
|
|
err bool
|
|
buildWait time.Duration
|
|
}{{"", nec.AnswerBound, false, check.DefaultBuildWait}, {`{}`, nec.AnswerBound, false, check.DefaultBuildWait},
|
|
{`{"compose-answer-bound": 90}`, 90 * time.Second, false, check.DefaultBuildWait}, {`{"compose-answer-bound": 0}`, 0, true, 0},
|
|
{`{"compose-answer-bound": 1.5}`, 0, true, 0},
|
|
{`{"compose-answer-bound": 60, "build-wait-bound": 600}`, 60 * time.Second, false, 10 * time.Minute},
|
|
{`{"build-wait-bound": 30}`, 0, true, 0}} {
|
|
path := filepath.Join(dir, "settings.json")
|
|
os.Remove(path)
|
|
if row.body != "" {
|
|
if err := os.WriteFile(path, []byte(row.body), 0o600); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
set, err := readSettings(path)
|
|
got := set.answer
|
|
if (err != nil) != row.err || got != row.want || set.buildWait != row.buildWait {
|
|
t.Errorf("%q: %s, %s, %v", row.body, got, set.buildWait, err)
|
|
}
|
|
// Issue 1126: the SDK's call gives up at CallTimeout (30 s), so the checker's calls must wait the bound read
|
|
// (an answer at 31 s is heard under 60 s), and the bound never shortens the SDK's own.
|
|
if err == nil {
|
|
was := process.CallTimeout
|
|
holdCallsFor(got)
|
|
if process.CallTimeout < got || process.CallTimeout < was {
|
|
t.Errorf("%q: calls wait %v under bound %v", row.body, process.CallTimeout, got)
|
|
}
|
|
process.CallTimeout = was
|
|
}
|
|
}
|
|
}
|