mesh/merge-gate head 8a330afd44ba merged into trunk 6c2a8d62100c — pass: builds build-agent, mesh-controller, route-proxy → ace, g14, novox, shanks; no bus…
mesh/repo-check head 8a330afd44ba merged into trunk 6c2a8d62100c — pass: its merge-check.sh passed
mesh/delivery delivered
46 lines
1.8 KiB
Go
46 lines
1.8 KiB
Go
package builder
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
// Issue 1391, AC5: what a check says names the validator as mesh-sdk's at the controller's pin, with the version from the
|
|
// judge's own go.mod.
|
|
func TestTheValidatorIsNamedAsMeshSDKsAtTheControllersPin(t *testing.T) {
|
|
dir := t.TempDir()
|
|
mod := "module example.test/c\n\ngo 1.25\n\nrequire (\n\tgit.novox.be/novox/mesh-sdk/go v0.1.14-0.20261020085642-ab0c16ddad26\n)\n"
|
|
if err := os.WriteFile(filepath.Join(dir, "go.mod"), []byte(mod), 0o644); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if got, want := validatorAt(dir), "mesh-sdk's validator at v0.1.14-0.20261020085642-ab0c16ddad26"; got != want {
|
|
t.Fatalf("the check says %q, not %q", got, want)
|
|
}
|
|
if got, want := pinNote(dir), " (v0.1.14-0.20261020085642-ab0c16ddad26)"; got != want {
|
|
t.Fatalf("the pin note is %q, not %q", got, want)
|
|
}
|
|
if got := validatorAt(t.TempDir()); got != "mesh-sdk's validator at the controller's pin" {
|
|
t.Fatalf("a controller with no go.mod is said as %q", got)
|
|
}
|
|
|
|
// A placeholder or a replaced pin is no version: it is said as a local mesh-sdk.
|
|
for name, mod := range map[string]string{
|
|
"placeholder": "module example.test/c\n\nrequire git.novox.be/novox/mesh-sdk/go v0.0.0\n",
|
|
"replaced": "module example.test/c\n\nrequire git.novox.be/novox/mesh-sdk/go v0.1.14\n\n" +
|
|
"replace git.novox.be/novox/mesh-sdk/go => ../mesh-sdk/go\n",
|
|
} {
|
|
d := t.TempDir()
|
|
if err := os.WriteFile(filepath.Join(d, "go.mod"), []byte(mod), 0o644); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if got := validatorAt(d); !strings.Contains(got, "a local mesh-sdk") || !strings.Contains(got, "replaced") {
|
|
t.Fatalf("%s: the check says %q, which does not say the mesh-sdk is local", name, got)
|
|
}
|
|
if got := pinNote(d); !strings.HasPrefix(got, " (a local mesh-sdk, v") {
|
|
t.Fatalf("%s: the pin note is %q", name, got)
|
|
}
|
|
}
|
|
}
|