Adapt tests to new test_distro
The new test_distro's manifest produces a slightly different empty manifest when serialized even without content. Cloud API and Koji tests have been adapted to match. Weldr tests have been updated in several ways: - The test_distro content resolver is used to resolve manifest content before serializing. - The test scenarios in TestCompose have been named for easier troubleshooting (easier to identify a failing test by name). - Manifests that work with the secondary ostree repo (the "other") use the appropriate URL and ref and create a secondary "other" serialized manifest. The weldr API's test flag for resolving ostree commits does not produce the same, fixed hash every time but instead computes a sha256 from the URL + ref, like we do in the test manifests.
This commit is contained in:
parent
aa4fa91214
commit
68ccc58706
6 changed files with 98 additions and 48 deletions
|
|
@ -323,6 +323,8 @@ func TestKojiCompose(t *testing.T) {
|
|||
},
|
||||
}
|
||||
|
||||
emptyManifest := `{"version":"2","pipelines":[{"name":"build"},{"name":"os"}],"sources":{"org.osbuild.curl":{"items":{"":{"url":""}}}}}`
|
||||
expectedManifests := `{"manifests":[` + emptyManifest + `,` + emptyManifest + `],"kind":"ComposeManifests"}`
|
||||
for idx, c := range cases {
|
||||
name, version, release := "foo", "1", "2"
|
||||
t.Run(fmt.Sprintf("Test case #%d", idx), func(t *testing.T) {
|
||||
|
|
@ -459,7 +461,7 @@ func TestKojiCompose(t *testing.T) {
|
|||
test.TestRoute(t, handler, false, "GET", fmt.Sprintf("/api/image-builder-composer/v2/composes/%v", finalizeID), ``, http.StatusOK, c.composeStatus, `href`, `id`)
|
||||
|
||||
// get the manifests
|
||||
test.TestRoute(t, handler, false, "GET", fmt.Sprintf("/api/image-builder-composer/v2/composes/%v/manifests", finalizeID), ``, http.StatusOK, `{"manifests":[{"version":"2","pipelines":[],"sources":{}},{"version":"2","pipelines":[],"sources":{}}],"kind":"ComposeManifests"}`, `href`, `id`)
|
||||
test.TestRoute(t, handler, false, "GET", fmt.Sprintf("/api/image-builder-composer/v2/composes/%v/manifests", finalizeID), ``, http.StatusOK, expectedManifests, `href`, `id`)
|
||||
|
||||
// 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`)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue