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:
Achilleas Koutsou 2023-06-02 17:24:05 +02:00 committed by Ondřej Budai
parent aa4fa91214
commit 68ccc58706
6 changed files with 98 additions and 48 deletions

View file

@ -145,9 +145,10 @@ func TestCreate(t *testing.T) {
_, err = server.EnqueueOSBuild(arch.Name(), &worker.OSBuildJob{Manifest: mf}, "")
require.NoError(t, err)
emptyManifest := `{"version":"2","pipelines":[{"name":"build"},{"name":"os"}],"sources":{}}`
test.TestRoute(t, handler, false, "POST", "/api/worker/v1/jobs",
fmt.Sprintf(`{"types":["%s"],"arch":"%s"}`, worker.JobTypeOSBuild, test_distro.TestArchName), http.StatusCreated,
fmt.Sprintf(`{"kind":"RequestJob","href":"/api/worker/v1/jobs","type":"%s","args":{"manifest":{"version":"2","pipelines":[],"sources":{}}}}`, worker.JobTypeOSBuild), "id", "location", "artifact_location")
fmt.Sprintf(`{"kind":"RequestJob","href":"/api/worker/v1/jobs","type":"%s","args":{"manifest":`+emptyManifest+`}}`, worker.JobTypeOSBuild), "id", "location", "artifact_location")
}
func TestCancel(t *testing.T) {