client: adjust the tests to new image type names in Fedora
See the comment inline.
This commit is contained in:
parent
242564cc5c
commit
401f832cc8
1 changed files with 17 additions and 1 deletions
|
|
@ -8,8 +8,10 @@ package client
|
|||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/osbuild/images/pkg/distro"
|
||||
"github.com/osbuild/osbuild-composer/internal/test"
|
||||
)
|
||||
|
||||
|
|
@ -21,7 +23,21 @@ var testState *TestState
|
|||
func executeTests(m *testing.M) int {
|
||||
var err error
|
||||
|
||||
testState, err = setUpTestState("/run/weldr/api.socket", "qcow2", false)
|
||||
imageType := "qcow2"
|
||||
|
||||
// Fedora now only defines qcow2 as an alias, which break some checks
|
||||
// (e.g. aliases aren't returned when listing image types), so we need to
|
||||
// use the real image type name.
|
||||
distroName, err := distro.GetHostDistroName()
|
||||
if err != nil {
|
||||
fmt.Printf("ERROR: Failed to get distro name: %s\n", err)
|
||||
panic(err)
|
||||
}
|
||||
if strings.HasPrefix(distroName, "fedora") {
|
||||
imageType = "server-qcow2"
|
||||
}
|
||||
|
||||
testState, err = setUpTestState("/run/weldr/api.socket", imageType, false)
|
||||
if err != nil {
|
||||
fmt.Printf("ERROR: Test setup failed: %s\n", err)
|
||||
panic(err)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue