|
|
4c6c7a |
From b1d63edcd830a5a23eaa838f536769681db24acb Mon Sep 17 00:00:00 2001
|
|
|
4c6c7a |
From: "Brian C. Lane" <bcl@redhat.com>
|
|
|
4c6c7a |
Date: Tue, 14 Jun 2022 13:43:45 -0700
|
|
|
4c6c7a |
Subject: [PATCH] tests: Update tests for osbuild-composer changes
|
|
|
4c6c7a |
|
|
|
4c6c7a |
Cancel when the build is in the wrong state now returns a proper error,
|
|
|
4c6c7a |
and ostree composes now accept the refid, parent, and the url without
|
|
|
4c6c7a |
returning an error.
|
|
|
4c6c7a |
---
|
|
|
4c6c7a |
weldr/compose_test.go | 12 +++++-------
|
|
|
4c6c7a |
1 file changed, 5 insertions(+), 7 deletions(-)
|
|
|
4c6c7a |
|
|
|
4c6c7a |
diff --git a/weldr/compose_test.go b/weldr/compose_test.go
|
|
|
4c6c7a |
index f937510..fb2fa42 100644
|
|
|
4c6c7a |
--- a/weldr/compose_test.go
|
|
|
4c6c7a |
+++ b/weldr/compose_test.go
|
|
|
4c6c7a |
@@ -97,14 +97,12 @@ func TestStartOSTreeComposeUrl(t *testing.T) {
|
|
|
4c6c7a |
assert.Greater(t, len(id), 0)
|
|
|
4c6c7a |
}
|
|
|
4c6c7a |
|
|
|
4c6c7a |
-func TestStartOSTreeComposeUrlError(t *testing.T) {
|
|
|
4c6c7a |
- // Sending both the parent url and the parent id should return an error
|
|
|
4c6c7a |
+func TestStartOSTreeUrlParentError(t *testing.T) {
|
|
|
4c6c7a |
+ // Sending both the parent url and the parent id is now allowed
|
|
|
4c6c7a |
id, r, err := testState.client.StartOSTreeComposeTest("cli-test-bp-1", "qcow2", "refid", "parent", "http://weldr.io", 0, 2)
|
|
|
4c6c7a |
require.Nil(t, err)
|
|
|
4c6c7a |
- require.NotNil(t, r)
|
|
|
4c6c7a |
- assert.False(t, r.Status)
|
|
|
4c6c7a |
- assert.Equal(t, APIErrorMsg{"OSTreeOptionsError", "Supply at most one of Parent and URL"}, r.Errors[0])
|
|
|
4c6c7a |
- assert.Equal(t, len(id), 0)
|
|
|
4c6c7a |
+ require.Nil(t, r)
|
|
|
4c6c7a |
+ assert.Greater(t, len(id), 0)
|
|
|
4c6c7a |
}
|
|
|
4c6c7a |
|
|
|
4c6c7a |
func TestStartOSTreeComposeUpload(t *testing.T) {
|
|
|
4c6c7a |
@@ -196,7 +194,7 @@ func TestCancelFinishedCompose(t *testing.T) {
|
|
|
4c6c7a |
require.NotNil(t, status)
|
|
|
4c6c7a |
assert.False(t, status.Status)
|
|
|
4c6c7a |
require.GreaterOrEqual(t, len(r), 1)
|
|
|
4c6c7a |
- assert.Equal(t, APIErrorMsg{"InternalServerError", "Internal server error: job does not exist"}, r[0])
|
|
|
4c6c7a |
+ assert.Equal(t, APIErrorMsg{"BuildInWrongState", fmt.Sprintf("Build %s is not in WAITING or RUNNING.", id)}, r[0])
|
|
|
4c6c7a |
}
|
|
|
4c6c7a |
|
|
|
4c6c7a |
func TestCancelComposeUnknown(t *testing.T) {
|
|
|
4c6c7a |
--
|
|
|
4c6c7a |
2.37.1
|
|
|
4c6c7a |
|