store: add {Push,Pop}Compose methods and hide channel

Wrap the channel in Pop and Push methods, so it is not exposed to
the callers. PushCompose replaces the old AddCompose for consistency,
and PopCompose simply reads from the other end of the channel.

Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
Tom Gundersen 2019-10-05 17:51:30 +02:00 committed by Lars Karlitski
parent 3ff4f59fc7
commit 9cb140795e
6 changed files with 23 additions and 37 deletions

View file

@ -13,7 +13,6 @@ import (
"strings"
"testing"
"osbuild-composer/internal/job"
"osbuild-composer/internal/rpmmd"
"osbuild-composer/internal/store"
"osbuild-composer/internal/weldr"
@ -154,13 +153,13 @@ func TestBasic(t *testing.T) {
}
for _, c := range cases {
api := weldr.New(repo, packages, nil, store.New(nil, nil, nil))
api := weldr.New(repo, packages, nil, store.New(nil, nil))
testRoute(t, api, "GET", c.Path, ``, c.ExpectedStatus, c.ExpectedJSON)
}
}
func TestBlueprints(t *testing.T) {
api := weldr.New(repo, packages, nil, store.New(nil, nil, nil))
api := weldr.New(repo, packages, nil, store.New(nil, nil))
testRoute(t, api, "POST", "/api/v0/blueprints/new",
`{"name":"test","description":"Test","packages":[{"name":"httpd","version":"2.4.*"}],"version":"0.0.0"}`,
@ -183,8 +182,7 @@ func TestBlueprints(t *testing.T) {
}
func TestCompose(t *testing.T) {
jobChannel := make(chan job.Job, 200)
api := weldr.New(repo, packages, nil, store.New(nil, nil, jobChannel))
api := weldr.New(repo, packages, nil, store.New(nil, nil))
testRoute(t, api, "POST", "/api/v0/blueprints/new",
`{"name":"test","description":"Test","packages":[{"name":"httpd","version":"2.4.*"}],"version":"0.0.0"}`,