Blame SOURCES/0001-tests-Fix-integration-tests.patch

1c27b5
From edeafc1b677eb0f362fdb60fbb624ad8e1632c21 Mon Sep 17 00:00:00 2001
1c27b5
From: "Brian C. Lane" <bcl@redhat.com>
1c27b5
Date: Wed, 25 Aug 2021 09:00:48 -0700
1c27b5
Subject: [PATCH] tests: Fix integration tests
1c27b5
1c27b5
osbuild-composer v31 returns a more detailed error for
1c27b5
TestStartComposeBadType, so that has been changed.
1c27b5
1c27b5
The number of image types returned depends on the distribution being
1c27b5
used, so change to looking for >= 6 of them.
1c27b5
1c27b5
The source type depends on the first repo in the list, so it could be
1c27b5
any of the supported types. They all start with "yum-" so change the
1c27b5
test to look for that instead.
1c27b5
---
1c27b5
 weldr/compose_test.go | 6 +++---
1c27b5
 weldr/sources_test.go | 3 ++-
1c27b5
 2 files changed, 5 insertions(+), 4 deletions(-)
1c27b5
1c27b5
diff --git a/weldr/compose_test.go b/weldr/compose_test.go
1c27b5
index 7479edf..fda6953 100644
1c27b5
--- a/weldr/compose_test.go
1c27b5
+++ b/weldr/compose_test.go
1c27b5
@@ -30,7 +30,7 @@ func TestGetComposeTypes(t *testing.T) {
1c27b5
 	require.Nil(t, err)
1c27b5
 	require.Nil(t, r)
1c27b5
 	require.NotNil(t, types)
1c27b5
-	assert.Equal(t, 6, len(types))
1c27b5
+	assert.GreaterOrEqual(t, len(types), 6)
1c27b5
 	assert.Contains(t, types, "openstack")
1c27b5
 }
1c27b5
 
1c27b5
@@ -44,7 +44,7 @@ func TestGetComposeTypesDistro(t *testing.T) {
1c27b5
 	require.Nil(t, err)
1c27b5
 	require.Nil(t, r)
1c27b5
 	require.NotNil(t, types)
1c27b5
-	assert.Equal(t, 6, len(types))
1c27b5
+	assert.GreaterOrEqual(t, len(types), 6)
1c27b5
 	assert.Contains(t, types, "openstack")
1c27b5
 }
1c27b5
 
1c27b5
@@ -141,7 +141,7 @@ func TestStartComposeBadType(t *testing.T) {
1c27b5
 	require.Nil(t, err)
1c27b5
 	require.NotNil(t, r)
1c27b5
 	assert.False(t, r.Status)
1c27b5
-	assert.Equal(t, APIErrorMsg{"UnknownComposeType", "Unknown compose type for architecture: punchcard"}, r.Errors[0])
1c27b5
+	assert.Equal(t, APIErrorMsg{"ComposeError", "Failed to get compose type \"punchcard\": invalid image type: punchcard"}, r.Errors[0])
1c27b5
 }
1c27b5
 
1c27b5
 func TestStartComposeBadDepsolve(t *testing.T) {
1c27b5
diff --git a/weldr/sources_test.go b/weldr/sources_test.go
1c27b5
index 77eb357..18b00f1 100644
1c27b5
--- a/weldr/sources_test.go
1c27b5
+++ b/weldr/sources_test.go
1c27b5
@@ -7,6 +7,7 @@
1c27b5
 package weldr
1c27b5
 
1c27b5
 import (
1c27b5
+	"strings"
1c27b5
 	"testing"
1c27b5
 
1c27b5
 	"github.com/stretchr/testify/assert"
1c27b5
@@ -40,7 +41,7 @@ func TestGetSourcesJSON(t *testing.T) {
1c27b5
 	assert.Equal(t, names[0], id)
1c27b5
 	sourceType, ok := sources[names[0]].(map[string]interface{})["type"].(string)
1c27b5
 	require.True(t, ok)
1c27b5
-	assert.Equal(t, "yum-metalink", sourceType)
1c27b5
+	assert.True(t, strings.HasPrefix(sourceType, "yum-"))
1c27b5
 }
1c27b5
 
1c27b5
 func TestGetSourcesJSONError(t *testing.T) {
1c27b5
-- 
1c27b5
2.31.1
1c27b5