mesh-delivery is over its budget (810 unit, 73 integration on main), so this branch adds none net: its new cases are subtests, the three work-queue process tests and the consumes test become one, the history stream bounds join the stream values table, and the go/-only mesh-sdk merge check joins the one new integration test. buildrun's 20 unit and 1 integration tests moved in from mesh-sdk with it. Claude-Session: https://claude.ai/code/session_01NcbgfJ9Gum47zkFKWRaovL
37 lines
1.3 KiB
Go
37 lines
1.3 KiB
Go
package build
|
|
|
|
import (
|
|
"encoding/json"
|
|
"strings"
|
|
"sync"
|
|
"testing"
|
|
|
|
"git.novox.be/novox/mesh-sdk/go/delivery"
|
|
)
|
|
|
|
// ADR 0593 §2 (F3): the imports a Go build module answers at a build's end reach the done key and the log's end entry,
|
|
// where the indexer keeps them on the module.
|
|
func importsABuildAnswersReachTheDoneKeyAndTheLog(t *testing.T) {
|
|
r := newRig(t, goBundle)
|
|
imports := []string{"git.novox.be/novox/mesh-sdk/go", "git.novox.be/novox/mesh-sdk/go/announce"}
|
|
r.asks.Answer = func(a delivery.StepAsk) delivery.Step {
|
|
step := r.answer(a)
|
|
var answer map[string]any
|
|
if err := json.Unmarshal(step.Result, &answer); err == nil && a.Language == "go" {
|
|
answer["imports"] = imports
|
|
step.Result, _ = json.Marshal(answer)
|
|
}
|
|
return step
|
|
}
|
|
var logged []delivery.BuildLogEntry
|
|
var mu sync.Mutex
|
|
r.b.Node, r.b.Log = "novox", func(e delivery.BuildLogEntry) { mu.Lock(); logged = append(logged, e); mu.Unlock() }
|
|
v := r.consider(t, "modules/m")
|
|
if v.State != delivery.BuildDone || strings.Join(v.Imports, ",") != strings.Join(imports, ",") {
|
|
t.Fatalf("done key %+v, want the imports", v)
|
|
}
|
|
if len(logged) != 2 || strings.Join(logged[1].Imports, ",") != strings.Join(imports, ",") || len(logged[0].Imports) != 0 {
|
|
t.Fatalf("log %+v, want the imports on the end alone", logged)
|
|
}
|
|
}
|