store: pass the store to the jobqueue API

Drop the jobUpdates channel, and instead add an UpdateCompose method
to the store, which updates the status of a compose directly.

This allows us to report back errors directly, rather than having to
mirror the staet in the jobqueue API.

Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
Tom Gundersen 2019-10-05 17:35:31 +02:00 committed by Lars Karlitski
parent 89fd2e6037
commit 3ff4f59fc7
5 changed files with 34 additions and 39 deletions

View file

@ -154,13 +154,13 @@ func TestBasic(t *testing.T) {
}
for _, c := range cases {
api := weldr.New(repo, packages, nil, store.New(nil, nil, nil, nil))
api := weldr.New(repo, packages, nil, store.New(nil, 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, nil))
api := weldr.New(repo, packages, nil, store.New(nil, nil, nil))
testRoute(t, api, "POST", "/api/v0/blueprints/new",
`{"name":"test","description":"Test","packages":[{"name":"httpd","version":"2.4.*"}],"version":"0.0.0"}`,
@ -184,7 +184,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, nil))
api := weldr.New(repo, packages, nil, store.New(nil, nil, jobChannel))
testRoute(t, api, "POST", "/api/v0/blueprints/new",
`{"name":"test","description":"Test","packages":[{"name":"httpd","version":"2.4.*"}],"version":"0.0.0"}`,