diff --git a/hack/.golint_failures b/hack/.golint_failures index 8ef2025c92b..d132d7f812e 100644 --- a/hack/.golint_failures +++ b/hack/.golint_failures @@ -536,7 +536,6 @@ staging/src/k8s.io/sample-apiserver/pkg/registry/wardle/flunder test/e2e/common test/e2e/lifecycle/bootstrap test/e2e/storage/vsphere -test/e2e_node test/e2e_node/remote test/e2e_node/runner/remote test/utils diff --git a/test/e2e_node/apparmor_test.go b/test/e2e_node/apparmor_test.go index f6344a91b5d..053fb59d152 100644 --- a/test/e2e_node/apparmor_test.go +++ b/test/e2e_node/apparmor_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package e2e_node +package e2enode import ( "bytes" diff --git a/test/e2e_node/benchmark_util.go b/test/e2e_node/benchmark_util.go index 2e514c773e3..ce3cf4ce849 100644 --- a/test/e2e_node/benchmark_util.go +++ b/test/e2e_node/benchmark_util.go @@ -16,7 +16,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package e2e_node +package e2enode import ( "fmt" @@ -36,7 +36,9 @@ import ( ) const ( + // TimeSeriesTag is the tag for time series. TimeSeriesTag = "[Result:TimeSeries]" + // TimeSeriesEnd is the end tag for time series. TimeSeriesEnd = "[Finish:TimeSeries]" ) diff --git a/test/e2e_node/container_log_rotation_test.go b/test/e2e_node/container_log_rotation_test.go index 3a208584e05..1d558a18b54 100644 --- a/test/e2e_node/container_log_rotation_test.go +++ b/test/e2e_node/container_log_rotation_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package e2e_node +package e2enode import ( "time" diff --git a/test/e2e_node/container_manager_test.go b/test/e2e_node/container_manager_test.go index 410eae0d6d4..3cec8138657 100644 --- a/test/e2e_node/container_manager_test.go +++ b/test/e2e_node/container_manager_test.go @@ -16,7 +16,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package e2e_node +package e2enode import ( "fmt" diff --git a/test/e2e_node/cpu_manager_test.go b/test/e2e_node/cpu_manager_test.go index 1825f1885c8..203d983d274 100644 --- a/test/e2e_node/cpu_manager_test.go +++ b/test/e2e_node/cpu_manager_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package e2e_node +package e2enode import ( "fmt" diff --git a/test/e2e_node/critical_pod_test.go b/test/e2e_node/critical_pod_test.go index d70ed3d2781..f374e4e6440 100644 --- a/test/e2e_node/critical_pod_test.go +++ b/test/e2e_node/critical_pod_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package e2e_node +package e2enode import ( "fmt" diff --git a/test/e2e_node/density_test.go b/test/e2e_node/density_test.go index a33f0bc47e3..26359b5bedb 100644 --- a/test/e2e_node/density_test.go +++ b/test/e2e_node/density_test.go @@ -16,7 +16,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package e2e_node +package e2enode import ( "fmt" diff --git a/test/e2e_node/device_plugin_test.go b/test/e2e_node/device_plugin_test.go index e40cd74c3f4..7cf4a934023 100644 --- a/test/e2e_node/device_plugin_test.go +++ b/test/e2e_node/device_plugin_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package e2e_node +package e2enode import ( "path/filepath" @@ -96,8 +96,8 @@ func testDevicePlugin(f *framework.Framework, pluginSockDir string) { podRECMD := "devs=$(ls /tmp/ | egrep '^Dev-[0-9]+$') && echo stub devices: $devs" pod1 := f.PodClient().CreateSync(makeBusyboxPod(resourceName, podRECMD)) deviceIDRE := "stub devices: (Dev-[0-9]+)" - devId1 := parseLog(f, pod1.Name, pod1.Name, deviceIDRE) - gomega.Expect(devId1).To(gomega.Not(gomega.Equal(""))) + devID1 := parseLog(f, pod1.Name, pod1.Name, deviceIDRE) + gomega.Expect(devID1).To(gomega.Not(gomega.Equal(""))) podResources, err := getNodeDevices() var resourcesForOurPod *kubeletpodresourcesv1alpha1.PodResources @@ -125,8 +125,8 @@ func testDevicePlugin(f *framework.Framework, pluginSockDir string) { ensurePodContainerRestart(f, pod1.Name, pod1.Name) ginkgo.By("Confirming that device assignment persists even after container restart") - devIdAfterRestart := parseLog(f, pod1.Name, pod1.Name, deviceIDRE) - framework.ExpectEqual(devIdAfterRestart, devId1) + devIDAfterRestart := parseLog(f, pod1.Name, pod1.Name, deviceIDRE) + framework.ExpectEqual(devIDAfterRestart, devID1) restartTime := time.Now() ginkgo.By("Restarting Kubelet") @@ -164,8 +164,8 @@ func testDevicePlugin(f *framework.Framework, pluginSockDir string) { ensurePodContainerRestart(f, pod1.Name, pod1.Name) ginkgo.By("Confirming that after a kubelet restart, fake-device assignement is kept") - devIdRestart1 := parseLog(f, pod1.Name, pod1.Name, deviceIDRE) - framework.ExpectEqual(devIdRestart1, devId1) + devIDRestart1 := parseLog(f, pod1.Name, pod1.Name, deviceIDRE) + framework.ExpectEqual(devIDRestart1, devID1) ginkgo.By("Waiting for resource to become available on the local node after re-registration") gomega.Eventually(func() bool { @@ -179,9 +179,9 @@ func testDevicePlugin(f *framework.Framework, pluginSockDir string) { pod2 := f.PodClient().CreateSync(makeBusyboxPod(resourceName, podRECMD)) ginkgo.By("Checking that pod got a different fake device") - devId2 := parseLog(f, pod2.Name, pod2.Name, deviceIDRE) + devID2 := parseLog(f, pod2.Name, pod2.Name, deviceIDRE) - gomega.Expect(devId1).To(gomega.Not(gomega.Equal(devId2))) + gomega.Expect(devID1).To(gomega.Not(gomega.Equal(devID2))) ginkgo.By("By deleting the pods and waiting for container removal") err = f.ClientSet.CoreV1().Pods(metav1.NamespaceSystem).Delete(dp.Name, &deleteOptions) @@ -197,12 +197,12 @@ func testDevicePlugin(f *framework.Framework, pluginSockDir string) { ginkgo.By("Checking that scheduled pods can continue to run even after we delete device plugin.") ensurePodContainerRestart(f, pod1.Name, pod1.Name) - devIdRestart1 = parseLog(f, pod1.Name, pod1.Name, deviceIDRE) - framework.ExpectEqual(devIdRestart1, devId1) + devIDRestart1 = parseLog(f, pod1.Name, pod1.Name, deviceIDRE) + framework.ExpectEqual(devIDRestart1, devID1) ensurePodContainerRestart(f, pod2.Name, pod2.Name) - devIdRestart2 := parseLog(f, pod2.Name, pod2.Name, deviceIDRE) - framework.ExpectEqual(devIdRestart2, devId2) + devIDRestart2 := parseLog(f, pod2.Name, pod2.Name, deviceIDRE) + framework.ExpectEqual(devIDRestart2, devID2) ginkgo.By("Re-register resources") devicePluginPod, err = f.ClientSet.CoreV1().Pods(metav1.NamespaceSystem).Create(dp) diff --git a/test/e2e_node/doc.go b/test/e2e_node/doc.go index 60976fbb578..b12d2349e72 100644 --- a/test/e2e_node/doc.go +++ b/test/e2e_node/doc.go @@ -14,6 +14,5 @@ See the License for the specific language governing permissions and limitations under the License. */ -// e2e_node contains e2e tests specific to the node -// TODO: rename this package e2e-node -package e2e_node // import "k8s.io/kubernetes/test/e2e_node" +// Package e2enode contains e2e tests specific to the node +package e2enode // import "k8s.io/kubernetes/test/e2e_node" diff --git a/test/e2e_node/docker_test.go b/test/e2e_node/docker_test.go index 17aca895ac0..fce13d75c5d 100644 --- a/test/e2e_node/docker_test.go +++ b/test/e2e_node/docker_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package e2e_node +package e2enode import ( "fmt" diff --git a/test/e2e_node/docker_util.go b/test/e2e_node/docker_util.go index 359e15cf2ec..1955b9dfd28 100644 --- a/test/e2e_node/docker_util.go +++ b/test/e2e_node/docker_util.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package e2e_node +package e2enode import ( "context" diff --git a/test/e2e_node/dockershim_checkpoint_test.go b/test/e2e_node/dockershim_checkpoint_test.go index b9720fc73cd..a20192b8654 100644 --- a/test/e2e_node/dockershim_checkpoint_test.go +++ b/test/e2e_node/dockershim_checkpoint_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package e2e_node +package e2enode import ( "crypto/md5" diff --git a/test/e2e_node/dynamic_kubelet_config_test.go b/test/e2e_node/dynamic_kubelet_config_test.go index 8334a6728f1..5fee470812b 100644 --- a/test/e2e_node/dynamic_kubelet_config_test.go +++ b/test/e2e_node/dynamic_kubelet_config_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package e2e_node +package e2enode import ( "fmt" diff --git a/test/e2e_node/e2e_node_suite_test.go b/test/e2e_node/e2e_node_suite_test.go index a47a2634632..0a34fba0402 100644 --- a/test/e2e_node/e2e_node_suite_test.go +++ b/test/e2e_node/e2e_node_suite_test.go @@ -18,7 +18,7 @@ limitations under the License. // To run tests in this suite // NOTE: This test suite requires password-less sudo capabilities to run the kubelet and kube-apiserver. -package e2e_node +package e2enode import ( "bytes" @@ -305,7 +305,7 @@ func getNode(c *clientset.Clientset) (*v1.Node, error) { nodes, err := c.CoreV1().Nodes().List(metav1.ListOptions{}) framework.ExpectNoError(err, "should be able to list nodes.") if nodes == nil { - return nil, fmt.Errorf("the node list is nil.") + return nil, fmt.Errorf("the node list is nil") } gomega.Expect(len(nodes.Items) > 1).NotTo(gomega.BeTrue(), "the number of nodes is more than 1.") if len(nodes.Items) == 0 { diff --git a/test/e2e_node/eviction_test.go b/test/e2e_node/eviction_test.go index 5f08d667cd0..cd6e8dac3ff 100644 --- a/test/e2e_node/eviction_test.go +++ b/test/e2e_node/eviction_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package e2e_node +package e2enode import ( "fmt" diff --git a/test/e2e_node/framework.go b/test/e2e_node/framework.go index e3d5b84e741..b93f05abb27 100644 --- a/test/e2e_node/framework.go +++ b/test/e2e_node/framework.go @@ -14,10 +14,11 @@ See the License for the specific language governing permissions and limitations under the License. */ -package e2e_node +package e2enode import "github.com/onsi/ginkgo" +// SIGDescribe annotates the test with the SIG label. func SIGDescribe(text string, body func()) bool { return ginkgo.Describe("[sig-node] "+text, body) } diff --git a/test/e2e_node/garbage_collector_test.go b/test/e2e_node/garbage_collector_test.go index 313b471b708..983651f792b 100644 --- a/test/e2e_node/garbage_collector_test.go +++ b/test/e2e_node/garbage_collector_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package e2e_node +package e2enode import ( "fmt" @@ -78,16 +78,16 @@ var _ = framework.KubeDescribe("GarbageCollect [Serial][NodeFeature:GarbageColle // They differentiate pods from one another, and allow filtering // by names to identify which containers belong to which pods // They must be unique, and must not end in a number - first_suffix := "one-container-no-restarts" - second_suffix := "many-containers-many-restarts-one-pod" - third_suffix := "many-containers-many-restarts-" + firstSuffix := "one-container-no-restarts" + secondSuffix := "many-containers-many-restarts-one-pod" + thirdSuffix := "many-containers-many-restarts-" tests := []testRun{ { testName: "One Non-restarting Container", testPods: []*testPodSpec{ { - podName: podNamePrefix + first_suffix, - containerPrefix: containerNamePrefix + first_suffix, + podName: podNamePrefix + firstSuffix, + containerPrefix: containerNamePrefix + firstSuffix, restartCount: 0, numContainers: 1, }, @@ -97,8 +97,8 @@ var _ = framework.KubeDescribe("GarbageCollect [Serial][NodeFeature:GarbageColle testName: "Many Restarting Containers", testPods: []*testPodSpec{ { - podName: podNamePrefix + second_suffix, - containerPrefix: containerNamePrefix + second_suffix, + podName: podNamePrefix + secondSuffix, + containerPrefix: containerNamePrefix + secondSuffix, restartCount: 4, numContainers: 4, }, @@ -108,20 +108,20 @@ var _ = framework.KubeDescribe("GarbageCollect [Serial][NodeFeature:GarbageColle testName: "Many Pods with Many Restarting Containers", testPods: []*testPodSpec{ { - podName: podNamePrefix + third_suffix + "one", - containerPrefix: containerNamePrefix + third_suffix + "one", + podName: podNamePrefix + thirdSuffix + "one", + containerPrefix: containerNamePrefix + thirdSuffix + "one", restartCount: 3, numContainers: 4, }, { - podName: podNamePrefix + third_suffix + "two", - containerPrefix: containerNamePrefix + third_suffix + "two", + podName: podNamePrefix + thirdSuffix + "two", + containerPrefix: containerNamePrefix + thirdSuffix + "two", restartCount: 2, numContainers: 6, }, { - podName: podNamePrefix + third_suffix + "three", - containerPrefix: containerNamePrefix + third_suffix + "three", + podName: podNamePrefix + thirdSuffix + "three", + containerPrefix: containerNamePrefix + thirdSuffix + "three", restartCount: 3, numContainers: 5, }, diff --git a/test/e2e_node/gke_environment_test.go b/test/e2e_node/gke_environment_test.go index cdd585c4724..43b9ff35f39 100644 --- a/test/e2e_node/gke_environment_test.go +++ b/test/e2e_node/gke_environment_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package e2e_node +package e2enode import ( "bytes" diff --git a/test/e2e_node/gpu_device_plugin_test.go b/test/e2e_node/gpu_device_plugin_test.go index 4a982b63bb7..90cdbb0c4c3 100644 --- a/test/e2e_node/gpu_device_plugin_test.go +++ b/test/e2e_node/gpu_device_plugin_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package e2e_node +package e2enode import ( "os/exec" @@ -79,7 +79,7 @@ var _ = framework.KubeDescribe("NVIDIA GPU Device Plugin [Feature:GPUDevicePlugi p1 := f.PodClient().CreateSync(makeBusyboxPod(gpu.NVIDIAGPUResourceName, podRECMD)) deviceIDRE := "gpu devices: (nvidia[0-9]+)" - devId1 := parseLog(f, p1.Name, p1.Name, deviceIDRE) + devID1 := parseLog(f, p1.Name, p1.Name, deviceIDRE) p1, err := f.PodClient().Get(p1.Name, metav1.GetOptions{}) framework.ExpectNoError(err) @@ -88,8 +88,8 @@ var _ = framework.KubeDescribe("NVIDIA GPU Device Plugin [Feature:GPUDevicePlugi ginkgo.By("Confirming that after a kubelet and pod restart, GPU assignment is kept") ensurePodContainerRestart(f, p1.Name, p1.Name) - devIdRestart1 := parseLog(f, p1.Name, p1.Name, deviceIDRE) - framework.ExpectEqual(devIdRestart1, devId1) + devIDRestart1 := parseLog(f, p1.Name, p1.Name, deviceIDRE) + framework.ExpectEqual(devIDRestart1, devID1) ginkgo.By("Restarting Kubelet and creating another pod") restartKubelet() @@ -100,9 +100,9 @@ var _ = framework.KubeDescribe("NVIDIA GPU Device Plugin [Feature:GPUDevicePlugi p2 := f.PodClient().CreateSync(makeBusyboxPod(gpu.NVIDIAGPUResourceName, podRECMD)) ginkgo.By("Checking that pods got a different GPU") - devId2 := parseLog(f, p2.Name, p2.Name, deviceIDRE) + devID2 := parseLog(f, p2.Name, p2.Name, deviceIDRE) - framework.ExpectEqual(devId1, devId2) + framework.ExpectEqual(devID1, devID2) ginkgo.By("Deleting device plugin.") f.ClientSet.CoreV1().Pods(metav1.NamespaceSystem).Delete(devicePluginPod.Name, &metav1.DeleteOptions{}) @@ -114,21 +114,21 @@ var _ = framework.KubeDescribe("NVIDIA GPU Device Plugin [Feature:GPUDevicePlugi }, 10*time.Minute, framework.Poll).Should(gomega.BeTrue()) ginkgo.By("Checking that scheduled pods can continue to run even after we delete device plugin.") ensurePodContainerRestart(f, p1.Name, p1.Name) - devIdRestart1 = parseLog(f, p1.Name, p1.Name, deviceIDRE) - framework.ExpectEqual(devIdRestart1, devId1) + devIDRestart1 = parseLog(f, p1.Name, p1.Name, deviceIDRE) + framework.ExpectEqual(devIDRestart1, devID1) ensurePodContainerRestart(f, p2.Name, p2.Name) - devIdRestart2 := parseLog(f, p2.Name, p2.Name, deviceIDRE) - framework.ExpectEqual(devIdRestart2, devId2) + devIDRestart2 := parseLog(f, p2.Name, p2.Name, deviceIDRE) + framework.ExpectEqual(devIDRestart2, devID2) ginkgo.By("Restarting Kubelet.") restartKubelet() ginkgo.By("Checking that scheduled pods can continue to run even after we delete device plugin and restart Kubelet.") ensurePodContainerRestart(f, p1.Name, p1.Name) - devIdRestart1 = parseLog(f, p1.Name, p1.Name, deviceIDRE) - framework.ExpectEqual(devIdRestart1, devId1) + devIDRestart1 = parseLog(f, p1.Name, p1.Name, deviceIDRE) + framework.ExpectEqual(devIDRestart1, devID1) ensurePodContainerRestart(f, p2.Name, p2.Name) - devIdRestart2 = parseLog(f, p2.Name, p2.Name, deviceIDRE) - framework.ExpectEqual(devIdRestart2, devId2) + devIDRestart2 = parseLog(f, p2.Name, p2.Name, deviceIDRE) + framework.ExpectEqual(devIDRestart2, devID2) logDevicePluginMetrics() // Cleanup diff --git a/test/e2e_node/hugepages_test.go b/test/e2e_node/hugepages_test.go index d2fc975dfad..4bdd2bb34f2 100644 --- a/test/e2e_node/hugepages_test.go +++ b/test/e2e_node/hugepages_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package e2e_node +package e2enode import ( "fmt" diff --git a/test/e2e_node/image_id_test.go b/test/e2e_node/image_id_test.go index e31a60abe8d..83fc9d4555b 100644 --- a/test/e2e_node/image_id_test.go +++ b/test/e2e_node/image_id_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package e2e_node +package e2enode import ( "k8s.io/api/core/v1" diff --git a/test/e2e_node/image_list.go b/test/e2e_node/image_list.go index 184aad8140b..dae236c57c6 100644 --- a/test/e2e_node/image_list.go +++ b/test/e2e_node/image_list.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package e2e_node +package e2enode import ( "fmt" @@ -133,7 +133,7 @@ func getPuller() (puller, error) { return nil, fmt.Errorf("can't prepull images, unknown container runtime %q", runtime) } -// Pre-fetch all images tests depend on so that we don't fail in an actual test. +// PrePullAllImages pre-fetches all images tests depend on so that we don't fail in an actual test. func PrePullAllImages() error { puller, err := getPuller() if err != nil { diff --git a/test/e2e_node/log_path_test.go b/test/e2e_node/log_path_test.go index 0624a807640..c7dd8e52182 100644 --- a/test/e2e_node/log_path_test.go +++ b/test/e2e_node/log_path_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package e2e_node +package e2enode import ( "github.com/onsi/ginkgo" diff --git a/test/e2e_node/mirror_pod_test.go b/test/e2e_node/mirror_pod_test.go index 5bfe7e3ef2f..a45f4128e44 100644 --- a/test/e2e_node/mirror_pod_test.go +++ b/test/e2e_node/mirror_pod_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package e2e_node +package e2enode import ( goerrors "errors" diff --git a/test/e2e_node/node_container_manager_test.go b/test/e2e_node/node_container_manager_test.go index 98d9b394760..ca25e96afe9 100644 --- a/test/e2e_node/node_container_manager_test.go +++ b/test/e2e_node/node_container_manager_test.go @@ -16,7 +16,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package e2e_node +package e2enode import ( "fmt" diff --git a/test/e2e_node/node_perf_test.go b/test/e2e_node/node_perf_test.go index ce26b6a0ccc..9b7b48c8a48 100644 --- a/test/e2e_node/node_perf_test.go +++ b/test/e2e_node/node_perf_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package e2e_node +package e2enode import ( "fmt" diff --git a/test/e2e_node/node_problem_detector_linux.go b/test/e2e_node/node_problem_detector_linux.go index d2495e67d2f..5c84248e385 100644 --- a/test/e2e_node/node_problem_detector_linux.go +++ b/test/e2e_node/node_problem_detector_linux.go @@ -16,7 +16,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package e2e_node +package e2enode import ( "fmt" diff --git a/test/e2e_node/pids_test.go b/test/e2e_node/pids_test.go index b90c76f4678..9d5d34ecb0f 100644 --- a/test/e2e_node/pids_test.go +++ b/test/e2e_node/pids_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package e2e_node +package e2enode import ( "fmt" diff --git a/test/e2e_node/pods_container_manager_test.go b/test/e2e_node/pods_container_manager_test.go index 16cddc8d00f..ecfa1449282 100644 --- a/test/e2e_node/pods_container_manager_test.go +++ b/test/e2e_node/pods_container_manager_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package e2e_node +package e2enode import ( "strings" diff --git a/test/e2e_node/quota_lsci_test.go b/test/e2e_node/quota_lsci_test.go index 6b3640777ed..c20d54b356d 100644 --- a/test/e2e_node/quota_lsci_test.go +++ b/test/e2e_node/quota_lsci_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package e2e_node +package e2enode import ( "fmt" diff --git a/test/e2e_node/resource_collector.go b/test/e2e_node/resource_collector.go index 78ef6ff183f..89dda692fd8 100644 --- a/test/e2e_node/resource_collector.go +++ b/test/e2e_node/resource_collector.go @@ -16,7 +16,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package e2e_node +package e2enode import ( "bytes" @@ -64,6 +64,8 @@ var ( systemContainers map[string]string ) +// ResourceCollector is a collector object which collects +// resource usage periodically from Cadvisor. type ResourceCollector struct { client *cadvisorclient.Client request *cadvisorapiv2.RequestOptions @@ -439,7 +441,7 @@ func newTestPods(numPods int, volume bool, imageName, podType string) []*v1.Pod return pods } -// GetResourceSeriesWithLabels gets the time series of resource usage of each container. +// GetResourceTimeSeries gets the time series of resource usage of each container. func (r *ResourceCollector) GetResourceTimeSeries() map[string]*perftype.ResourceSeries { resourceSeries := make(map[string]*perftype.ResourceSeries) for key, name := range systemContainers { @@ -461,12 +463,12 @@ const kubeletProcessName = "kubelet" func getPidsForProcess(name, pidFile string) ([]int, error) { if len(pidFile) > 0 { - if pid, err := getPidFromPidFile(pidFile); err == nil { + pid, err := getPidFromPidFile(pidFile) + if err == nil { return []int{pid}, nil - } else { - // log the error and fall back to pidof - runtime.HandleError(err) } + // log the error and fall back to pidof + runtime.HandleError(err) } return procfs.PidOf(name) } diff --git a/test/e2e_node/resource_metrics_test.go b/test/e2e_node/resource_metrics_test.go index 84f58e0e8e4..40676a84419 100644 --- a/test/e2e_node/resource_metrics_test.go +++ b/test/e2e_node/resource_metrics_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package e2e_node +package e2enode import ( "fmt" @@ -72,19 +72,19 @@ var _ = framework.KubeDescribe("ResourceMetricsAPI", func() { matchV1alpha1Expectations := gstruct.MatchAllKeys(gstruct.Keys{ "scrape_error": gstruct.Ignore(), - "node_cpu_usage_seconds_total": gstruct.MatchAllElements(nodeId, gstruct.Elements{ + "node_cpu_usage_seconds_total": gstruct.MatchAllElements(nodeID, gstruct.Elements{ "": boundedSample(1, 1e6), }), - "node_memory_working_set_bytes": gstruct.MatchAllElements(nodeId, gstruct.Elements{ + "node_memory_working_set_bytes": gstruct.MatchAllElements(nodeID, gstruct.Elements{ "": boundedSample(10*volume.Mb, memoryLimit), }), - "container_cpu_usage_seconds_total": gstruct.MatchElements(containerId, gstruct.IgnoreExtras, gstruct.Elements{ + "container_cpu_usage_seconds_total": gstruct.MatchElements(containerID, gstruct.IgnoreExtras, gstruct.Elements{ fmt.Sprintf("%s::%s::%s", f.Namespace.Name, pod0, "busybox-container"): boundedSample(0, 100), fmt.Sprintf("%s::%s::%s", f.Namespace.Name, pod1, "busybox-container"): boundedSample(0, 100), }), - "container_memory_working_set_bytes": gstruct.MatchAllElements(containerId, gstruct.Elements{ + "container_memory_working_set_bytes": gstruct.MatchAllElements(containerID, gstruct.Elements{ fmt.Sprintf("%s::%s::%s", f.Namespace.Name, pod0, "busybox-container"): boundedSample(10*volume.Kb, 80*volume.Mb), fmt.Sprintf("%s::%s::%s", f.Namespace.Name, pod1, "busybox-container"): boundedSample(10*volume.Kb, 80*volume.Mb), }), @@ -114,11 +114,11 @@ func getV1alpha1ResourceMetrics() (metrics.KubeletMetrics, error) { return metrics.GrabKubeletMetricsWithoutProxy(framework.TestContext.NodeName+":10255", "/metrics/resource/"+kubeletresourcemetricsv1alpha1.Version) } -func nodeId(element interface{}) string { +func nodeID(element interface{}) string { return "" } -func containerId(element interface{}) string { +func containerID(element interface{}) string { el := element.(*model.Sample) return fmt.Sprintf("%s::%s::%s", el.Metric["namespace"], el.Metric["pod"], el.Metric["container"]) } diff --git a/test/e2e_node/resource_usage_test.go b/test/e2e_node/resource_usage_test.go index 164dad9d2bb..1706dcbc5cf 100644 --- a/test/e2e_node/resource_usage_test.go +++ b/test/e2e_node/resource_usage_test.go @@ -16,7 +16,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package e2e_node +package e2enode import ( "fmt" diff --git a/test/e2e_node/restart_test.go b/test/e2e_node/restart_test.go index f161b7b033a..fb543e77ce4 100644 --- a/test/e2e_node/restart_test.go +++ b/test/e2e_node/restart_test.go @@ -16,7 +16,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package e2e_node +package e2enode import ( "fmt" @@ -33,9 +33,9 @@ import ( "github.com/onsi/gomega" ) -// waitForPods waits for timeout duration, for pod_count. +// waitForPods waits for timeout duration, for podCount. // If the timeout is hit, it returns the list of currently running pods. -func waitForPods(f *framework.Framework, pod_count int, timeout time.Duration) (runningPods []*v1.Pod) { +func waitForPods(f *framework.Framework, podCount int, timeout time.Duration) (runningPods []*v1.Pod) { for start := time.Now(); time.Since(start) < timeout; time.Sleep(10 * time.Second) { podList, err := f.PodClient().List(metav1.ListOptions{}) if err != nil { @@ -51,7 +51,7 @@ func waitForPods(f *framework.Framework, pod_count int, timeout time.Duration) ( runningPods = append(runningPods, &pod) } framework.Logf("Running pod count %d", len(runningPods)) - if len(runningPods) >= pod_count { + if len(runningPods) >= podCount { break } } @@ -92,7 +92,7 @@ var _ = framework.KubeDescribe("Restart [Serial] [Slow] [Disruptive] [NodeFeatur framework.Failf("Failed to start %d pods, cannot test that restarting container runtime doesn't leak IPs", minPods) } - for i := 0; i < restartCount; i += 1 { + for i := 0; i < restartCount; i++ { ginkgo.By(fmt.Sprintf("Killing container runtime iteration %d", i)) // Wait for container runtime to be running var pid int diff --git a/test/e2e_node/runtime_conformance_test.go b/test/e2e_node/runtime_conformance_test.go index 9fbf3f51d3e..663233951c8 100644 --- a/test/e2e_node/runtime_conformance_test.go +++ b/test/e2e_node/runtime_conformance_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package e2e_node +package e2enode import ( "fmt" diff --git a/test/e2e_node/security_context_test.go b/test/e2e_node/security_context_test.go index b87f5047462..51931c5a39f 100644 --- a/test/e2e_node/security_context_test.go +++ b/test/e2e_node/security_context_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package e2e_node +package e2enode import ( "fmt" diff --git a/test/e2e_node/startup_probe_test.go b/test/e2e_node/startup_probe_test.go index 34de757db4d..2ff7cad0b4f 100644 --- a/test/e2e_node/startup_probe_test.go +++ b/test/e2e_node/startup_probe_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package e2e_node +package e2enode import ( "time" diff --git a/test/e2e_node/summary_test.go b/test/e2e_node/summary_test.go index ab193b50640..9f58ca69a79 100644 --- a/test/e2e_node/summary_test.go +++ b/test/e2e_node/summary_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package e2e_node +package e2enode import ( "fmt" diff --git a/test/e2e_node/system_node_critical_test.go b/test/e2e_node/system_node_critical_test.go index 5660be7f1c7..9a9c7224d24 100644 --- a/test/e2e_node/system_node_critical_test.go +++ b/test/e2e_node/system_node_critical_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package e2e_node +package e2enode import ( "fmt" diff --git a/test/e2e_node/util.go b/test/e2e_node/util.go index a48ab25895e..fef0046f46d 100644 --- a/test/e2e_node/util.go +++ b/test/e2e_node/util.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package e2e_node +package e2enode import ( "encoding/json" diff --git a/test/e2e_node/util_xfs_linux.go b/test/e2e_node/util_xfs_linux.go index 560674ffa59..b3d387b4a13 100644 --- a/test/e2e_node/util_xfs_linux.go +++ b/test/e2e_node/util_xfs_linux.go @@ -16,7 +16,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package e2e_node +package e2enode import ( "path/filepath" diff --git a/test/e2e_node/util_xfs_unsupported.go b/test/e2e_node/util_xfs_unsupported.go index 01fdb802b30..b8c36498d1e 100644 --- a/test/e2e_node/util_xfs_unsupported.go +++ b/test/e2e_node/util_xfs_unsupported.go @@ -16,7 +16,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package e2e_node +package e2enode func isXfs(dir string) bool { return false diff --git a/test/e2e_node/volume_manager_test.go b/test/e2e_node/volume_manager_test.go index 044f453e7f5..1a8c25d44da 100644 --- a/test/e2e_node/volume_manager_test.go +++ b/test/e2e_node/volume_manager_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package e2e_node +package e2enode import ( "time"