package main import ( "testing" "time" "github.com/novox/mesh-controller/internal/broker" "github.com/novox/mesh-controller/internal/link" ) // consoleWaits is how long the console waits for an answer (mesh-tools node-tools/internal/bus // RequestTimeout) — the shortest wait of a caller the mesh ships. const consoleWaits = 30 * time.Second // **A call's one answer is never later than its caller or the bus allow** (novox/hq issue 265): a // holder answers within AnswerWithin, which must be inside both the console's wait and the window the // bus gives an answer. Before, the console waited 30s, the bus 60s, and a push ran as long as it ran. func TestAVerbAnswersInsideEveryWaitOnIt(t *testing.T) { if link.AnswerWithin >= consoleWaits/2 { t.Errorf("a call answers within %s: not well inside the console's %s", link.AnswerWithin, consoleWaits) } if link.AnswerWithin >= broker.ResponseTTL { t.Errorf("a call answers within %s, after the bus stops permitting an answer at %s", link.AnswerWithin, broker.ResponseTTL) } } // `calls` is served, takes a call's id and nothing else, and says plainly when it holds no such call.