From 3b438eb4e579bbe7d1731a7f51236218536ff2f7 Mon Sep 17 00:00:00 2001 From: wojtekt Date: Wed, 3 Mar 2021 07:57:20 +0100 Subject: [PATCH] Cleanup test/e2e/common directory - part2 --- test/conformance/testdata/conformance.yaml | 120 +++++++-------- test/e2e/common/framework.go | 29 ---- test/e2e/common/{ => node}/container.go | 2 +- test/e2e/common/{ => node}/container_probe.go | 4 +- .../common/{ => node}/docker_containers.go | 4 +- test/e2e/common/{ => node}/downwardapi.go | 110 +------------- test/e2e/common/{ => node}/expansion.go | 4 +- test/e2e/common/{ => node}/init_container.go | 4 +- test/e2e/common/{ => node}/kubelet.go | 4 +- .../common/{ => node}/kubelet_etc_hosts.go | 4 +- test/e2e/common/{ => node}/lease.go | 4 +- test/e2e/common/{ => node}/lifecycle_hook.go | 4 +- test/e2e/common/{ => node}/node_lease.go | 4 +- test/e2e/common/{ => node}/pods.go | 4 +- test/e2e/common/{ => node}/privileged.go | 4 +- test/e2e/common/{ => node}/runtime.go | 4 +- .../e2e/common/{ => node}/security_context.go | 9 +- test/e2e/common/{ => node}/sysctl.go | 4 +- test/e2e/common/storage/downwardapi.go | 140 ++++++++++++++++++ test/e2e/common/util.go | 7 +- test/e2e_node/runtime_conformance_test.go | 10 +- 21 files changed, 243 insertions(+), 236 deletions(-) delete mode 100644 test/e2e/common/framework.go rename test/e2e/common/{ => node}/container.go (99%) rename test/e2e/common/{ => node}/container_probe.go (99%) rename test/e2e/common/{ => node}/docker_containers.go (98%) rename test/e2e/common/{ => node}/downwardapi.go (73%) rename test/e2e/common/{ => node}/expansion.go (99%) rename test/e2e/common/{ => node}/init_container.go (99%) rename test/e2e/common/{ => node}/kubelet.go (99%) rename test/e2e/common/{ => node}/kubelet_etc_hosts.go (99%) rename test/e2e/common/{ => node}/lease.go (99%) rename test/e2e/common/{ => node}/lifecycle_hook.go (98%) rename test/e2e/common/{ => node}/node_lease.go (99%) rename test/e2e/common/{ => node}/pods.go (99%) rename test/e2e/common/{ => node}/privileged.go (97%) rename test/e2e/common/{ => node}/runtime.go (99%) rename test/e2e/common/{ => node}/security_context.go (99%) rename test/e2e/common/{ => node}/sysctl.go (98%) create mode 100644 test/e2e/common/storage/downwardapi.go diff --git a/test/conformance/testdata/conformance.yaml b/test/conformance/testdata/conformance.yaml index 4fd3f768890..f88ad75570d 100755 --- a/test/conformance/testdata/conformance.yaml +++ b/test/conformance/testdata/conformance.yaml @@ -1452,7 +1452,7 @@ a container lifecycle specifying a post start that invokes the server pod using ExecAction to validate that the post start is executed. release: v1.9 - file: test/e2e/common/lifecycle_hook.go + file: test/e2e/common/node/lifecycle_hook.go - testname: Pod Lifecycle, post start http hook codename: '[sig-node] Container Lifecycle Hook when create a pod with lifecycle hook should execute poststart http hook properly [NodeConformance] [Conformance]' @@ -1462,7 +1462,7 @@ a container lifecycle specifying a post start that invokes the server pod to validate that the post start is executed. release: v1.9 - file: test/e2e/common/lifecycle_hook.go + file: test/e2e/common/node/lifecycle_hook.go - testname: Pod Lifecycle, prestop exec hook codename: '[sig-node] Container Lifecycle Hook when create a pod with lifecycle hook should execute prestop exec hook properly [NodeConformance] [Conformance]' @@ -1472,7 +1472,7 @@ a container lifecycle specifying a pre-stop that invokes the server pod using ExecAction to validate that the pre-stop is executed. release: v1.9 - file: test/e2e/common/lifecycle_hook.go + file: test/e2e/common/node/lifecycle_hook.go - testname: Pod Lifecycle, prestop http hook codename: '[sig-node] Container Lifecycle Hook when create a pod with lifecycle hook should execute prestop http hook properly [NodeConformance] [Conformance]' @@ -1482,7 +1482,7 @@ a container lifecycle specifying a pre-stop that invokes the server pod to validate that the pre-stop is executed. release: v1.9 - file: test/e2e/common/lifecycle_hook.go + file: test/e2e/common/node/lifecycle_hook.go - testname: Container Runtime, TerminationMessage, from log output of succeeding container codename: '[sig-node] Container Runtime blackbox test on terminated container should report termination message [LinuxOnly] as empty when pod succeeds and TerminationMessagePolicy @@ -1492,7 +1492,7 @@ terminationMessage MUST have no content as container succeed. [LinuxOnly]: Cannot mount files in Windows Containers.' release: v1.15 - file: test/e2e/common/runtime.go + file: test/e2e/common/node/runtime.go - testname: Container Runtime, TerminationMessage, from file of succeeding container codename: '[sig-node] Container Runtime blackbox test on terminated container should report termination message [LinuxOnly] from file when pod succeeds and TerminationMessagePolicy @@ -1502,7 +1502,7 @@ terminated, terminationMessage MUST match with the content from file. [LinuxOnly]: Cannot mount files in Windows Containers.' release: v1.15 - file: test/e2e/common/runtime.go + file: test/e2e/common/node/runtime.go - testname: Container Runtime, TerminationMessage, from container's log output of failing container codename: '[sig-node] Container Runtime blackbox test on terminated container should @@ -1513,7 +1513,7 @@ message MUST match the expected output recorded from container''s log. [LinuxOnly]: Cannot mount files in Windows Containers.' release: v1.15 - file: test/e2e/common/runtime.go + file: test/e2e/common/node/runtime.go - testname: Container Runtime, TerminationMessagePath, non-root user and non-default path codename: '[sig-node] Container Runtime blackbox test on terminated container should @@ -1525,7 +1525,7 @@ the expected output logged in the provided custom path. [LinuxOnly]: Tagged LinuxOnly due to use of ''uid'' and unable to mount files in Windows Containers.' release: v1.15 - file: test/e2e/common/runtime.go + file: test/e2e/common/node/runtime.go - testname: Container Runtime, Restart Policy, Pod Phases codename: '[sig-node] Container Runtime blackbox test when starting a container that exits should run with the expected status [NodeConformance] [Conformance]' @@ -1535,7 +1535,7 @@ never be restarted. All these three test cases MUST verify the restart counts accordingly. release: v1.13 - file: test/e2e/common/runtime.go + file: test/e2e/common/node/runtime.go - testname: Docker containers, with arguments codename: '[sig-node] Docker Containers should be able to override the image''s default arguments (docker cmd) [NodeConformance] [Conformance]' @@ -1543,7 +1543,7 @@ when Pod does not specify the container command but the arguments from Pod spec MUST override when specified. release: v1.9 - file: test/e2e/common/docker_containers.go + file: test/e2e/common/node/docker_containers.go - testname: Docker containers, with command codename: '[sig-node] Docker Containers should be able to override the image''s default command (docker entrypoint) [NodeConformance] [Conformance]' @@ -1551,7 +1551,7 @@ Pod specifies the container command. Command from Pod spec MUST override the command in the image. release: v1.9 - file: test/e2e/common/docker_containers.go + file: test/e2e/common/node/docker_containers.go - testname: Docker containers, with command and arguments codename: '[sig-node] Docker Containers should be able to override the image''s default command and arguments [NodeConformance] [Conformance]' @@ -1559,28 +1559,28 @@ NOT be used when Pod specifies the container command and arguments. Command and arguments from Pod spec MUST override the command and arguments in the image. release: v1.9 - file: test/e2e/common/docker_containers.go + file: test/e2e/common/node/docker_containers.go - testname: Docker containers, without command and arguments codename: '[sig-node] Docker Containers should use the image defaults if command and args are blank [NodeConformance] [Conformance]' description: Default command and arguments from the docker image entrypoint MUST be used when Pod does not specify the container command release: v1.9 - file: test/e2e/common/docker_containers.go + file: test/e2e/common/node/docker_containers.go - testname: DownwardAPI, environment for CPU and memory limits and requests codename: '[sig-node] Downward API should provide container''s limits.cpu/memory and requests.cpu/memory as env vars [NodeConformance] [Conformance]' description: Downward API MUST expose CPU request and Memory request set through environment variables at runtime in the container. release: v1.9 - file: test/e2e/common/downwardapi.go + file: test/e2e/common/node/downwardapi.go - testname: DownwardAPI, environment for default CPU and memory limits and requests codename: '[sig-node] Downward API should provide default limits.cpu/memory from node allocatable [NodeConformance] [Conformance]' description: Downward API MUST expose CPU request and Memory limits set through environment variables at runtime in the container. release: v1.9 - file: test/e2e/common/downwardapi.go + file: test/e2e/common/node/downwardapi.go - testname: DownwardAPI, environment for host ip codename: '[sig-node] Downward API should provide host IP as an env var [NodeConformance] [Conformance]' @@ -1588,14 +1588,14 @@ Specify host IP as environment variable in the Pod Spec are visible at runtime in the container. release: v1.9 - file: test/e2e/common/downwardapi.go + file: test/e2e/common/node/downwardapi.go - testname: DownwardAPI, environment for Pod UID codename: '[sig-node] Downward API should provide pod UID as env vars [NodeConformance] [Conformance]' description: Downward API MUST expose Pod UID set through environment variables at runtime in the container. release: v1.9 - file: test/e2e/common/downwardapi.go + file: test/e2e/common/node/downwardapi.go - testname: DownwardAPI, environment for name, namespace and ip codename: '[sig-node] Downward API should provide pod name, namespace and IP address as env vars [NodeConformance] [Conformance]' @@ -1603,7 +1603,7 @@ Specify Pod Name, namespace and IP as environment variable in the Pod Spec are visible at runtime in the container. release: v1.9 - file: test/e2e/common/downwardapi.go + file: test/e2e/common/node/downwardapi.go - testname: Pod events, verify event from Scheduler and Kubelet codename: '[sig-node] Events should be sent by kubelets and the scheduler about pods scheduling and running [Conformance]' @@ -1621,7 +1621,7 @@ started and at least one container is still running or is in the process of being restarted when Pod has restart policy as RestartAlways. release: v1.12 - file: test/e2e/common/init_container.go + file: test/e2e/common/node/init_container.go - testname: init-container-starts-app-restartnever-pod codename: '[sig-node] InitContainer [NodeConformance] should invoke init containers on a RestartNever pod [Conformance]' @@ -1629,14 +1629,14 @@ are voluntarily terminated with exit status 0, and the system is not going to restart any of these containers when Pod has restart policy as RestartNever. release: v1.12 - file: test/e2e/common/init_container.go + file: test/e2e/common/node/init_container.go - testname: init-container-fails-stops-app-restartnever-pod codename: '[sig-node] InitContainer [NodeConformance] should not start app containers and fail the pod if init containers fail on a RestartNever pod [Conformance]' description: Ensure that app container is not started when at least one InitContainer fails to start and Pod has restart policy as RestartNever. release: v1.12 - file: test/e2e/common/init_container.go + file: test/e2e/common/node/init_container.go - testname: init-container-fails-stops-app-restartalways-pod codename: '[sig-node] InitContainer [NodeConformance] should not start app containers if init containers fail on a RestartAlways pod [Conformance]' @@ -1644,7 +1644,7 @@ to start and Pod has restarted for few occurrences and pod has restart policy as RestartAlways. release: v1.12 - file: test/e2e/common/init_container.go + file: test/e2e/common/node/init_container.go - testname: Kubelet, hostAliases codename: '[sig-node] Kubelet when scheduling a busybox Pod with hostAliases should write entries to /etc/hosts [LinuxOnly] [NodeConformance] [Conformance]' @@ -1654,28 +1654,28 @@ its containers, however, mounting individual files is not supported on Windows Containers. For this reason, this test is marked LinuxOnly. release: v1.13 - file: test/e2e/common/kubelet.go + file: test/e2e/common/node/kubelet.go - testname: Kubelet, log output, default codename: '[sig-node] Kubelet when scheduling a busybox command in a pod should print the output to logs [NodeConformance] [Conformance]' description: By default the stdout and stderr from the process being executed in a pod MUST be sent to the pod's logs. release: v1.13 - file: test/e2e/common/kubelet.go + file: test/e2e/common/node/kubelet.go - testname: Kubelet, failed pod, delete codename: '[sig-node] Kubelet when scheduling a busybox command that always fails in a pod should be possible to delete [NodeConformance] [Conformance]' description: Create a Pod with terminated state. This terminated pod MUST be able to be deleted. release: v1.13 - file: test/e2e/common/kubelet.go + file: test/e2e/common/node/kubelet.go - testname: Kubelet, failed pod, terminated reason codename: '[sig-node] Kubelet when scheduling a busybox command that always fails in a pod should have an terminated reason [NodeConformance] [Conformance]' description: Create a Pod with terminated state. Pod MUST have only one container. Container MUST be in terminated state and MUST have an terminated reason. release: v1.13 - file: test/e2e/common/kubelet.go + file: test/e2e/common/node/kubelet.go - testname: Kubelet, pod with read only root file system codename: '[sig-node] Kubelet when scheduling a read only busybox container should not write to root filesystem [LinuxOnly] [NodeConformance] [Conformance]' @@ -1684,7 +1684,7 @@ to the root filesystem MUST fail as expected. This test is marked LinuxOnly since Windows does not support creating containers with read-only access. release: v1.13 - file: test/e2e/common/kubelet.go + file: test/e2e/common/node/kubelet.go - testname: Kubelet, managed etc hosts codename: '[sig-node] KubeletManagedEtcHosts should test kubelet managed /etc/hosts file [LinuxOnly] [NodeConformance] [Conformance]' @@ -1697,7 +1697,7 @@ not be managed by the Kubelet. This test is marked LinuxOnly since Windows cannot mount individual files in Containers. release: v1.9 - file: test/e2e/common/kubelet_etc_hosts.go + file: test/e2e/common/node/kubelet_etc_hosts.go - testname: lease API should be available codename: '[sig-node] Lease lease API should be available [Conformance]' description: "Create Lease object, and get it; create and get MUST be successful @@ -1711,7 +1711,7 @@ list MUST be successful and MUST return just the remaining lease. Delete the lease; delete MUST be successful. Get the lease; get MUST return not found error." release: v1.17 - file: test/e2e/common/lease.go + file: test/e2e/common/node/lease.go - testname: Pod Eviction, Toleration limits codename: '[sig-node] NoExecuteTaintManager Multiple Pods [Serial] evicts pods with minTolerationSeconds [Disruptive] [Conformance]' @@ -1755,7 +1755,7 @@ as selector MUST be successful. The Pod is updated with ActiveDeadlineSeconds set on the Pod spec. Pod MUST terminate of the specified time elapses. release: v1.9 - file: test/e2e/common/pods.go + file: test/e2e/common/node/pods.go - testname: Pods, lifecycle codename: '[sig-node] Pods should be submitted and removed [NodeConformance] [Conformance]' description: A Pod is created with a unique label. Pod MUST be accessible when queried @@ -1764,14 +1764,14 @@ the pod deleted event. Query with the original selector for the Pod MUST return empty list. release: v1.9 - file: test/e2e/common/pods.go + file: test/e2e/common/node/pods.go - testname: Pods, update codename: '[sig-node] Pods should be updated [NodeConformance] [Conformance]' description: Create a Pod with a unique label. Query for the Pod with the label as selector MUST be successful. Update the pod to change the value of the Label. Query for the Pod with the new value for the label MUST be successful. release: v1.9 - file: test/e2e/common/pods.go + file: test/e2e/common/node/pods.go - testname: Pods, service environment variables codename: '[sig-node] Pods should contain environment variables for services [NodeConformance] [Conformance]' @@ -1783,20 +1783,20 @@ FOOSERVICE_PORT_8765_TCP_PORT, FOOSERVICE_PORT_8765_TCP_PROTO, FOOSERVICE_PORT_8765_TCP and FOOSERVICE_PORT_8765_TCP_ADDR that are populated with proper values. release: v1.9 - file: test/e2e/common/pods.go + file: test/e2e/common/node/pods.go - testname: Pods, delete a collection codename: '[sig-node] Pods should delete a collection of pods [Conformance]' description: A set of pods is created with a label selector which MUST be found when listed. The set of pods is deleted and MUST NOT show up when listed by its label selector. release: v1.19 - file: test/e2e/common/pods.go + file: test/e2e/common/node/pods.go - testname: Pods, assigned hostip codename: '[sig-node] Pods should get a host IP [NodeConformance] [Conformance]' description: Create a Pod. Pod status MUST return successfully and contains a valid IP address. release: v1.9 - file: test/e2e/common/pods.go + file: test/e2e/common/node/pods.go - testname: Pods, completes the lifecycle of a Pod and the PodStatus codename: '[sig-node] Pods should run through the lifecycle of Pods and PodStatus [Conformance]' @@ -1804,7 +1804,7 @@ when patching the label and the pod data. When checking and replacing the PodStatus it MUST succeed. It MUST succeed when deleting the Pod. release: v1.20 - file: test/e2e/common/pods.go + file: test/e2e/common/node/pods.go - testname: Pods, remote command execution over websocket codename: '[sig-node] Pods should support remote command execution over websockets [NodeConformance] [Conformance]' @@ -1812,14 +1812,14 @@ from this pod. Message retrieved form Websocket MUST match with expected exec command output. release: v1.13 - file: test/e2e/common/pods.go + file: test/e2e/common/node/pods.go - testname: Pods, logs from websockets codename: '[sig-node] Pods should support retrieving logs from the container over websockets [NodeConformance] [Conformance]' description: A Pod is created. Websocket is created to retrieve log of a container from this pod. Message retrieved form Websocket MUST match with container's output. release: v1.13 - file: test/e2e/common/pods.go + file: test/e2e/common/node/pods.go - testname: Pods, prestop hook codename: '[sig-node] PreStop should call prestop when killing a pod [Conformance]' description: Create a server pod with a rest endpoint '/write' that changes state.Received @@ -1837,7 +1837,7 @@ probe on this endpoint will not fail. When liveness probe does not fail then the restart count MUST remain zero. release: v1.9 - file: test/e2e/common/container_probe.go + file: test/e2e/common/node/container_probe.go - testname: Pod liveness probe, using local file, no restart codename: '[sig-node] Probing container should *not* be restarted with a exec "cat /tmp/health" liveness probe [NodeConformance] [Conformance]' @@ -1845,7 +1845,7 @@ /temp/health file. Liveness probe MUST not fail to check health and the restart count should remain 0. release: v1.9 - file: test/e2e/common/container_probe.go + file: test/e2e/common/node/container_probe.go - testname: Pod liveness probe, using tcp socket, no restart codename: '[sig-node] Probing container should *not* be restarted with a tcp:8080 liveness probe [NodeConformance] [Conformance]' @@ -1854,7 +1854,7 @@ open. Liveness probe MUST not fail to check health and the restart count should remain 0. release: v1.18 - file: test/e2e/common/container_probe.go + file: test/e2e/common/node/container_probe.go - testname: Pod liveness probe, using http endpoint, restart codename: '[sig-node] Probing container should be restarted with a /healthz http liveness probe [NodeConformance] [Conformance]' @@ -1863,7 +1863,7 @@ Pod is started. This MUST result in liveness check failure. The Pod MUST now be killed and restarted incrementing restart count to 1. release: v1.9 - file: test/e2e/common/container_probe.go + file: test/e2e/common/node/container_probe.go - testname: Pod liveness probe, using local file, restart codename: '[sig-node] Probing container should be restarted with a exec "cat /tmp/health" liveness probe [NodeConformance] [Conformance]' @@ -1872,7 +1872,7 @@ triggering liveness probe to fail. The Pod MUST now be killed and restarted incrementing restart count to 1. release: v1.9 - file: test/e2e/common/container_probe.go + file: test/e2e/common/node/container_probe.go - testname: Pod liveness probe, container exec timeout, restart codename: '[sig-node] Probing container should be restarted with an exec liveness probe with timeout [NodeConformance] [Conformance]' @@ -1880,7 +1880,7 @@ If the liveness probe call does not return within the timeout specified, liveness probe MUST restart the Pod. release: v1.9 - file: test/e2e/common/container_probe.go + file: test/e2e/common/node/container_probe.go - testname: Pod liveness probe, using http endpoint, multiple restarts (slow) codename: '[sig-node] Probing container should have monotonically increasing restart count [NodeConformance] [Conformance]' @@ -1892,7 +1892,7 @@ returns an http error after 10 seconds from the start. Restart counts MUST increment everytime health check fails, measure upto 5 restart. release: v1.9 - file: test/e2e/common/container_probe.go + file: test/e2e/common/node/container_probe.go - testname: Pod readiness probe, container exec timeout, not ready codename: '[sig-node] Probing container should not be ready with an exec readiness probe timeout [NodeConformance] [Conformance]' @@ -1900,7 +1900,7 @@ If the readiness probe call does not return within the timeout specified, readiness probe MUST not be Ready. release: v1.20 - file: test/e2e/common/container_probe.go + file: test/e2e/common/node/container_probe.go - testname: Pod readiness probe, with initial delay codename: '[sig-node] Probing container with readiness probe should not be ready before initial delay and never restart [NodeConformance] [Conformance]' @@ -1908,7 +1908,7 @@ probe. Check the Pod Start time to compare to the initial delay. The Pod MUST be ready only after the specified initial delay. release: v1.9 - file: test/e2e/common/container_probe.go + file: test/e2e/common/node/container_probe.go - testname: Pod readiness probe, failure codename: '[sig-node] Probing container with readiness probe that fails should never be ready and never restart [NodeConformance] [Conformance]' @@ -1916,7 +1916,7 @@ Pod is created, then the Pod MUST never be ready, never be running and restart count MUST be zero. release: v1.9 - file: test/e2e/common/container_probe.go + file: test/e2e/common/node/container_probe.go - testname: RuntimeClass API codename: '[sig-node] RuntimeClass should support RuntimeClasses API operations [Conformance]' @@ -1966,7 +1966,7 @@ run as unpriviledged user. Pod MUST be in Succeeded phase. [LinuxOnly]: This test is marked as LinuxOnly since Windows does not support running as UID / GID.' release: v1.15 - file: test/e2e/common/security_context.go + file: test/e2e/common/node/security_context.go - testname: Security Context, privileged=false. codename: '[sig-node] Security Context When creating a pod with privileged should run the container as unprivileged when false [LinuxOnly] [NodeConformance] [Conformance]' @@ -1974,7 +1974,7 @@ Privileged option as false. Pod MUST be in Succeeded phase. [LinuxOnly]: This test is marked as LinuxOnly since it runs a Linux-specific command.' release: v1.15 - file: test/e2e/common/security_context.go + file: test/e2e/common/node/security_context.go - testname: Security Context, readOnlyRootFilesystem=false. codename: '[sig-node] Security Context When creating a pod with readOnlyRootFilesystem should run the container with writable rootfs when readOnlyRootFilesystem=false @@ -1982,7 +1982,7 @@ description: Container is configured to run with readOnlyRootFilesystem to false. Write operation MUST be allowed and Pod MUST be in Succeeded state. release: v1.15 - file: test/e2e/common/security_context.go + file: test/e2e/common/node/security_context.go - testname: Security Context, test RunAsGroup at container level codename: '[sig-node] Security Context should support container.SecurityContext.RunAsUser And container.SecurityContext.RunAsGroup [LinuxOnly] [Conformance]' @@ -2012,14 +2012,14 @@ i.e. uid=1000. [LinuxOnly]: This test is marked LinuxOnly since Windows does not support running as UID / GID, or privilege escalation.' release: v1.15 - file: test/e2e/common/security_context.go + file: test/e2e/common/node/security_context.go - testname: Environment variables, expansion codename: '[sig-node] Variable Expansion should allow composing env vars into new env vars [NodeConformance] [Conformance]' description: Create a Pod with environment variables. Environment variables defined using previously defined environment variables MUST expand to proper values. release: v1.9 - file: test/e2e/common/expansion.go + file: test/e2e/common/node/expansion.go - testname: Environment variables, command argument expansion codename: '[sig-node] Variable Expansion should allow substituting values in a container''s args [NodeConformance] [Conformance]' @@ -2027,7 +2027,7 @@ using them. Container command arguments using the defined environment variables MUST expand to proper values. release: v1.9 - file: test/e2e/common/expansion.go + file: test/e2e/common/node/expansion.go - testname: Environment variables, command expansion codename: '[sig-node] Variable Expansion should allow substituting values in a container''s command [NodeConformance] [Conformance]' @@ -2035,28 +2035,28 @@ them. Container command using the defined environment variables MUST expand to proper values. release: v1.9 - file: test/e2e/common/expansion.go + file: test/e2e/common/node/expansion.go - testname: VolumeSubpathEnvExpansion, subpath expansion codename: '[sig-node] Variable Expansion should allow substituting values in a volume subpath [sig-storage] [Conformance]' description: Make sure a container's subpath can be set using an expansion of environment variables. release: v1.19 - file: test/e2e/common/expansion.go + file: test/e2e/common/node/expansion.go - testname: VolumeSubpathEnvExpansion, subpath with absolute path codename: '[sig-node] Variable Expansion should fail substituting values in a volume subpath with absolute path [sig-storage][Slow] [Conformance]' description: Make sure a container's subpath can not be set using an expansion of environment variables when absolute path is supplied. release: v1.19 - file: test/e2e/common/expansion.go + file: test/e2e/common/node/expansion.go - testname: VolumeSubpathEnvExpansion, subpath with backticks codename: '[sig-node] Variable Expansion should fail substituting values in a volume subpath with backticks [sig-storage][Slow] [Conformance]' description: Make sure a container's subpath can not be set using an expansion of environment variables when backticks are supplied. release: v1.19 - file: test/e2e/common/expansion.go + file: test/e2e/common/node/expansion.go - testname: VolumeSubpathEnvExpansion, subpath test writes codename: '[sig-node] Variable Expansion should succeed in writing subpaths in container [sig-storage][Slow] [Conformance]' @@ -2064,14 +2064,14 @@ 1.\tvalid subpathexpr starts a container running 2.\ttest for valid subpath writes 3.\tsuccessful expansion of the subpathexpr isn't required for volume cleanup" release: v1.19 - file: test/e2e/common/expansion.go + file: test/e2e/common/node/expansion.go - testname: VolumeSubpathEnvExpansion, subpath ready from failed state codename: '[sig-node] Variable Expansion should verify that a failing subpath expansion can be modified during the lifecycle of a container [sig-storage][Slow] [Conformance]' description: Verify that a failing subpath expansion can be modified during the lifecycle of a container. release: v1.19 - file: test/e2e/common/expansion.go + file: test/e2e/common/node/expansion.go - testname: LimitRange, resources codename: '[sig-scheduling] LimitRange should create a LimitRange with defaults and ensure pod has those defaults applied. [Conformance]' diff --git a/test/e2e/common/framework.go b/test/e2e/common/framework.go deleted file mode 100644 index ea936f80e21..00000000000 --- a/test/e2e/common/framework.go +++ /dev/null @@ -1,29 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package common - -import "github.com/onsi/ginkgo" - -// SIGNodeDescribe annotates the test with the SIG Node label. -func SIGNodeDescribe(text string, body func()) bool { - return ginkgo.Describe("[sig-node] "+text, body) -} - -// SIGStorageDescribe annotates the test with the SIG Storage label. -func SIGStorageDescribe(text string, body func()) bool { - return ginkgo.Describe("[sig-storage] "+text, body) -} diff --git a/test/e2e/common/container.go b/test/e2e/common/node/container.go similarity index 99% rename from test/e2e/common/container.go rename to test/e2e/common/node/container.go index 59ef844cb12..89efb24ae4b 100644 --- a/test/e2e/common/container.go +++ b/test/e2e/common/node/container.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package common +package node import ( "context" diff --git a/test/e2e/common/container_probe.go b/test/e2e/common/node/container_probe.go similarity index 99% rename from test/e2e/common/container_probe.go rename to test/e2e/common/node/container_probe.go index 94931b11c55..c69412c2315 100644 --- a/test/e2e/common/container_probe.go +++ b/test/e2e/common/node/container_probe.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package common +package node import ( "context" @@ -45,7 +45,7 @@ const ( defaultObservationTimeout = time.Minute * 4 ) -var _ = SIGNodeDescribe("Probing container", func() { +var _ = SIGDescribe("Probing container", func() { f := framework.NewDefaultFramework("container-probe") var podClient *framework.PodClient probe := webserverProbeBuilder{} diff --git a/test/e2e/common/docker_containers.go b/test/e2e/common/node/docker_containers.go similarity index 98% rename from test/e2e/common/docker_containers.go rename to test/e2e/common/node/docker_containers.go index 9d0235daad7..9bd8ba685ca 100644 --- a/test/e2e/common/docker_containers.go +++ b/test/e2e/common/node/docker_containers.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package common +package node import ( "github.com/onsi/gomega" @@ -25,7 +25,7 @@ import ( e2epod "k8s.io/kubernetes/test/e2e/framework/pod" ) -var _ = SIGNodeDescribe("Docker Containers", func() { +var _ = SIGDescribe("Docker Containers", func() { f := framework.NewDefaultFramework("containers") /* diff --git a/test/e2e/common/downwardapi.go b/test/e2e/common/node/downwardapi.go similarity index 73% rename from test/e2e/common/downwardapi.go rename to test/e2e/common/node/downwardapi.go index d1ce0fc79b9..99fc8213590 100644 --- a/test/e2e/common/downwardapi.go +++ b/test/e2e/common/node/downwardapi.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package common +package node import ( "fmt" @@ -25,13 +25,12 @@ import ( "k8s.io/apimachinery/pkg/util/uuid" "k8s.io/kubernetes/test/e2e/framework" e2enetwork "k8s.io/kubernetes/test/e2e/framework/network" - e2eskipper "k8s.io/kubernetes/test/e2e/framework/skipper" imageutils "k8s.io/kubernetes/test/utils/image" "github.com/onsi/ginkgo" ) -var _ = SIGNodeDescribe("Downward API", func() { +var _ = SIGDescribe("Downward API", func() { f := framework.NewDefaultFramework("downward-api") /* @@ -284,81 +283,6 @@ var _ = SIGNodeDescribe("Downward API", func() { }) }) -var _ = SIGStorageDescribe("Downward API [Serial] [Disruptive] [NodeFeature:EphemeralStorage]", func() { - f := framework.NewDefaultFramework("downward-api") - - ginkgo.Context("Downward API tests for local ephemeral storage", func() { - ginkgo.BeforeEach(func() { - e2eskipper.SkipUnlessLocalEphemeralStorageEnabled() - }) - - ginkgo.It("should provide container's limits.ephemeral-storage and requests.ephemeral-storage as env vars", func() { - podName := "downward-api-" + string(uuid.NewUUID()) - env := []v1.EnvVar{ - { - Name: "EPHEMERAL_STORAGE_LIMIT", - ValueFrom: &v1.EnvVarSource{ - ResourceFieldRef: &v1.ResourceFieldSelector{ - Resource: "limits.ephemeral-storage", - }, - }, - }, - { - Name: "EPHEMERAL_STORAGE_REQUEST", - ValueFrom: &v1.EnvVarSource{ - ResourceFieldRef: &v1.ResourceFieldSelector{ - Resource: "requests.ephemeral-storage", - }, - }, - }, - } - expectations := []string{ - fmt.Sprintf("EPHEMERAL_STORAGE_LIMIT=%d", 64*1024*1024), - fmt.Sprintf("EPHEMERAL_STORAGE_REQUEST=%d", 32*1024*1024), - } - - testDownwardAPIForEphemeralStorage(f, podName, env, expectations) - }) - - ginkgo.It("should provide default limits.ephemeral-storage from node allocatable", func() { - podName := "downward-api-" + string(uuid.NewUUID()) - env := []v1.EnvVar{ - { - Name: "EPHEMERAL_STORAGE_LIMIT", - ValueFrom: &v1.EnvVarSource{ - ResourceFieldRef: &v1.ResourceFieldSelector{ - Resource: "limits.ephemeral-storage", - }, - }, - }, - } - expectations := []string{ - "EPHEMERAL_STORAGE_LIMIT=[1-9]", - } - pod := &v1.Pod{ - ObjectMeta: metav1.ObjectMeta{ - Name: podName, - Labels: map[string]string{"name": podName}, - }, - Spec: v1.PodSpec{ - Containers: []v1.Container{ - { - Name: "dapi-container", - Image: imageutils.GetE2EImage(imageutils.BusyBox), - Command: []string{"sh", "-c", "env"}, - Env: env, - }, - }, - RestartPolicy: v1.RestartPolicyNever, - }, - } - - testDownwardAPIUsingPod(f, pod, env, expectations) - }) - }) - -}) - func testDownwardAPI(f *framework.Framework, podName string, env []v1.EnvVar, expectations []string) { pod := &v1.Pod{ ObjectMeta: metav1.ObjectMeta{ @@ -391,36 +315,6 @@ func testDownwardAPI(f *framework.Framework, podName string, env []v1.EnvVar, ex testDownwardAPIUsingPod(f, pod, env, expectations) } -func testDownwardAPIForEphemeralStorage(f *framework.Framework, podName string, env []v1.EnvVar, expectations []string) { - pod := &v1.Pod{ - ObjectMeta: metav1.ObjectMeta{ - Name: podName, - Labels: map[string]string{"name": podName}, - }, - Spec: v1.PodSpec{ - Containers: []v1.Container{ - { - Name: "dapi-container", - Image: imageutils.GetE2EImage(imageutils.BusyBox), - Command: []string{"sh", "-c", "env"}, - Resources: v1.ResourceRequirements{ - Requests: v1.ResourceList{ - v1.ResourceEphemeralStorage: resource.MustParse("32Mi"), - }, - Limits: v1.ResourceList{ - v1.ResourceEphemeralStorage: resource.MustParse("64Mi"), - }, - }, - Env: env, - }, - }, - RestartPolicy: v1.RestartPolicyNever, - }, - } - - testDownwardAPIUsingPod(f, pod, env, expectations) -} - func testDownwardAPIUsingPod(f *framework.Framework, pod *v1.Pod, env []v1.EnvVar, expectations []string) { f.TestContainerOutputRegexp("downward api env vars", pod, 0, expectations) } diff --git a/test/e2e/common/expansion.go b/test/e2e/common/node/expansion.go similarity index 99% rename from test/e2e/common/expansion.go rename to test/e2e/common/node/expansion.go index 1b94775c51b..d3edd31ab7c 100644 --- a/test/e2e/common/expansion.go +++ b/test/e2e/common/node/expansion.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package common +package node import ( v1 "k8s.io/api/core/v1" @@ -30,7 +30,7 @@ import ( // These tests exercise the Kubernetes expansion syntax $(VAR). // For more information, see: // https://github.com/kubernetes/community/blob/master/contributors/design-proposals/node/expansion.md -var _ = SIGNodeDescribe("Variable Expansion", func() { +var _ = SIGDescribe("Variable Expansion", func() { f := framework.NewDefaultFramework("var-expansion") /* diff --git a/test/e2e/common/init_container.go b/test/e2e/common/node/init_container.go similarity index 99% rename from test/e2e/common/init_container.go rename to test/e2e/common/node/init_container.go index 59d8678c870..7164cbffd7c 100644 --- a/test/e2e/common/init_container.go +++ b/test/e2e/common/node/init_container.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package common +package node import ( "context" @@ -156,7 +156,7 @@ func initContainersInvariants(pod *v1.Pod) error { return nil } -var _ = SIGNodeDescribe("InitContainer [NodeConformance]", func() { +var _ = SIGDescribe("InitContainer [NodeConformance]", func() { f := framework.NewDefaultFramework("init-container") var podClient *framework.PodClient ginkgo.BeforeEach(func() { diff --git a/test/e2e/common/kubelet.go b/test/e2e/common/node/kubelet.go similarity index 99% rename from test/e2e/common/kubelet.go rename to test/e2e/common/node/kubelet.go index 014839f91fa..8e5d722ec6e 100644 --- a/test/e2e/common/kubelet.go +++ b/test/e2e/common/node/kubelet.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package common +package node import ( "bytes" @@ -32,7 +32,7 @@ import ( "github.com/onsi/gomega" ) -var _ = SIGNodeDescribe("Kubelet", func() { +var _ = SIGDescribe("Kubelet", func() { f := framework.NewDefaultFramework("kubelet-test") var podClient *framework.PodClient ginkgo.BeforeEach(func() { diff --git a/test/e2e/common/kubelet_etc_hosts.go b/test/e2e/common/node/kubelet_etc_hosts.go similarity index 99% rename from test/e2e/common/kubelet_etc_hosts.go rename to test/e2e/common/node/kubelet_etc_hosts.go index f9cfb749851..1e0c860d173 100644 --- a/test/e2e/common/kubelet_etc_hosts.go +++ b/test/e2e/common/node/kubelet_etc_hosts.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package common +package node import ( "strings" @@ -43,7 +43,7 @@ type KubeletManagedHostConfig struct { f *framework.Framework } -var _ = SIGNodeDescribe("KubeletManagedEtcHosts", func() { +var _ = SIGDescribe("KubeletManagedEtcHosts", func() { f := framework.NewDefaultFramework("e2e-kubelet-etc-hosts") config := &KubeletManagedHostConfig{ f: f, diff --git a/test/e2e/common/lease.go b/test/e2e/common/node/lease.go similarity index 99% rename from test/e2e/common/lease.go rename to test/e2e/common/node/lease.go index 58193c12c90..b33f8790512 100644 --- a/test/e2e/common/lease.go +++ b/test/e2e/common/node/lease.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package common +package node import ( "context" @@ -49,7 +49,7 @@ func getPatchBytes(oldLease, newLease *coordinationv1.Lease) ([]byte, error) { return patchBytes, nil } -var _ = SIGNodeDescribe("Lease", func() { +var _ = SIGDescribe("Lease", func() { f := framework.NewDefaultFramework("lease-test") /* diff --git a/test/e2e/common/lifecycle_hook.go b/test/e2e/common/node/lifecycle_hook.go similarity index 98% rename from test/e2e/common/lifecycle_hook.go rename to test/e2e/common/node/lifecycle_hook.go index 829f9b114b9..9c230dfa44d 100644 --- a/test/e2e/common/lifecycle_hook.go +++ b/test/e2e/common/node/lifecycle_hook.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package common +package node import ( "fmt" @@ -32,7 +32,7 @@ import ( "github.com/onsi/gomega" ) -var _ = SIGNodeDescribe("Container Lifecycle Hook", func() { +var _ = SIGDescribe("Container Lifecycle Hook", func() { f := framework.NewDefaultFramework("container-lifecycle-hook") var podClient *framework.PodClient const ( diff --git a/test/e2e/common/node_lease.go b/test/e2e/common/node/node_lease.go similarity index 99% rename from test/e2e/common/node_lease.go rename to test/e2e/common/node/node_lease.go index 041b1e84383..53965b94d20 100644 --- a/test/e2e/common/node_lease.go +++ b/test/e2e/common/node/node_lease.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package common +package node import ( "context" @@ -36,7 +36,7 @@ import ( "github.com/onsi/gomega" ) -var _ = SIGNodeDescribe("NodeLease", func() { +var _ = SIGDescribe("NodeLease", func() { var nodeName string f := framework.NewDefaultFramework("node-lease-test") diff --git a/test/e2e/common/pods.go b/test/e2e/common/node/pods.go similarity index 99% rename from test/e2e/common/pods.go rename to test/e2e/common/node/pods.go index 22cfb0262ab..340aea757a2 100644 --- a/test/e2e/common/pods.go +++ b/test/e2e/common/node/pods.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package common +package node import ( "bytes" @@ -179,7 +179,7 @@ func expectNoErrorWithRetries(fn func() error, maxRetries int, explain ...interf gomega.ExpectWithOffset(1, err).NotTo(gomega.HaveOccurred(), explain...) } -var _ = SIGNodeDescribe("Pods", func() { +var _ = SIGDescribe("Pods", func() { f := framework.NewDefaultFramework("pods") var podClient *framework.PodClient var dc dynamic.Interface diff --git a/test/e2e/common/privileged.go b/test/e2e/common/node/privileged.go similarity index 97% rename from test/e2e/common/privileged.go rename to test/e2e/common/node/privileged.go index 19a572b8a6e..6f63b202261 100644 --- a/test/e2e/common/privileged.go +++ b/test/e2e/common/node/privileged.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package common +package node import ( "fmt" @@ -38,7 +38,7 @@ type PrivilegedPodTestConfig struct { pod *v1.Pod } -var _ = SIGNodeDescribe("PrivilegedPod [NodeConformance]", func() { +var _ = SIGDescribe("PrivilegedPod [NodeConformance]", func() { config := &PrivilegedPodTestConfig{ f: framework.NewDefaultFramework("e2e-privileged-pod"), privilegedPod: "privileged-pod", diff --git a/test/e2e/common/runtime.go b/test/e2e/common/node/runtime.go similarity index 99% rename from test/e2e/common/runtime.go rename to test/e2e/common/node/runtime.go index fa6d49d595f..972103abf40 100644 --- a/test/e2e/common/runtime.go +++ b/test/e2e/common/node/runtime.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package common +package node import ( "context" @@ -35,7 +35,7 @@ import ( gomegatypes "github.com/onsi/gomega/types" ) -var _ = SIGNodeDescribe("Container Runtime", func() { +var _ = SIGDescribe("Container Runtime", func() { f := framework.NewDefaultFramework("container-runtime") ginkgo.Describe("blackbox test", func() { diff --git a/test/e2e/common/security_context.go b/test/e2e/common/node/security_context.go similarity index 99% rename from test/e2e/common/security_context.go rename to test/e2e/common/node/security_context.go index b0b48523e3d..a87378fcfa9 100644 --- a/test/e2e/common/security_context.go +++ b/test/e2e/common/node/security_context.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package common +package node import ( "fmt" @@ -35,7 +35,12 @@ import ( "github.com/onsi/gomega" ) -var _ = SIGNodeDescribe("Security Context", func() { +var ( + // non-root UID used in tests. + nonRootTestUserID = int64(1000) +) + +var _ = SIGDescribe("Security Context", func() { f := framework.NewDefaultFramework("security-context-test") var podClient *framework.PodClient ginkgo.BeforeEach(func() { diff --git a/test/e2e/common/sysctl.go b/test/e2e/common/node/sysctl.go similarity index 98% rename from test/e2e/common/sysctl.go rename to test/e2e/common/node/sysctl.go index 5cdb00cd7b9..12f9b28df29 100644 --- a/test/e2e/common/sysctl.go +++ b/test/e2e/common/node/sysctl.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package common +package node import ( "context" @@ -30,7 +30,7 @@ import ( "github.com/onsi/gomega" ) -var _ = SIGNodeDescribe("Sysctls [LinuxOnly] [NodeFeature:Sysctls]", func() { +var _ = SIGDescribe("Sysctls [LinuxOnly] [NodeFeature:Sysctls]", func() { ginkgo.BeforeEach(func() { // sysctl is not supported on Windows. diff --git a/test/e2e/common/storage/downwardapi.go b/test/e2e/common/storage/downwardapi.go new file mode 100644 index 00000000000..df97bb9a85b --- /dev/null +++ b/test/e2e/common/storage/downwardapi.go @@ -0,0 +1,140 @@ +/* +Copyright 2016 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package storage + +import ( + "fmt" + + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/resource" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/uuid" + "k8s.io/kubernetes/test/e2e/framework" + e2eskipper "k8s.io/kubernetes/test/e2e/framework/skipper" + imageutils "k8s.io/kubernetes/test/utils/image" + + "github.com/onsi/ginkgo" +) + +var _ = SIGDescribe("Downward API [Serial] [Disruptive] [NodeFeature:EphemeralStorage]", func() { + f := framework.NewDefaultFramework("downward-api") + + ginkgo.Context("Downward API tests for local ephemeral storage", func() { + ginkgo.BeforeEach(func() { + e2eskipper.SkipUnlessLocalEphemeralStorageEnabled() + }) + + ginkgo.It("should provide container's limits.ephemeral-storage and requests.ephemeral-storage as env vars", func() { + podName := "downward-api-" + string(uuid.NewUUID()) + env := []v1.EnvVar{ + { + Name: "EPHEMERAL_STORAGE_LIMIT", + ValueFrom: &v1.EnvVarSource{ + ResourceFieldRef: &v1.ResourceFieldSelector{ + Resource: "limits.ephemeral-storage", + }, + }, + }, + { + Name: "EPHEMERAL_STORAGE_REQUEST", + ValueFrom: &v1.EnvVarSource{ + ResourceFieldRef: &v1.ResourceFieldSelector{ + Resource: "requests.ephemeral-storage", + }, + }, + }, + } + expectations := []string{ + fmt.Sprintf("EPHEMERAL_STORAGE_LIMIT=%d", 64*1024*1024), + fmt.Sprintf("EPHEMERAL_STORAGE_REQUEST=%d", 32*1024*1024), + } + + testDownwardAPIForEphemeralStorage(f, podName, env, expectations) + }) + + ginkgo.It("should provide default limits.ephemeral-storage from node allocatable", func() { + podName := "downward-api-" + string(uuid.NewUUID()) + env := []v1.EnvVar{ + { + Name: "EPHEMERAL_STORAGE_LIMIT", + ValueFrom: &v1.EnvVarSource{ + ResourceFieldRef: &v1.ResourceFieldSelector{ + Resource: "limits.ephemeral-storage", + }, + }, + }, + } + expectations := []string{ + "EPHEMERAL_STORAGE_LIMIT=[1-9]", + } + pod := &v1.Pod{ + ObjectMeta: metav1.ObjectMeta{ + Name: podName, + Labels: map[string]string{"name": podName}, + }, + Spec: v1.PodSpec{ + Containers: []v1.Container{ + { + Name: "dapi-container", + Image: imageutils.GetE2EImage(imageutils.BusyBox), + Command: []string{"sh", "-c", "env"}, + Env: env, + }, + }, + RestartPolicy: v1.RestartPolicyNever, + }, + } + + testDownwardAPIUsingPod(f, pod, env, expectations) + }) + }) + +}) + +func testDownwardAPIForEphemeralStorage(f *framework.Framework, podName string, env []v1.EnvVar, expectations []string) { + pod := &v1.Pod{ + ObjectMeta: metav1.ObjectMeta{ + Name: podName, + Labels: map[string]string{"name": podName}, + }, + Spec: v1.PodSpec{ + Containers: []v1.Container{ + { + Name: "dapi-container", + Image: imageutils.GetE2EImage(imageutils.BusyBox), + Command: []string{"sh", "-c", "env"}, + Resources: v1.ResourceRequirements{ + Requests: v1.ResourceList{ + v1.ResourceEphemeralStorage: resource.MustParse("32Mi"), + }, + Limits: v1.ResourceList{ + v1.ResourceEphemeralStorage: resource.MustParse("64Mi"), + }, + }, + Env: env, + }, + }, + RestartPolicy: v1.RestartPolicyNever, + }, + } + + testDownwardAPIUsingPod(f, pod, env, expectations) +} + +func testDownwardAPIUsingPod(f *framework.Framework, pod *v1.Pod, env []v1.EnvVar, expectations []string) { + f.TestContainerOutputRegexp("downward api env vars", pod, 0, expectations) +} diff --git a/test/e2e/common/util.go b/test/e2e/common/util.go index 28e0204f04d..7f83ad5e745 100644 --- a/test/e2e/common/util.go +++ b/test/e2e/common/util.go @@ -36,6 +36,8 @@ import ( "github.com/onsi/ginkgo" ) +// TODO: Cleanup this file. + // Suite represents test suite. type Suite string @@ -46,11 +48,6 @@ const ( NodeE2E Suite = "node e2e" ) -var ( - // non-root UID used in tests. - nonRootTestUserID = int64(1000) -) - // CurrentSuite represents current test suite. var CurrentSuite Suite diff --git a/test/e2e_node/runtime_conformance_test.go b/test/e2e_node/runtime_conformance_test.go index 48255b92417..8dc32b7eabc 100644 --- a/test/e2e_node/runtime_conformance_test.go +++ b/test/e2e_node/runtime_conformance_test.go @@ -25,7 +25,7 @@ import ( "k8s.io/api/core/v1" "k8s.io/kubernetes/pkg/kubelet/images" - "k8s.io/kubernetes/test/e2e/common" + "k8s.io/kubernetes/test/e2e/common/node" "k8s.io/kubernetes/test/e2e/framework" "k8s.io/kubernetes/test/e2e_node/services" @@ -68,7 +68,7 @@ var _ = SIGDescribe("Container Runtime Conformance Test", func() { ginkgo.It(testCase.description+" [NodeConformance]", func() { name := "image-pull-test" command := []string{"/bin/sh", "-c", "while true; do sleep 1; done"} - container := common.ConformanceContainer{ + container := node.ConformanceContainer{ PodClient: f.PodClient(), Container: v1.Container{ Name: name, @@ -98,13 +98,13 @@ var _ = SIGDescribe("Container Runtime Conformance Test", func() { if !testCase.waiting { if status.State.Running == nil { return fmt.Errorf("expected container state: Running, got: %q", - common.GetContainerState(status.State)) + node.GetContainerState(status.State)) } } if testCase.waiting { if status.State.Waiting == nil { return fmt.Errorf("expected container state: Waiting, got: %q", - common.GetContainerState(status.State)) + node.GetContainerState(status.State)) } reason := status.State.Waiting.Reason if reason != images.ErrImagePull.Error() && @@ -130,7 +130,7 @@ var _ = SIGDescribe("Container Runtime Conformance Test", func() { ginkgo.By("create the container") container.Create() ginkgo.By("check the container status") - for start := time.Now(); time.Since(start) < common.ContainerStatusRetryTimeout; time.Sleep(common.ContainerStatusPollInterval) { + for start := time.Now(); time.Since(start) < node.ContainerStatusRetryTimeout; time.Sleep(node.ContainerStatusPollInterval) { if err = checkContainerStatus(); err == nil { break }