job-queue: pass a well-formed job object to the worker

For now we will hardcode the org.osbuild.local target, so we might
as well fix this up front.

We do not yet support any target types, but for testing purposes we
claim to support 'tar', and we pass a noop tar pipeline to the worker.

This makes introspecting the job-queu api using curl a bit more
pleasant.

Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
Tom Gundersen 2019-09-26 20:37:19 +02:00 committed by Lars Karlitski
parent 3221112d35
commit 0bdd3a5c89
9 changed files with 81 additions and 38 deletions

View file

@ -11,9 +11,7 @@ import (
"testing"
"osbuild-composer/internal/job"
"osbuild-composer/internal/pipeline"
"osbuild-composer/internal/rpmmd"
"osbuild-composer/internal/target"
"osbuild-composer/internal/weldr"
)
@ -157,12 +155,10 @@ func TestCompose(t *testing.T) {
http.StatusOK, `{"status":true}`)
job := <-jobChannel
expected_pipeline := pipeline.Pipeline(`{"pipeline":"string"}`)
expected_target := target.Target(`{"output-path":"/var/cache/osbuild-composer"}`)
if expected_target != job.Target {
t.Errorf("Expected this manifest: %s; got this: %s", expected_target, job.Target)
if job.Pipeline.Assembler.Name != "org.osbuild.tar" {
t.Errorf("Expected tar assembler, got: %s", job.Pipeline.Assembler.Name)
}
if expected_pipeline != job.Pipeline {
t.Errorf("Expected this manifest: %s; got this: %s", expected_pipeline, job.Pipeline)
if job.Targets[0].Name != "org.osbuild.local" {
t.Errorf("Expected local target, got: %s", job.Targets[0].Name)
}
}