nomad: code review comments
This commit is contained in:
parent
a581cc9c01
commit
50c72adbd7
|
@ -1325,6 +1325,7 @@ func validateJob(job *structs.Job) (invalid, warnings error) {
|
|||
|
||||
// validateJobUpdate ensures updates to a job are valid.
|
||||
func validateJobUpdate(old, new *structs.Job) error {
|
||||
// Validate Dispatch not set on new Jobs
|
||||
if old == nil {
|
||||
if new.Dispatched {
|
||||
return fmt.Errorf("job can't be submitted with 'Dispatched' set")
|
||||
|
@ -1407,7 +1408,6 @@ func (j *Job) Dispatch(args *structs.JobDispatchRequest, reply *structs.JobDispa
|
|||
|
||||
// Derive the child job and commit it via Raft
|
||||
dispatchJob := parameterizedJob.Copy()
|
||||
dispatchJob.ParameterizedJob = nil
|
||||
dispatchJob.ID = structs.DispatchedID(parameterizedJob.ID, time.Now())
|
||||
dispatchJob.ParentID = parameterizedJob.ID
|
||||
dispatchJob.Name = dispatchJob.ID
|
||||
|
|
|
@ -4384,6 +4384,12 @@ func TestJobEndpoint_Dispatch(t *testing.T) {
|
|||
if !out.Dispatched {
|
||||
t.Fatal("expected dispatched job")
|
||||
}
|
||||
if out.IsParameterized() {
|
||||
t.Fatal("dispatched job should not be parameterized")
|
||||
}
|
||||
if out.ParameterizedJob == nil {
|
||||
t.Fatal("parameter job config should exist")
|
||||
}
|
||||
|
||||
if tc.noEval {
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue