Skip to content

Commit

Permalink
Merge pull request #8530 from hashicorp/b-gh-8527
Browse files Browse the repository at this point in the history
api: add namespace to scaling status GET response object.
  • Loading branch information
jrasell committed Jul 24, 2020
2 parents f4eae8a + f34530b commit badb58b
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions api/jobs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ func TestJobs_Register_NoPreserveCounts(t *testing.T) {
// Query the job scale status
status, _, err := jobs.ScaleStatus(*job.ID, nil)
require.NoError(err)
require.Equal("default", status.Namespace)
require.Equal(0, status.TaskGroups["group1"].Desired) // present => as specified
require.Equal(1, status.TaskGroups["group2"].Desired) // nil => default (1)
require.Equal(3, status.TaskGroups["group3"].Desired) // new => as specified
Expand Down
1 change: 1 addition & 0 deletions api/scaling.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ type ScalingPolicyListStub struct {
// JobScaleStatusResponse is used to return information about job scaling status
type JobScaleStatusResponse struct {
JobID string
Namespace string
JobCreateIndex uint64
JobModifyIndex uint64
JobStopped bool
Expand Down
1 change: 1 addition & 0 deletions nomad/job_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -2037,6 +2037,7 @@ func (j *Job) ScaleStatus(args *structs.JobScaleStatusRequest,
// Setup the output
reply.JobScaleStatus = &structs.JobScaleStatus{
JobID: job.ID,
Namespace: job.Namespace,
JobCreateIndex: job.CreateIndex,
JobModifyIndex: job.ModifyIndex,
JobStopped: job.Stop,
Expand Down
1 change: 1 addition & 0 deletions nomad/job_endpoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6533,6 +6533,7 @@ func TestJobEndpoint_GetScaleStatus(t *testing.T) {

expectedStatus := structs.JobScaleStatus{
JobID: jobV2.ID,
Namespace: jobV2.Namespace,
JobCreateIndex: jobV2.CreateIndex,
JobModifyIndex: a1.CreateIndex,
JobStopped: jobV2.Stop,
Expand Down
1 change: 1 addition & 0 deletions nomad/structs/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -1292,6 +1292,7 @@ type JobScaleStatusResponse struct {

type JobScaleStatus struct {
JobID string
Namespace string
JobCreateIndex uint64
JobModifyIndex uint64
JobStopped bool
Expand Down

0 comments on commit badb58b

Please sign in to comment.