Only set URL for ostree image options in tests

In tests (and dev tools) that apply to all image types, set just the
ostree URL instead of all the options.

The default ref is handled by the image functions when needed, so it
doesn't need to be set from the caller.
This commit is contained in:
Achilleas Koutsou 2023-06-01 14:47:55 +02:00 committed by Ondřej Budai
parent 966aec464a
commit 7d1ee88700
6 changed files with 6 additions and 33 deletions

View file

@ -56,9 +56,7 @@ func TestImageType_PackageSetsChains(t *testing.T) {
}
options := distro.ImageOptions{
OSTree: &ostree.ImageOptions{
URL: "foo",
ImageRef: "bar",
ParentRef: "baz",
URL: "https://example.com", // required by some image types
},
}
manifest, _, err := imageType.Manifest(&bp, options, nil, 0)
@ -147,9 +145,7 @@ func TestImageTypePipelineNames(t *testing.T) {
// Add ostree options for image types that require them
options.OSTree = &ostree.ImageOptions{
ImageRef: imageType.OSTreeRef(),
URL: "https://example.com/repo",
ParentRef: "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
URL: "https://example.com",
}
// Pipelines that require package sets will fail if none
@ -461,9 +457,7 @@ func TestPipelineRepositories(t *testing.T) {
// Add ostree options for image types that require them
options.OSTree = &ostree.ImageOptions{
ImageRef: imageType.OSTreeRef(),
URL: "https://example.com/repo",
ParentRef: "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
URL: "https://example.com",
}
repos := tCase.repos

View file

@ -112,11 +112,6 @@ func TestDistro_Manifest(t *testing.T, pipelinePath string, prefix string, regis
}
}
}
if ostreeOptions == nil { // set image type default if not specified in request
ostreeOptions = &ostree.ImageOptions{
ImageRef: imageType.OSTreeRef(),
}
}
options := distro.ImageOptions{
Size: imageType.Size(0),
@ -217,9 +212,7 @@ var knownKernels = []string{"kernel", "kernel-debug", "kernel-rt"}
// Returns the number of known kernels in the package list
func kernelCount(imgType distro.ImageType, bp blueprint.Blueprint) int {
ostreeOptions := &ostree.ImageOptions{
URL: "foo",
ImageRef: "bar",
ParentRef: "baz",
URL: "https://example.com", // required by some image types
}
manifest, _, err := imgType.Manifest(&bp, distro.ImageOptions{OSTree: ostreeOptions}, nil, 0)
if err != nil {