package catalogue 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)) } }