fix validation tests

This commit is contained in:
Alex Dadgar 2016-07-20 16:43:20 -07:00
parent e0114fee05
commit af09ef0832
2 changed files with 6 additions and 3 deletions

View file

@ -1875,7 +1875,9 @@ func (t *Task) Canonicalize(job *Job, tg *TaskGroup) {
service.Canonicalize(job.Name, tg.Name, t.Name)
}
t.Resources.Canonicalize()
if t.Resources != nil {
t.Resources.Canonicalize()
}
// Set the default timeout if it is not specified.
if t.KillTimeout == 0 {

View file

@ -88,7 +88,7 @@ func TestJob_Validate(t *testing.T) {
if !strings.Contains(mErr.Errors[1].Error(), "group 3 missing name") {
t.Fatalf("err: %s", err)
}
if !strings.Contains(mErr.Errors[2].Error(), "Task group 1 validation failed") {
if !strings.Contains(mErr.Errors[2].Error(), "Task group web validation failed") {
t.Fatalf("err: %s", err)
}
}
@ -258,6 +258,7 @@ func TestTaskGroup_Validate(t *testing.T) {
Mode: RestartPolicyModeDelay,
},
}
err = tg.Validate()
mErr = err.(*multierror.Error)
if !strings.Contains(mErr.Errors[0].Error(), "2 redefines 'web' from task 1") {
@ -266,7 +267,7 @@ func TestTaskGroup_Validate(t *testing.T) {
if !strings.Contains(mErr.Errors[1].Error(), "Task 3 missing name") {
t.Fatalf("err: %s", err)
}
if !strings.Contains(mErr.Errors[2].Error(), "Task 1 validation failed") {
if !strings.Contains(mErr.Errors[2].Error(), "Task web validation failed") {
t.Fatalf("err: %s", err)
}
}