pkg/kubelet: minor fixes in server.go

This commit is contained in:
Xiang Li
2015-02-18 13:18:45 -08:00
parent 6f84bdaba8
commit 6b91901bd3
2 changed files with 26 additions and 14 deletions

View File

@@ -380,6 +380,29 @@ func TestServeRunInContainerWithUID(t *testing.T) {
}
}
// TODO: fix me when pod level stats get implemented
func TestPodsInfo(t *testing.T) {
fw := newServerTest()
resp, err := http.Get(fw.testHTTPServer.URL + "/stats/goodpod")
if err != nil {
t.Fatalf("Got error GETing: %v", err)
}
defer resp.Body.Close()
if resp.StatusCode != http.StatusInternalServerError {
t.Errorf("expected status code %d, got %d", http.StatusInternalServerError, resp.StatusCode)
}
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
// copying the response body did not work
t.Fatalf("Cannot copy resp: %#v", err)
}
result := string(body)
if !strings.Contains(result, "pod level status currently unimplemented") {
t.Errorf("expected body contains %s, got %d", "pod level status currently unimplemented", result)
}
}
func setPodByNameFunc(fw *serverTestFramework, namespace, pod, container string) {
fw.fakeKubelet.podByNameFunc = func(namespace, name string) (*api.BoundPod, bool) {
return &api.BoundPod{