Skip to content

Commit

Permalink
add unit tests for datacenter non-empty string validation
Browse files Browse the repository at this point in the history
  • Loading branch information
jazzyfresh committed May 8, 2019
1 parent de25a7b commit b40c69b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions nomad/structs/structs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,16 @@ func TestJob_Validate(t *testing.T) {
if !strings.Contains(mErr.Errors[2].Error(), "Task group web validation failed") {
t.Fatalf("err: %s", err)
}

// test for empty datacenters
j = &Job{
Datacenters: []string{""},
}
err = j.Validate()
mErr = err.(*multierror.Error)
if !strings.Contains(mErr.Error(), "datacenter must be non-empty string") {
t.Fatalf("err: %s", err)
}
}

func TestJob_Warnings(t *testing.T) {
Expand Down

0 comments on commit b40c69b

Please sign in to comment.