Skip to content

Commit

Permalink
CloudAPI: test /sboms endpoint for Koji composes
Browse files Browse the repository at this point in the history
Extend the API unit test for Koji composes, to verify that the newly
added /sboms endpoint works correctly.

Signed-off-by: Tomáš Hozza <[email protected]>
  • Loading branch information
thozza committed Sep 20, 2024
1 parent cf79bf6 commit efc251f
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions internal/cloudapi/v2/v2_koji_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,44 @@ func TestKojiCompose(t *testing.T) {

// get the logs
test.TestRoute(t, handler, false, "GET", fmt.Sprintf("/api/image-builder-composer/v2/composes/%v/logs", finalizeID), ``, http.StatusOK, `{"kind":"ComposeLogs"}`, `koji`, `image_builds`, `href`, `id`)

// get the SBOMs
test.TestRoute(t, handler, false, "GET", fmt.Sprintf("/api/image-builder-composer/v2/composes/%v/sboms", finalizeID), ``, http.StatusOK, fmt.Sprintf(`
{
"href": "/api/image-builder-composer/v2/composes/%v/sboms",
"id": "%v",
"kind": "ComposeSBOMs",
"items": [
[
{
"pipeline_name": "build",
"pipeline_purpose": "buildroot",
"sbom": %[3]s,
"sbom_type": %[4]q
},
{
"pipeline_name": "os",
"pipeline_purpose": "image",
"sbom": %[3]s,
"sbom_type": %[4]q
}
],
[
{
"pipeline_name": "build",
"pipeline_purpose": "buildroot",
"sbom": %[3]s,
"sbom_type": %[4]q
},
{
"pipeline_name": "os",
"pipeline_purpose": "image",
"sbom": %[3]s,
"sbom_type": %[4]q
}
]
]
}`, finalizeID, finalizeID, sbomDoc, v2.ImageSBOMSbomTypeSpdx), "details")
})
}
}
Expand Down

0 comments on commit efc251f

Please sign in to comment.