Drop common.CurrentArch() in favor of osbuild/images

Drop `common.CurrentArch()` implementation and use
`arch.Current().String()` from the osbuild/images instead.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
This commit is contained in:
Tomáš Hozza 2024-01-19 21:05:46 +01:00 committed by Achilleas Koutsou
parent c4e5ab5aca
commit 43e87632fb
11 changed files with 20 additions and 73 deletions

View file

@ -8,41 +8,6 @@ import (
"github.com/stretchr/testify/require"
)
func TestCurrentArchAMD64(t *testing.T) {
origRuntimeGOARCH := RuntimeGOARCH
defer func() { RuntimeGOARCH = origRuntimeGOARCH }()
RuntimeGOARCH = "amd64"
assert.Equal(t, "x86_64", CurrentArch())
}
func TestCurrentArchARM64(t *testing.T) {
origRuntimeGOARCH := RuntimeGOARCH
defer func() { RuntimeGOARCH = origRuntimeGOARCH }()
RuntimeGOARCH = "arm64"
assert.Equal(t, "aarch64", CurrentArch())
}
func TestCurrentArchPPC64LE(t *testing.T) {
origRuntimeGOARCH := RuntimeGOARCH
defer func() { RuntimeGOARCH = origRuntimeGOARCH }()
RuntimeGOARCH = "ppc64le"
assert.Equal(t, "ppc64le", CurrentArch())
}
func TestCurrentArchS390X(t *testing.T) {
origRuntimeGOARCH := RuntimeGOARCH
defer func() { RuntimeGOARCH = origRuntimeGOARCH }()
RuntimeGOARCH = "s390x"
assert.Equal(t, "s390x", CurrentArch())
}
func TestCurrentArchUnsupported(t *testing.T) {
origRuntimeGOARCH := RuntimeGOARCH
defer func() { RuntimeGOARCH = origRuntimeGOARCH }()
RuntimeGOARCH = "UKNOWN"
assert.PanicsWithValue(t, "unsupported architecture", func() { CurrentArch() })
}
func TestPanicOnError(t *testing.T) {
err := errors.New("Error message")
assert.PanicsWithValue(t, err, func() { PanicOnError(err) })