Files
mesh-controller/internal/builder/check_pin_test.go
T

27 lines
1013 B
Go

package builder
import (
"os"
"path/filepath"
"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)
}
}