From eab16830aa472cd2e6afb7c2b5567587da9f25bc Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Wed, 13 Sep 2023 13:55:30 -0700 Subject: [PATCH] test: Add checksum to cloudapi tests These use 'pkg1' when depsolving, so they need an entry in the manifest with the mocked checksum: sha256:e50ddb78a37f5851d1a5c37a4c77d59123153c156e628e064b9daa378f45a2fe --- internal/cloudapi/v2/v2_koji_test.go | 2 +- internal/cloudapi/v2/v2_test.go | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/internal/cloudapi/v2/v2_koji_test.go b/internal/cloudapi/v2/v2_koji_test.go index 27d638190..69d5ce31c 100644 --- a/internal/cloudapi/v2/v2_koji_test.go +++ b/internal/cloudapi/v2/v2_koji_test.go @@ -323,7 +323,7 @@ func TestKojiCompose(t *testing.T) { }, } - emptyManifest := `{"version":"2","pipelines":[{"name":"build"},{"name":"os"}],"sources":{"org.osbuild.curl":{"items":{"":{"url":""}}}}}` + emptyManifest := `{"version":"2","pipelines":[{"name":"build"},{"name":"os"}],"sources":{"org.osbuild.curl":{"items":{"sha256:e50ddb78a37f5851d1a5c37a4c77d59123153c156e628e064b9daa378f45a2fe":{"url":""}}}}}` expectedManifests := `{"manifests":[` + emptyManifest + `,` + emptyManifest + `],"kind":"ComposeManifests"}` for idx, c := range cases { name, version, release := "foo", "1", "2" diff --git a/internal/cloudapi/v2/v2_test.go b/internal/cloudapi/v2/v2_test.go index e8412eaa0..149232f4d 100644 --- a/internal/cloudapi/v2/v2_test.go +++ b/internal/cloudapi/v2/v2_test.go @@ -59,9 +59,12 @@ func newV2Server(t *testing.T, dir string, depsolveChannels []string, enableJWT continue } dJR := &worker.DepsolveJobResult{ - PackageSpecs: map[string][]rpmmd.PackageSpec{"build": {{Name: "pkg1"}}}, - Error: "", - ErrorType: worker.ErrorType(""), + PackageSpecs: map[string][]rpmmd.PackageSpec{"build": {{ + Name: "pkg1", + Checksum: "sha256:e50ddb78a37f5851d1a5c37a4c77d59123153c156e628e064b9daa378f45a2fe", + }}}, + Error: "", + ErrorType: worker.ErrorType(""), } if failDepsolve { @@ -585,7 +588,7 @@ func TestComposeStatusSuccess(t *testing.T) { ] }`, jobId, jobId)) - emptyManifest := `{"version":"2","pipelines":[{"name":"build"},{"name":"os"}],"sources":{"org.osbuild.curl":{"items":{"":{"url":""}}}}}` + emptyManifest := `{"version":"2","pipelines":[{"name":"build"},{"name":"os"}],"sources":{"org.osbuild.curl":{"items":{"sha256:e50ddb78a37f5851d1a5c37a4c77d59123153c156e628e064b9daa378f45a2fe":{"url":""}}}}}` test.TestRoute(t, srv.Handler("/api/image-builder-composer/v2"), false, "GET", fmt.Sprintf("/api/image-builder-composer/v2/composes/%v/manifests", jobId), ``, http.StatusOK, fmt.Sprintf(` { "href": "/api/image-builder-composer/v2/composes/%v/manifests",