mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 02:15:43 +03:00
jobspec: add test for types of nested configs
This commit is contained in:
committed by
Alex Dadgar
parent
c01f2a38f5
commit
bc2efb7824
@@ -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 {
|
||||
|
||||
10
jobspec/test-fixtures/task-nested-config.hcl
Normal file
10
jobspec/test-fixtures/task-nested-config.hcl
Normal file
@@ -0,0 +1,10 @@
|
||||
job "foo" {
|
||||
task "bar" {
|
||||
driver = "docker"
|
||||
config {
|
||||
port_map {
|
||||
db = 1234
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user