Merge pull request #55 from hashicorp/f-hcl-job
jobspec: default job ID also comes from key
This commit is contained in:
commit
173a84fb2e
|
@ -77,7 +77,8 @@ func parseJob(result *structs.Job, obj *hclobj.Object) error {
|
|||
delete(m, "constraint")
|
||||
delete(m, "meta")
|
||||
|
||||
// Set the name to the object key
|
||||
// Set the ID and name to the object key
|
||||
result.ID = obj.Key
|
||||
result.Name = obj.Key
|
||||
|
||||
// Defaults
|
||||
|
|
|
@ -17,6 +17,7 @@ func TestParse(t *testing.T) {
|
|||
{
|
||||
"basic.hcl",
|
||||
&structs.Job{
|
||||
ID: "binstore-storagelocker",
|
||||
Name: "binstore-storagelocker",
|
||||
Type: "service",
|
||||
Priority: 50,
|
||||
|
@ -128,6 +129,7 @@ func TestParse(t *testing.T) {
|
|||
{
|
||||
"default-job.hcl",
|
||||
&structs.Job{
|
||||
ID: "foo",
|
||||
Name: "foo",
|
||||
Priority: 50,
|
||||
Region: "global",
|
||||
|
@ -135,6 +137,18 @@ func TestParse(t *testing.T) {
|
|||
},
|
||||
false,
|
||||
},
|
||||
|
||||
{
|
||||
"specify-job.hcl",
|
||||
&structs.Job{
|
||||
ID: "job1",
|
||||
Name: "My Job",
|
||||
Priority: 50,
|
||||
Region: "global",
|
||||
Type: "service",
|
||||
},
|
||||
false,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range cases {
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
job "default" {
|
||||
id = "job1"
|
||||
name = "My Job"
|
||||
}
|
Loading…
Reference in New Issue