gofmt -r "GetContainerStats->GetContainerInfo"

This commit is contained in:
Nan Deng 2014-07-14 17:01:57 -07:00
parent 8c573ee727
commit 30bc2af9f1
4 changed files with 8 additions and 8 deletions

View File

@ -850,7 +850,7 @@ func (kl *Kubelet) statsFromContainerPath(containerPath string, req *info.Contai
}
// GetContainerStats returns stats (from Cadvisor) for a container.
func (kl *Kubelet) GetContainerStats(podID, containerName string, req *info.ContainerInfoRequest) (*info.ContainerInfo, error) {
func (kl *Kubelet) GetContainerInfo(podID, containerName string, req *info.ContainerInfoRequest) (*info.ContainerInfo, error) {
if kl.CadvisorClient == nil {
return nil, nil
}

View File

@ -43,7 +43,7 @@ type KubeletServer struct {
// kubeletInterface contains all the kubelet methods required by the server.
// For testablitiy.
type kubeletInterface interface {
GetContainerStats(podID, containerName string, req *info.ContainerInfoRequest) (*info.ContainerInfo, error)
GetContainerInfo(podID, containerName string, req *info.ContainerInfoRequest) (*info.ContainerInfo, error)
GetMachineStats(req *info.ContainerInfoRequest) (*info.ContainerInfo, error)
GetPodInfo(name string) (api.PodInfo, error)
}
@ -133,7 +133,7 @@ func (s *KubeletServer) serveStats(w http.ResponseWriter, req *http.Request) {
// TODO(monnand) Implement this
errors.New("pod level status currently unimplemented")
case 3:
stats, err = s.Kubelet.GetContainerStats(components[1], components[2], &query)
stats, err = s.Kubelet.GetContainerInfo(components[1], components[2], &query)
default:
http.Error(w, "unknown resource.", http.StatusNotFound)
return

View File

@ -42,7 +42,7 @@ func (fk *fakeKubelet) GetPodInfo(name string) (api.PodInfo, error) {
return fk.infoFunc(name)
}
func (fk *fakeKubelet) GetContainerStats(podID, containerName string, req *info.ContainerInfoRequest) (*info.ContainerInfo, error) {
func (fk *fakeKubelet) GetContainerInfo(podID, containerName string, req *info.ContainerInfoRequest) (*info.ContainerInfo, error) {
return fk.containerStatsFunc(podID, containerName, req)
}

View File

@ -988,7 +988,7 @@ func TestGetContainerStats(t *testing.T) {
},
}
stats, err := kubelet.GetContainerStats("qux", "foo", req)
stats, err := kubelet.GetContainerInfo("qux", "foo", req)
if err != nil {
t.Errorf("unexpected error: %v", err)
}
@ -1054,7 +1054,7 @@ func TestGetContainerStatsWithoutCadvisor(t *testing.T) {
},
}
stats, _ := kubelet.GetContainerStats("qux", "foo", nil)
stats, _ := kubelet.GetContainerInfo("qux", "foo", nil)
// When there's no cAdvisor, the stats should be either nil or empty
if stats == nil {
return
@ -1092,7 +1092,7 @@ func TestGetContainerStatsWhenCadvisorFailed(t *testing.T) {
},
}
stats, err := kubelet.GetContainerStats("qux", "foo", req)
stats, err := kubelet.GetContainerInfo("qux", "foo", req)
if stats != nil {
t.Errorf("non-nil stats on error")
}
@ -1113,7 +1113,7 @@ func TestGetContainerStatsOnNonExistContainer(t *testing.T) {
kubelet.CadvisorClient = mockCadvisor
fakeDocker.containerList = []docker.APIContainers{}
stats, _ := kubelet.GetContainerStats("qux", "foo", nil)
stats, _ := kubelet.GetContainerInfo("qux", "foo", nil)
if stats != nil {
t.Errorf("non-nil stats on non exist container")
}