- gating: Add gating tests

Resolves: rhbz#1996788
- gating: Workaround to install latest packages
- Fix integration tests
This commit is contained in:
Brian C. Lane 2021-08-25 09:41:00 -07:00
parent 7884656f4a
commit 9bb98db89d
2 changed files with 83 additions and 1 deletions

View File

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

View File

@ -7,7 +7,7 @@
Name: weldr-client
Version: 35.2
Release: 1%{?dist}
Release: 2%{?dist}
# Upstream license specification: Apache-2.0
License: ASL 2.0
Summary: Command line utility to control osbuild-composer
@ -18,6 +18,8 @@ Source1: https://github.com/osbuild/weldr-client/releases/download/v%{version}
Source2: https://keys.openpgp.org/vks/v1/by-fingerprint/117E8C168EFE3A7F#/gpg-117E8C168EFE3A7F.key
%endif
Patch0001: 0001-tests-Fix-integration-tests.patch
Obsoletes: composer-cli < 35.0
Provides: composer-cli = %{version}-%{release}
@ -127,6 +129,12 @@ composer-cli package.
%changelog
* Wed Aug 25 2021 Brian C. Lane <bcl@redhat.com> - 35.2-2
- gating: Add gating tests
Resolves: rhbz#1996788
- gating: Workaround to install latest packages
- Fix integration tests
* Mon Aug 23 2021 Brian C. Lane <bcl@redhat.com> - 35.2-1
- New release: 35.2 (bcl)
Resolves: rhbz#1996762