Skip to content

Commit

Permalink
test: Add checksum to cloudapi tests
Browse files Browse the repository at this point in the history
These use 'pkg1' when depsolving, so they need an entry in the manifest
with the mocked checksum:

sha256:e50ddb78a37f5851d1a5c37a4c77d59123153c156e628e064b9daa378f45a2fe
  • Loading branch information
bcl committed Sep 13, 2023
1 parent 92cf885 commit 5cff870
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion internal/cloudapi/v2/v2_koji_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
11 changes: 7 additions & 4 deletions internal/cloudapi/v2/v2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 5cff870

Please sign in to comment.