worker/server: typesafe Job and JobStatus
Replace Job() and JobStatus() with typesafe versions, and introduce JobType() for the rare instances where we don't know the type up front. Additionally, catch a few more error cases: - if OSBuildResult is nil, then we failed to invoke osbuild - make sure the same JobResult handling is done for osbuild-koji, as for osbuild
This commit is contained in:
parent
da1537dee6
commit
b32ab36e1d
10 changed files with 240 additions and 202 deletions
|
|
@ -345,8 +345,7 @@ func (api *API) getComposeStatus(compose store.Compose) *composeStatus {
|
|||
|
||||
// All jobs are "osbuild" jobs.
|
||||
var result worker.OSBuildJobResult
|
||||
|
||||
jobStatus, _, err := api.workers.JobStatus(jobId, &result)
|
||||
jobStatus, _, err := api.workers.OSBuildJobStatus(jobId, &result)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ func TestComposeStatusFromLegacyError(t *testing.T) {
|
|||
err = api.workers.FinishJob(token, rawResult)
|
||||
require.NoError(t, err)
|
||||
|
||||
jobStatus, _, err := api.workers.JobStatus(jobId, &jobResult)
|
||||
jobStatus, _, err := api.workers.OSBuildJobStatus(jobId, &jobResult)
|
||||
require.NoError(t, err)
|
||||
|
||||
state := composeStateFromJobStatus(jobStatus, &jobResult)
|
||||
|
|
@ -101,7 +101,7 @@ func TestComposeStatusFromJobError(t *testing.T) {
|
|||
err = api.workers.FinishJob(token, rawResult)
|
||||
require.NoError(t, err)
|
||||
|
||||
jobStatus, _, err := api.workers.JobStatus(jobId, &jobResult)
|
||||
jobStatus, _, err := api.workers.OSBuildJobStatus(jobId, &jobResult)
|
||||
require.NoError(t, err)
|
||||
|
||||
state := composeStateFromJobStatus(jobStatus, &jobResult)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue