Clean unittests

This commit is contained in:
Dawn Chen
2014-10-03 00:34:18 -07:00
parent 9861eb7c8e
commit 8d0ed93aa1
6 changed files with 29 additions and 39 deletions

View File

@@ -27,14 +27,11 @@ import (
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
"github.com/fsouza/go-dockerclient"
)
func TestHTTPPodInfoGetter(t *testing.T) {
expectObj := api.PodInfo{
"myID": api.ContainerStatus{
DetailInfo: docker.Container{ID: "myID"},
},
"myID": api.ContainerStatus{},
}
body, err := json.Marshal(expectObj)
if err != nil {
@@ -69,17 +66,14 @@ func TestHTTPPodInfoGetter(t *testing.T) {
}
// reflect.DeepEqual(expectObj, gotObj) doesn't handle blank times well
if len(gotObj) != len(expectObj) ||
expectObj["myID"].DetailInfo.ID != gotObj["myID"].DetailInfo.ID {
if len(gotObj) != len(expectObj) {
t.Errorf("Unexpected response. Expected: %#v, received %#v", expectObj, gotObj)
}
}
func TestHTTPPodInfoGetterNotFound(t *testing.T) {
expectObj := api.PodInfo{
"myID": api.ContainerStatus{
DetailInfo: docker.Container{ID: "myID"},
},
"myID": api.ContainerStatus{},
}
_, err := json.Marshal(expectObj)
if err != nil {