The three tests of the controller's own module.json (process, claimed seat, addresses), the Dockerfile and Makefile pin test, the build-agent registry test and the manifest-in-use seat test move with their old package, as tests of mesh-sdk's exported API; a moved test is exempt from failing first.
30 lines
1.1 KiB
Go
30 lines
1.1 KiB
Go
package ownmanifest
|
|
|
|
import (
|
|
"os"
|
|
"regexp"
|
|
"testing"
|
|
)
|
|
|
|
// novox/hq issue 223: genesis raises the controller as a container built from this repository's own
|
|
// Dockerfile, with no build arguments — the manifest no longer builds an image, so nothing passes a
|
|
// base in. The Dockerfile's own default must therefore be a Go that builds this module, pinned by
|
|
// digest, and the replacement the manifest's process names must be the container genesis raises.
|
|
func TestGenesisCanBuildTheControllersImageAsItStands(t *testing.T) {
|
|
raw, err := os.ReadFile("../../Dockerfile")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if !regexp.MustCompile(`(?m)^ARG GO_BASE=golang@sha256:[0-9a-f]{64}$`).Match(raw) {
|
|
t.Fatal("the Dockerfile's default Go base is not pinned by digest; genesis builds it with no arguments")
|
|
}
|
|
makefile, err := os.ReadFile("../../Makefile")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
pin := regexp.MustCompile(`golang@sha256:[0-9a-f]{64}`)
|
|
if string(pin.Find(raw)) != string(pin.Find(makefile)) {
|
|
t.Errorf("the Dockerfile and the Makefile build on different Go: %s, %s", pin.Find(raw), pin.Find(makefile))
|
|
}
|
|
}
|