distro/Manifest: generalize the size argument

When generating an osbuild manifest for an image type, we take a
customizations struct, which specifies the image-type-independent
customizations to apply. We also take the size argument, which is
specific to the image build and not part of the blueprint.

Introduce a new argument ImageOptions, which for now just wraps the size
argument. These options are specific to the image build/type, and
therefore does not belong with the other customizations.

For now this is a non-functional change, but follow-up commits will
introduce more types of image options.

Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
Tom Gundersen 2020-05-21 21:37:10 +02:00
parent a544fa7eb6
commit 0b3702cb19
12 changed files with 61 additions and 36 deletions

View file

@ -7,6 +7,7 @@ import (
"github.com/google/uuid"
"github.com/stretchr/testify/require"
"github.com/osbuild/osbuild-composer/internal/distro"
"github.com/osbuild/osbuild-composer/internal/distro/fedoratest"
"github.com/osbuild/osbuild-composer/internal/jobqueue/testjobqueue"
"github.com/osbuild/osbuild-composer/internal/test"
@ -52,7 +53,7 @@ func TestCreate(t *testing.T) {
}
server := worker.NewServer(nil, testjobqueue.New(), nil)
manifest, err := imageType.Manifest(nil, nil, nil, nil, imageType.Size(0))
manifest, err := imageType.Manifest(nil, distro.ImageOptions{Size: imageType.Size(0)}, nil, nil, nil)
if err != nil {
t.Fatalf("error creating osbuild manifest")
}
@ -78,7 +79,7 @@ func testUpdateTransition(t *testing.T, from, to string, expectedStatus int) {
id := uuid.Nil
if from != "VOID" {
manifest, err := imageType.Manifest(nil, nil, nil, nil, imageType.Size(0))
manifest, err := imageType.Manifest(nil, distro.ImageOptions{Size: imageType.Size(0)}, nil, nil, nil)
if err != nil {
t.Fatalf("error creating osbuild manifest")
}