From f6ea2a61dae7a02b5aacb7d9dc1750eff9ad88f0 Mon Sep 17 00:00:00 2001 From: tanshanshan Date: Tue, 26 Sep 2017 19:49:56 +0800 Subject: [PATCH] improve code --- test/e2e_node/density_test.go | 4 ++-- test/e2e_node/docker_util.go | 2 +- test/e2e_node/image_list.go | 7 +++++-- test/e2e_node/resource_collector.go | 2 +- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/test/e2e_node/density_test.go b/test/e2e_node/density_test.go index e440b429381..addf9bbe7b6 100644 --- a/test/e2e_node/density_test.go +++ b/test/e2e_node/density_test.go @@ -524,7 +524,7 @@ func newInformerWatchPod(f *framework.Framework, mutex *sync.Mutex, watchTimes m return controller } -// createBatchPodSequential creats pods back-to-back in sequence. +// createBatchPodSequential creates pods back-to-back in sequence. func createBatchPodSequential(f *framework.Framework, pods []*v1.Pod) (time.Duration, []framework.PodLatencyData) { batchStartTime := metav1.Now() e2eLags := make([]framework.PodLatencyData, 0) @@ -570,7 +570,7 @@ func logPodCreateThroughput(batchLag time.Duration, e2eLags []framework.PodLaten logPerfData(getThroughputPerfData(batchLag, e2eLags, podsNr, testInfo), "throughput") } -// increaseKubeletAPIQPSLimit sets Kubelet API QPS via ConfigMap. Kubelet will restart with the new QPS. +// setKubeletAPIQPSLimit sets Kubelet API QPS via ConfigMap. Kubelet will restart with the new QPS. func setKubeletAPIQPSLimit(f *framework.Framework, newAPIQPS int32) { const restartGap = 40 * time.Second diff --git a/test/e2e_node/docker_util.go b/test/e2e_node/docker_util.go index 8a87607e993..83c4177ff2c 100644 --- a/test/e2e_node/docker_util.go +++ b/test/e2e_node/docker_util.go @@ -87,7 +87,7 @@ func isDockerLiveRestoreEnabled() (bool, error) { return info.LiveRestoreEnabled, nil } -// stopDockerDaemon starts the Docker daemon. +// startDockerDaemon starts the Docker daemon. func startDockerDaemon() error { switch { case systemdutil.IsRunningSystemd(): diff --git a/test/e2e_node/image_list.go b/test/e2e_node/image_list.go index deb70ccee4f..54cc83d3eed 100644 --- a/test/e2e_node/image_list.go +++ b/test/e2e_node/image_list.go @@ -92,8 +92,11 @@ func (rp *remotePuller) Name() string { } func (rp *remotePuller) Pull(image string) ([]byte, error) { - // TODO(runcom): should we check if the image is already pulled with ImageStatus? - _, err := rp.imageService.PullImage(&runtimeapi.ImageSpec{Image: image}, nil) + imageStatus, err := rp.imageService.ImageStatus(&runtimeapi.ImageSpec{Image: image}) + if err == nil && imageStatus != nil { + return nil, nil + } + _, err = rp.imageService.PullImage(&runtimeapi.ImageSpec{Image: image}, nil) return nil, err } diff --git a/test/e2e_node/resource_collector.go b/test/e2e_node/resource_collector.go index 1facaff5785..53028aebfad 100644 --- a/test/e2e_node/resource_collector.go +++ b/test/e2e_node/resource_collector.go @@ -534,7 +534,7 @@ func getContainer(pid int) (string, error) { return "", cgroups.NewNotFoundError("memory") } - // since we use this container for accounting, we need to ensure its a unified hierarchy. + // since we use this container for accounting, we need to ensure it is a unified hierarchy. if cpu != memory { return "", fmt.Errorf("cpu and memory cgroup hierarchy not unified. cpu: %s, memory: %s", cpu, memory) }