client: adjust the tests to new image type names in Fedora

See the comment inline.
This commit is contained in:
Ondřej Budai 2025-04-24 23:34:25 +02:00 committed by Tomáš Hozza
parent 242564cc5c
commit 401f832cc8

View file

@ -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)