minor code review fixes to api/jobs

This commit is contained in:
Nick Ethier 2018-04-17 10:18:36 -04:00
parent f72c76c373
commit 1f99c3a0f7
No known key found for this signature in database
GPG Key ID: 07C1A3ECED90D24A
3 changed files with 12 additions and 12 deletions

View File

@ -53,7 +53,7 @@ func (c *Client) Jobs() *Jobs {
// Parse is used to convert the HCL repesentation of a Job to JSON server side.
// To parse the HCL client side see package github.com/hashicorp/nomad/jobspec
func (j *Jobs) Parse(jobHCL string, canonicalize bool) (*Job, error) {
func (j *Jobs) ParseHCL(jobHCL string, canonicalize bool) (*Job, error) {
var job Job
req := &JobsParseRequest{
JobHCL: jobHCL,

View File

@ -54,7 +54,7 @@ func TestJobs_Parse(t *testing.T) {
jobs := c.Jobs()
checkJob := func(job *Job, expected string) {
checkJob := func(job *Job, expectedRegion string) {
if job == nil {
t.Fatal("job should not be nil")
}
@ -62,22 +62,22 @@ func TestJobs_Parse(t *testing.T) {
region := job.Region
if region == nil {
if expected != "" {
t.Fatalf("expected job region to be '%s' but was unset", expected)
if expectedRegion != "" {
t.Fatalf("expected job region to be '%s' but was unset", expectedRegion)
}
} else {
if expected != *region {
t.Fatalf("expected job region '%s', but got '%s'", expected, *region)
if expectedRegion != *region {
t.Fatalf("expected job region '%s', but got '%s'", expectedRegion, *region)
}
}
}
job, err := jobs.Parse(mock.HCL(), true)
job, err := jobs.ParseHCL(mock.HCL(), true)
if err != nil {
t.Fatalf("err: %s", err)
}
checkJob(job, "global")
job, err = jobs.Parse(mock.HCL(), false)
job, err = jobs.ParseHCL(mock.HCL(), false)
if err != nil {
t.Fatalf("err: %s", err)
}

View File

@ -233,7 +233,7 @@ $ curl \
## Parse Job
This endpoint will parse an hcl jobspec and produce the equivalent json encoded
This endpoint will parse a HCL jobspec and produce the equivalent JSON encoded
job.
| Method | Path | Produces |