store: make PushCompose() take a manifest

Code that's calling PushCompose() had to depsolve packages and fetch the
right ImageType from a distro, but not create the osbuild manifest. That
was left for PushCompose to do. Move it out of there to the callers, so
that the store is mainly concerned with storing things.

This also simplifies the argument list of PushCompose().
This commit is contained in:
Lars Karlitski 2020-04-17 19:22:09 +02:00 committed by Tom Gundersen
parent 2b7adb3200
commit 37b42d452b
4 changed files with 46 additions and 22 deletions

View file

@ -53,7 +53,12 @@ func TestCreate(t *testing.T) {
store := store.New(nil)
server := worker.NewServer(nil, store)
id, err := store.PushCompose(imageType, &blueprint.Blueprint{}, nil, nil, nil, 0, nil)
manifest, err := imageType.Manifest(nil, nil, nil, nil, imageType.Size(0))
if err != nil {
t.Fatalf("error creating osbuild manifest")
}
id, err := store.PushCompose(manifest, imageType.Name(), &blueprint.Blueprint{}, 0, nil)
if err != nil {
t.Fatalf("error pushing compose: %v", err)
}
@ -77,7 +82,12 @@ func testUpdateTransition(t *testing.T, from, to string, expectedStatus int) {
id := uuid.Nil
if from != "VOID" {
id, err = store.PushCompose(imageType, &blueprint.Blueprint{}, nil, nil, nil, 0, nil)
manifest, err := imageType.Manifest(nil, nil, nil, nil, imageType.Size(0))
if err != nil {
t.Fatalf("error creating osbuild manifest")
}
id, err = store.PushCompose(manifest, imageType.Name(), &blueprint.Blueprint{}, 0, nil)
if err != nil {
t.Fatalf("error pushing compose: %v", err)
}