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

@ -5,6 +5,7 @@ import (
"bytes"
"context"
"crypto/rand"
"crypto/sha256"
"encoding/json"
"errors"
errors_package "errors"
@ -2342,7 +2343,7 @@ func (api *API) resolveOSTreeCommits(sourceSpecs map[string][]ostree.SourceSpec,
for idx, source := range sources {
var ref, checksum string
if test {
checksum = "02604b2da6e954bd34b8b82a835e5a77d2b60ffa"
checksum = fmt.Sprintf("%x", sha256.Sum256([]byte(source.URL+source.Ref)))
ref = source.Ref
} else {
var err error