Manager: use api.JobStatus in persistence layer as well
This commit is contained in:
parent
7e776167bb
commit
7420177209
@ -36,10 +36,10 @@ type Job struct {
|
|||||||
gorm.Model
|
gorm.Model
|
||||||
UUID string `gorm:"type:char(36);not null;unique;index"`
|
UUID string `gorm:"type:char(36);not null;unique;index"`
|
||||||
|
|
||||||
Name string `gorm:"type:varchar(64);not null"`
|
Name string `gorm:"type:varchar(64);not null"`
|
||||||
JobType string `gorm:"type:varchar(32);not null"`
|
JobType string `gorm:"type:varchar(32);not null"`
|
||||||
Priority int `gorm:"type:smallint;not null"`
|
Priority int `gorm:"type:smallint;not null"`
|
||||||
Status string `gorm:"type:varchar(32);not null"` // See JobStatusXxxx consts in openapi_types.gen.go
|
Status api.JobStatus `gorm:"type:varchar(32);not null"`
|
||||||
|
|
||||||
Settings StringInterfaceMap `gorm:"type:jsonb"`
|
Settings StringInterfaceMap `gorm:"type:jsonb"`
|
||||||
Metadata StringStringMap `gorm:"type:jsonb"`
|
Metadata StringStringMap `gorm:"type:jsonb"`
|
||||||
@ -119,7 +119,7 @@ func (db *DB) StoreAuthoredJob(ctx context.Context, authoredJob job_compilers.Au
|
|||||||
UUID: authoredJob.JobID,
|
UUID: authoredJob.JobID,
|
||||||
Name: authoredJob.Name,
|
Name: authoredJob.Name,
|
||||||
JobType: authoredJob.JobType,
|
JobType: authoredJob.JobType,
|
||||||
Status: string(authoredJob.Status),
|
Status: authoredJob.Status,
|
||||||
Priority: authoredJob.Priority,
|
Priority: authoredJob.Priority,
|
||||||
Settings: StringInterfaceMap(authoredJob.Settings),
|
Settings: StringInterfaceMap(authoredJob.Settings),
|
||||||
Metadata: StringStringMap(authoredJob.Metadata),
|
Metadata: StringStringMap(authoredJob.Metadata),
|
||||||
|
@ -105,7 +105,7 @@ func TestStoreAuthoredJob(t *testing.T) {
|
|||||||
assert.Equal(t, job.Name, fetchedJob.Name)
|
assert.Equal(t, job.Name, fetchedJob.Name)
|
||||||
assert.Equal(t, job.JobType, fetchedJob.JobType)
|
assert.Equal(t, job.JobType, fetchedJob.JobType)
|
||||||
assert.Equal(t, job.Priority, fetchedJob.Priority)
|
assert.Equal(t, job.Priority, fetchedJob.Priority)
|
||||||
assert.Equal(t, string(api.JobStatusUnderConstruction), fetchedJob.Status)
|
assert.Equal(t, api.JobStatusUnderConstruction, fetchedJob.Status)
|
||||||
assert.EqualValues(t, map[string]interface{}(job.Settings), fetchedJob.Settings)
|
assert.EqualValues(t, map[string]interface{}(job.Settings), fetchedJob.Settings)
|
||||||
assert.EqualValues(t, map[string]string(job.Metadata), fetchedJob.Metadata)
|
assert.EqualValues(t, map[string]string(job.Metadata), fetchedJob.Metadata)
|
||||||
|
|
||||||
|
@ -181,7 +181,7 @@ func constructTestJob(
|
|||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
// Queue the job.
|
// Queue the job.
|
||||||
dbJob.Status = string(api.JobStatusQueued)
|
dbJob.Status = api.JobStatusQueued
|
||||||
err = db.SaveJobStatus(ctx, dbJob)
|
err = db.SaveJobStatus(ctx, dbJob)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user