Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

api: add namespace to scaling status GET response object. #8530

Merged
merged 1 commit into from
Jul 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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