buildrun leaves mesh-sdk for the builder's own Go module (ADR 0593 §1); the checker, assigner, indexer and watchman require it by a replace to the sibling directory. Issue 1930's bound was already on mesh-sdk's main and moves with it. The builder copies the imports a build module answers to the done key and the log's end entry, where the indexer keeps them (§2; D7). Claude-Session: https://claude.ai/code/session_01NcbgfJ9Gum47zkFKWRaovL
50 lines
1.7 KiB
Go
50 lines
1.7 KiB
Go
package buildrun
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
|
|
"git.novox.be/novox/mesh-sdk/go/delivery"
|
|
)
|
|
|
|
func tcValue(t *testing.T, language, version string) []byte {
|
|
t.Helper()
|
|
b, err := delivery.EncodeToolchain(delivery.Toolchain{Language: language, Version: version, Recipe: "1", At: time.Now()})
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
return b
|
|
}
|
|
|
|
func TestToolchainSetKeepsEachNodesEntryByLanguageAndSaysWhenOneChanged(t *testing.T) { // 1607/AC6
|
|
var s ToolchainSet
|
|
if !s.Put(GoBuildModule, "novox.go", tcValue(t, "go", "go1.27.1"), false) {
|
|
t.Error("a first entry did not count as a change")
|
|
}
|
|
if s.Put(GoBuildModule, "novox.go", tcValue(t, "go", "go1.27.1"), false) {
|
|
t.Error("the same entry again counted as a change")
|
|
}
|
|
s.Put(GoBuildModule, "ace.go", tcValue(t, "go", "go1.27.1"), false)
|
|
s.Put(NodeBuildModule, "ace.typescript", tcValue(t, "typescript", "tsc5"), false)
|
|
if got := s.Entries("go"); len(got) != 2 {
|
|
t.Errorf("go entries = %+v, want two", got)
|
|
}
|
|
if got := s.Entries("typescript"); len(got) != 1 || got[0].Node != "ace" || got[0].Version != "tsc5" {
|
|
t.Errorf("typescript entries = %+v", got)
|
|
}
|
|
if !s.Put(GoBuildModule, "ace.go", nil, true) || len(s.Entries("go")) != 1 {
|
|
t.Error("a delete did not remove the node's entry")
|
|
}
|
|
// What is not a toolchain of the module's language is left out.
|
|
s = ToolchainSet{}
|
|
if s.Put(GoBuildModule, "novox.typescript", tcValue(t, "typescript", "x"), false) {
|
|
t.Error("a typescript toolchain in the go build module's bucket counted")
|
|
}
|
|
if s.Put(GoBuildModule, "novox.go", []byte("not json"), false) || s.Put("other-module", "novox.go", tcValue(t, "go", "x"), false) {
|
|
t.Error("garbage or an unknown module counted")
|
|
}
|
|
if len(s.Entries("go")) != 0 {
|
|
t.Error("an entry was kept")
|
|
}
|
|
}
|