mirror of
https://github.com/kemko/nomad.git
synced 2026-01-08 03:15:42 +03:00
Merge pull request #55 from hashicorp/f-hcl-job
jobspec: default job ID also comes from key
This commit is contained in:
@@ -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 {
|
||||
|
||||
4
jobspec/test-fixtures/specify-job.hcl
Normal file
4
jobspec/test-fixtures/specify-job.hcl
Normal file
@@ -0,0 +1,4 @@
|
||||
job "default" {
|
||||
id = "job1"
|
||||
name = "My Job"
|
||||
}
|
||||
Reference in New Issue
Block a user