diff --git a/test/integration/embedded.go b/test/integration/embedded.go index 8cec02f95..41a8054f7 100644 --- a/test/integration/embedded.go +++ b/test/integration/embedded.go @@ -77,6 +77,13 @@ func startEmbedded(t testing.TB) func() { // the logs. t.Log("⚠️ PostgreSQL refuses to start as root; this will almost certainly not work ⚠️") } + if embedDB.Arch == "" { + t.Logf(`⚠️ unsupported platform "%s/%s"; see https://mvnrepository.com/artifact/io.zonky.test.postgres/embedded-postgres-binaries-bom`, + runtime.GOOS, runtime.GOARCH, + ) + t.Log("See the test/integration documentation for how to specify an external database.") + t.FailNow() + } return func() { pkgDB = &Engine{} if err := pkgDB.Start(t); err != nil { diff --git a/test/integration/fixup_linux.go b/test/integration/fixup_linux.go index 8894af429..e457c8959 100644 --- a/test/integration/fixup_linux.go +++ b/test/integration/fixup_linux.go @@ -1,17 +1,17 @@ package integration import ( - "fmt" "os" "runtime" "strings" "syscall" ) -// the zonkyio/embedded-postgres-binaries project produces -// arm binaries with the following name schema: -// 32bit: arm32v6 / arm32v7 -// 64bit (aarch64): arm64v8 +// The zonkyio/embedded-postgres-binaries project produces ARM binaries with the +// following name schema: +// +// - 32bit : arm32v6 / arm32v7 +// - 64bit (aarch64): arm64v8 func findArch() (arch string) { arch = runtime.GOARCH @@ -23,7 +23,10 @@ func findArch() (arch string) { case "arm": var u syscall.Utsname if err := syscall.Uname(&u); err != nil { - panic(err) + // Not sure why this would happen? Try to use the lowest revision + // and let it crash otherwise. + arch += "32v6" + break } t := make([]byte, 0, len(u.Machine[:])) for _, b := range u.Machine[:] { @@ -38,14 +41,15 @@ func findArch() (arch string) { arch += "32v7" case strings.HasPrefix(mach, "armv6"): arch += "32v6" + default: + return "" } case "ppc64le": // OK case "amd64": // OK default: - panic(fmt.Sprintf( - `unsupported platform "%s/%s"; see https://mvnrepository.com/artifact/io.zonky.test.postgres/embedded-postgres-binaries-bom`, - runtime.GOOS, runtime.GOARCH, - )) + // Will cause the [startEmbedded] function to print a warning and fail + // the test if the environment requires an embedded database. + return "" } // If on alpine: if _, err := os.Stat("/etc/alpine-release"); err == nil { diff --git a/test/integration/fixup_other.go b/test/integration/fixup_other.go index 8321a617c..f304051eb 100644 --- a/test/integration/fixup_other.go +++ b/test/integration/fixup_other.go @@ -3,7 +3,6 @@ package integration import ( - "fmt" "runtime" ) @@ -29,10 +28,9 @@ func findArch() (arch string) { default: } if !ok { - panic(fmt.Sprintf( - `unsupported platform "%s/%s"; see https://mvnrepository.com/artifact/io.zonky.test.postgres/embedded-postgres-binaries-bom`, - runtime.GOOS, runtime.GOARCH, - )) + // Will cause the [startEmbedded] function to print a warning and fail + // the test if the environment requires an embedded database. + return "" } return arch }