Skip to content

Commit

Permalink
jobspec: add test for types of nested configs
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchellh authored and dadgar committed Nov 16, 2015
1 parent c01f2a3 commit bc2efb7
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
37 changes: 37 additions & 0 deletions jobspec/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,43 @@ func TestParse(t *testing.T) {
},
false,
},

{
"task-nested-config.hcl",
&structs.Job{
Region: "global",
ID: "foo",
Name: "foo",
Type: "service",
Priority: 50,

TaskGroups: []*structs.TaskGroup{
&structs.TaskGroup{
Name: "bar",
Count: 1,
RestartPolicy: &structs.RestartPolicy{
Attempts: 2,
Interval: 1 * time.Minute,
Delay: 15 * time.Second,
},
Tasks: []*structs.Task{
&structs.Task{
Name: "bar",
Driver: "docker",
Config: map[string]interface{}{
"port_map": []map[string]interface{}{
map[string]interface{}{
"db": 1234,
},
},
},
},
},
},
},
},
false,
},
}

for _, tc := range cases {
Expand Down
10 changes: 10 additions & 0 deletions jobspec/test-fixtures/task-nested-config.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
job "foo" {
task "bar" {
driver = "docker"
config {
port_map {
db = 1234
}
}
}
}

0 comments on commit bc2efb7

Please sign in to comment.