jobqueue: Replace JobArgs() with Job()

JobArgs() function replaced with more general Job() function that
returns all the parameters used to originally define a job during
Enqueue(). This new function enables access to the type of a job in the
queue, which wasn't available until now (except when Dequeueing).
This commit is contained in:
Achilleas Koutsou 2021-01-12 13:49:01 +01:00 committed by Ondřej Budai
parent 75a96bd99d
commit 668fb003ef
6 changed files with 26 additions and 18 deletions

View file

@ -8,6 +8,7 @@ import (
"os"
"testing"
"github.com/google/uuid"
"github.com/stretchr/testify/require"
"github.com/osbuild/osbuild-composer/internal/distro"
@ -198,10 +199,12 @@ func TestArgs(t *testing.T) {
require.NotNil(t, args)
var jobArgs worker.OSBuildJob
rawArgs, err := server.JobArgs(jobId, &jobArgs)
jobType, rawArgs, deps, err := server.Job(jobId, &jobArgs)
require.NoError(t, err)
require.Equal(t, args, rawArgs)
require.Equal(t, job, jobArgs)
require.Equal(t, jobType, "osbuild:"+arch.Name())
require.Equal(t, []uuid.UUID(nil), deps)
}
func TestUpload(t *testing.T) {