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/v2: return empty array of peers when disabled #2203

Merged
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/v2/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ func (api *API) getStatusHandler(params general_ops.GetStatusParams) middleware.
},
Cluster: &open_api_models.ClusterStatus{
Status: &status,
Peers: []*open_api_models.PeerStatus{},
},
}

Expand Down
7 changes: 5 additions & 2 deletions api/v2/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,11 @@ func TestGetStatusHandlerWithNilPeer(t *testing.T) {
t.Fatal("expected cluster status not to be nil, violating the openapi specification")
}

if c.Peers != nil {
t.Fatal("expected cluster peers to be nil when api.peer is nil, violating the openapi specification")
if c.Peers == nil {
t.Fatal("expected cluster peers to be not nil when api.peer is nil, violating the openapi specification")
}
if len(c.Peers) != 0 {
t.Fatal("expected cluster peers to be empty when api.peer is nil, violating the openapi specification")
}

if c.Name != "" {
Expand Down
1 change: 0 additions & 1 deletion api/v2/models/cluster_status.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion api/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,6 @@ definitions:
enum: ["ready", "settling", "disabled"]
peers:
type: array
minimum: 0
items:
$ref: '#/definitions/peerStatus'
required:
Expand Down
1 change: 0 additions & 1 deletion api/v2/restapi/embedded_spec.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.