tests: add coverage for common/helpers.go

This also changes the helpers.go to enable mocking all the different architectures.
This commit is contained in:
Jakub Rusz 2020-03-31 16:19:34 +02:00 committed by Ondřej Budai
parent 09109b4f8e
commit 1cf2af10d0
2 changed files with 53 additions and 4 deletions

View file

@ -2,14 +2,16 @@ package common
import "runtime"
var RuntimeGOARCH = runtime.GOARCH
func CurrentArch() string {
if runtime.GOARCH == "amd64" {
if RuntimeGOARCH == "amd64" {
return "x86_64"
} else if runtime.GOARCH == "arm64" {
} else if RuntimeGOARCH == "arm64" {
return "aarch64"
} else if runtime.GOARCH == "ppc64le" {
} else if RuntimeGOARCH == "ppc64le" {
return "ppc64le"
} else if runtime.GOARCH == "s390x" {
} else if RuntimeGOARCH == "s390x" {
return "s390x"
} else {
panic("unsupported architecture")