This extract what was in registry_test.go and registry_mock_test.go. This also move `RegistryHosting` requirement to `registry.Hosting` Signed-off-by: Vincent Demeester <vincent@sbr.pm> Upstream-commit: 4300e5e8818571a55e00d9987bec3ad6ca92dc6f Component: engine
13 lines
344 B
Go
13 lines
344 B
Go
package registry
|
|
|
|
import "os/exec"
|
|
|
|
// Hosting returns wether the host can host a registry (v2) or not
|
|
func Hosting() bool {
|
|
// for now registry binary is built only if we're running inside
|
|
// container through `make test`. Figure that out by testing if
|
|
// registry binary is in PATH.
|
|
_, err := exec.LookPath(v2binary)
|
|
return err == nil
|
|
}
|