From 401f832cc8d5078d199818bd0c7f718bc510f4df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Budai?= Date: Thu, 24 Apr 2025 23:34:25 +0200 Subject: [PATCH] client: adjust the tests to new image type names in Fedora See the comment inline. --- internal/client/integration_test.go | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/internal/client/integration_test.go b/internal/client/integration_test.go index f5d92e950..58636625d 100644 --- a/internal/client/integration_test.go +++ b/internal/client/integration_test.go @@ -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)