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

component status: nil error should return empty string #16876

Merged
merged 1 commit into from
Nov 7, 2015
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/kubectl/cmd/get_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func testData() (*api.PodList, *api.ServiceList, *api.ReplicationControllerList)
func testComponentStatusData() *api.ComponentStatusList {
good := api.ComponentStatus{
Conditions: []api.ComponentCondition{
{Type: api.ComponentHealthy, Status: api.ConditionTrue, Message: "ok", Error: "nil"},
{Type: api.ComponentHealthy, Status: api.ConditionTrue, Message: "ok"},
},
ObjectMeta: api.ObjectMeta{Name: "servergood"},
}
Expand Down
4 changes: 1 addition & 3 deletions pkg/registry/componentstatus/rest.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,9 @@ func ToConditionStatus(s probe.Result) api.ConditionStatus {
func (rs *REST) getComponentStatus(name string, server apiserver.Server) *api.ComponentStatus {
transport := rs.rt
status, msg, err := server.DoServerCheck(transport)
var errorMsg string
errorMsg := ""
if err != nil {
errorMsg = err.Error()
} else {
errorMsg = "nil"
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tested this with the "validate-cluster.sh" script? Just want to make sure that script doesn't need changes, since it parses the output of this call.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean in testing with the "validate-cluster.sh"? Can you give me more detailed steps?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically bring up a new cluster and ensure that it works. The "validate-cluster.sh" script is invoked as part of "kube-up.sh".

I see that tests have passed, so I think you're in the clear, but wanted to confirm if you've manually checked.

c := &api.ComponentCondition{
Expand Down
4 changes: 2 additions & 2 deletions pkg/registry/componentstatus/rest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func TestList_NoError(t *testing.T) {
t.Fatalf("Unexpected error: %v", err)
}
expect := &api.ComponentStatusList{
Items: []api.ComponentStatus{*(createTestStatus("test1", api.ConditionTrue, "ok", "nil"))},
Items: []api.ComponentStatus{*(createTestStatus("test1", api.ConditionTrue, "ok", ""))},
}
if e, a := expect, got; !reflect.DeepEqual(e, a) {
t.Errorf("Got unexpected object. Diff: %s", util.ObjectDiff(e, a))
Expand Down Expand Up @@ -124,7 +124,7 @@ func TestGet_NoError(t *testing.T) {
if err != nil {
t.Fatalf("Unexpected error: %v", err)
}
expect := createTestStatus("test1", api.ConditionTrue, "ok", "nil")
expect := createTestStatus("test1", api.ConditionTrue, "ok", "")
if e, a := expect, got; !reflect.DeepEqual(e, a) {
t.Errorf("Got unexpected object. Diff: %s", util.ObjectDiff(e, a))
}
Expand Down