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