Commit 028cd65d authored by toyoda's avatar toyoda

fix golint failure in e2e/common/[p-r]*

parent 16d33c49
...@@ -19,14 +19,15 @@ package common ...@@ -19,14 +19,15 @@ package common
import ( import (
"fmt" "fmt"
. "github.com/onsi/ginkgo" "github.com/onsi/ginkgo"
. "github.com/onsi/gomega" "github.com/onsi/gomega"
"k8s.io/api/core/v1" "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/kubernetes/test/e2e/framework" "k8s.io/kubernetes/test/e2e/framework"
imageutils "k8s.io/kubernetes/test/utils/image" imageutils "k8s.io/kubernetes/test/utils/image"
) )
// PrivilegedPodTestConfig is configuration struct for privileged pod test
type PrivilegedPodTestConfig struct { type PrivilegedPodTestConfig struct {
f *framework.Framework f *framework.Framework
...@@ -45,15 +46,15 @@ var _ = framework.KubeDescribe("PrivilegedPod [NodeConformance]", func() { ...@@ -45,15 +46,15 @@ var _ = framework.KubeDescribe("PrivilegedPod [NodeConformance]", func() {
notPrivilegedContainer: "not-privileged-container", notPrivilegedContainer: "not-privileged-container",
} }
It("should enable privileged commands [LinuxOnly]", func() { ginkgo.It("should enable privileged commands [LinuxOnly]", func() {
// Windows does not support privileged containers. // Windows does not support privileged containers.
By("Creating a pod with a privileged container") ginkgo.By("Creating a pod with a privileged container")
config.createPods() config.createPods()
By("Executing in the privileged container") ginkgo.By("Executing in the privileged container")
config.run(config.privilegedContainer, true) config.run(config.privilegedContainer, true)
By("Executing in the non-privileged container") ginkgo.By("Executing in the non-privileged container")
config.run(config.notPrivilegedContainer, false) config.run(config.notPrivilegedContainer, false)
}) })
}) })
...@@ -75,7 +76,7 @@ func (c *PrivilegedPodTestConfig) run(containerName string, expectSuccess bool) ...@@ -75,7 +76,7 @@ func (c *PrivilegedPodTestConfig) run(containerName string, expectSuccess bool)
framework.ExpectNoError(err, framework.ExpectNoError(err,
fmt.Sprintf("could not remove dummy1 link: %v", err)) fmt.Sprintf("could not remove dummy1 link: %v", err))
} else { } else {
Expect(err).To(HaveOccurred(), msg) gomega.Expect(err).To(gomega.HaveOccurred(), msg)
} }
} }
......
...@@ -25,10 +25,10 @@ import ( ...@@ -25,10 +25,10 @@ import (
"k8s.io/kubernetes/test/e2e/framework" "k8s.io/kubernetes/test/e2e/framework"
imageutils "k8s.io/kubernetes/test/utils/image" imageutils "k8s.io/kubernetes/test/utils/image"
. "github.com/onsi/ginkgo" "github.com/onsi/ginkgo"
) )
var _ = Describe("[sig-storage] Projected combined", func() { var _ = ginkgo.Describe("[sig-storage] Projected combined", func() {
f := framework.NewDefaultFramework("projected") f := framework.NewDefaultFramework("projected")
// Test multiple projections // Test multiple projections
...@@ -61,11 +61,11 @@ var _ = Describe("[sig-storage] Projected combined", func() { ...@@ -61,11 +61,11 @@ var _ = Describe("[sig-storage] Projected combined", func() {
}, },
} }
By(fmt.Sprintf("Creating configMap with name %s", configMap.Name)) ginkgo.By(fmt.Sprintf("Creating configMap with name %s", configMap.Name))
if configMap, err = f.ClientSet.CoreV1().ConfigMaps(f.Namespace.Name).Create(configMap); err != nil { if configMap, err = f.ClientSet.CoreV1().ConfigMaps(f.Namespace.Name).Create(configMap); err != nil {
framework.Failf("unable to create test configMap %s: %v", configMap.Name, err) framework.Failf("unable to create test configMap %s: %v", configMap.Name, err)
} }
By(fmt.Sprintf("Creating secret with name %s", secret.Name)) ginkgo.By(fmt.Sprintf("Creating secret with name %s", secret.Name))
if secret, err = f.ClientSet.CoreV1().Secrets(f.Namespace.Name).Create(secret); err != nil { if secret, err = f.ClientSet.CoreV1().Secrets(f.Namespace.Name).Create(secret); err != nil {
framework.Failf("unable to create test secret %s: %v", secret.Name, err) framework.Failf("unable to create test secret %s: %v", secret.Name, err)
} }
......
...@@ -26,17 +26,17 @@ import ( ...@@ -26,17 +26,17 @@ import (
"k8s.io/kubernetes/test/e2e/framework" "k8s.io/kubernetes/test/e2e/framework"
imageutils "k8s.io/kubernetes/test/utils/image" imageutils "k8s.io/kubernetes/test/utils/image"
. "github.com/onsi/ginkgo" "github.com/onsi/ginkgo"
. "github.com/onsi/gomega" "github.com/onsi/gomega"
) )
var _ = Describe("[sig-storage] Projected downwardAPI", func() { var _ = ginkgo.Describe("[sig-storage] Projected downwardAPI", func() {
f := framework.NewDefaultFramework("projected") f := framework.NewDefaultFramework("projected")
// How long to wait for a log pod to be displayed // How long to wait for a log pod to be displayed
const podLogTimeout = 2 * time.Minute const podLogTimeout = 2 * time.Minute
var podClient *framework.PodClient var podClient *framework.PodClient
BeforeEach(func() { ginkgo.BeforeEach(func() {
podClient = f.PodClient() podClient = f.PodClient()
}) })
...@@ -86,7 +86,7 @@ var _ = Describe("[sig-storage] Projected downwardAPI", func() { ...@@ -86,7 +86,7 @@ var _ = Describe("[sig-storage] Projected downwardAPI", func() {
}) })
}) })
It("should provide podname as non-root with fsgroup [NodeFeature:FSGroup]", func() { ginkgo.It("should provide podname as non-root with fsgroup [NodeFeature:FSGroup]", func() {
podName := "metadata-volume-" + string(uuid.NewUUID()) podName := "metadata-volume-" + string(uuid.NewUUID())
uid := int64(1001) uid := int64(1001)
gid := int64(1234) gid := int64(1234)
...@@ -100,7 +100,7 @@ var _ = Describe("[sig-storage] Projected downwardAPI", func() { ...@@ -100,7 +100,7 @@ var _ = Describe("[sig-storage] Projected downwardAPI", func() {
}) })
}) })
It("should provide podname as non-root with fsgroup and defaultMode [NodeFeature:FSGroup]", func() { ginkgo.It("should provide podname as non-root with fsgroup and defaultMode [NodeFeature:FSGroup]", func() {
podName := "metadata-volume-" + string(uuid.NewUUID()) podName := "metadata-volume-" + string(uuid.NewUUID())
uid := int64(1001) uid := int64(1001)
gid := int64(1234) gid := int64(1234)
...@@ -128,23 +128,23 @@ var _ = Describe("[sig-storage] Projected downwardAPI", func() { ...@@ -128,23 +128,23 @@ var _ = Describe("[sig-storage] Projected downwardAPI", func() {
podName := "labelsupdate" + string(uuid.NewUUID()) podName := "labelsupdate" + string(uuid.NewUUID())
pod := projectedDownwardAPIVolumePodForUpdateTest(podName, labels, map[string]string{}, "/etc/podinfo/labels") pod := projectedDownwardAPIVolumePodForUpdateTest(podName, labels, map[string]string{}, "/etc/podinfo/labels")
containerName := "client-container" containerName := "client-container"
By("Creating the pod") ginkgo.By("Creating the pod")
podClient.CreateSync(pod) podClient.CreateSync(pod)
Eventually(func() (string, error) { gomega.Eventually(func() (string, error) {
return framework.GetPodLogs(f.ClientSet, f.Namespace.Name, podName, containerName) return framework.GetPodLogs(f.ClientSet, f.Namespace.Name, podName, containerName)
}, },
podLogTimeout, framework.Poll).Should(ContainSubstring("key1=\"value1\"\n")) podLogTimeout, framework.Poll).Should(gomega.ContainSubstring("key1=\"value1\"\n"))
//modify labels //modify labels
podClient.Update(podName, func(pod *v1.Pod) { podClient.Update(podName, func(pod *v1.Pod) {
pod.Labels["key3"] = "value3" pod.Labels["key3"] = "value3"
}) })
Eventually(func() (string, error) { gomega.Eventually(func() (string, error) {
return framework.GetPodLogs(f.ClientSet, f.Namespace.Name, pod.Name, containerName) return framework.GetPodLogs(f.ClientSet, f.Namespace.Name, pod.Name, containerName)
}, },
podLogTimeout, framework.Poll).Should(ContainSubstring("key3=\"value3\"\n")) podLogTimeout, framework.Poll).Should(gomega.ContainSubstring("key3=\"value3\"\n"))
}) })
/* /*
...@@ -159,26 +159,26 @@ var _ = Describe("[sig-storage] Projected downwardAPI", func() { ...@@ -159,26 +159,26 @@ var _ = Describe("[sig-storage] Projected downwardAPI", func() {
pod := projectedDownwardAPIVolumePodForUpdateTest(podName, map[string]string{}, annotations, "/etc/podinfo/annotations") pod := projectedDownwardAPIVolumePodForUpdateTest(podName, map[string]string{}, annotations, "/etc/podinfo/annotations")
containerName := "client-container" containerName := "client-container"
By("Creating the pod") ginkgo.By("Creating the pod")
podClient.CreateSync(pod) podClient.CreateSync(pod)
pod, err := podClient.Get(pod.Name, metav1.GetOptions{}) pod, err := podClient.Get(pod.Name, metav1.GetOptions{})
framework.ExpectNoError(err, "Failed to get pod %q", pod.Name) framework.ExpectNoError(err, "Failed to get pod %q", pod.Name)
Eventually(func() (string, error) { gomega.Eventually(func() (string, error) {
return framework.GetPodLogs(f.ClientSet, f.Namespace.Name, pod.Name, containerName) return framework.GetPodLogs(f.ClientSet, f.Namespace.Name, pod.Name, containerName)
}, },
podLogTimeout, framework.Poll).Should(ContainSubstring("builder=\"bar\"\n")) podLogTimeout, framework.Poll).Should(gomega.ContainSubstring("builder=\"bar\"\n"))
//modify annotations //modify annotations
podClient.Update(podName, func(pod *v1.Pod) { podClient.Update(podName, func(pod *v1.Pod) {
pod.Annotations["builder"] = "foo" pod.Annotations["builder"] = "foo"
}) })
Eventually(func() (string, error) { gomega.Eventually(func() (string, error) {
return framework.GetPodLogs(f.ClientSet, f.Namespace.Name, pod.Name, containerName) return framework.GetPodLogs(f.ClientSet, f.Namespace.Name, pod.Name, containerName)
}, },
podLogTimeout, framework.Poll).Should(ContainSubstring("builder=\"foo\"\n")) podLogTimeout, framework.Poll).Should(gomega.ContainSubstring("builder=\"foo\"\n"))
}) })
/* /*
......
...@@ -26,11 +26,11 @@ import ( ...@@ -26,11 +26,11 @@ import (
"k8s.io/kubernetes/test/e2e/framework" "k8s.io/kubernetes/test/e2e/framework"
imageutils "k8s.io/kubernetes/test/utils/image" imageutils "k8s.io/kubernetes/test/utils/image"
. "github.com/onsi/ginkgo" "github.com/onsi/ginkgo"
. "github.com/onsi/gomega" "github.com/onsi/gomega"
) )
var _ = Describe("[sig-storage] Projected secret", func() { var _ = ginkgo.Describe("[sig-storage] Projected secret", func() {
f := framework.NewDefaultFramework("projected") f := framework.NewDefaultFramework("projected")
/* /*
...@@ -86,7 +86,7 @@ var _ = Describe("[sig-storage] Projected secret", func() { ...@@ -86,7 +86,7 @@ var _ = Describe("[sig-storage] Projected secret", func() {
doProjectedSecretE2EWithMapping(f, &mode) doProjectedSecretE2EWithMapping(f, &mode)
}) })
It("should be able to mount in a volume regardless of a different secret existing with same name in different namespace [NodeConformance]", func() { ginkgo.It("should be able to mount in a volume regardless of a different secret existing with same name in different namespace [NodeConformance]", func() {
var ( var (
namespace2 *v1.Namespace namespace2 *v1.Namespace
err error err error
...@@ -125,7 +125,7 @@ var _ = Describe("[sig-storage] Projected secret", func() { ...@@ -125,7 +125,7 @@ var _ = Describe("[sig-storage] Projected secret", func() {
secret = secretForTest(f.Namespace.Name, name) secret = secretForTest(f.Namespace.Name, name)
) )
By(fmt.Sprintf("Creating secret with name %s", secret.Name)) ginkgo.By(fmt.Sprintf("Creating secret with name %s", secret.Name))
var err error var err error
if secret, err = f.ClientSet.CoreV1().Secrets(f.Namespace.Name).Create(secret); err != nil { if secret, err = f.ClientSet.CoreV1().Secrets(f.Namespace.Name).Create(secret); err != nil {
framework.Failf("unable to create test secret %s: %v", secret.Name, err) framework.Failf("unable to create test secret %s: %v", secret.Name, err)
...@@ -252,13 +252,13 @@ var _ = Describe("[sig-storage] Projected secret", func() { ...@@ -252,13 +252,13 @@ var _ = Describe("[sig-storage] Projected secret", func() {
}, },
} }
By(fmt.Sprintf("Creating secret with name %s", deleteSecret.Name)) ginkgo.By(fmt.Sprintf("Creating secret with name %s", deleteSecret.Name))
var err error var err error
if deleteSecret, err = f.ClientSet.CoreV1().Secrets(f.Namespace.Name).Create(deleteSecret); err != nil { if deleteSecret, err = f.ClientSet.CoreV1().Secrets(f.Namespace.Name).Create(deleteSecret); err != nil {
framework.Failf("unable to create test secret %s: %v", deleteSecret.Name, err) framework.Failf("unable to create test secret %s: %v", deleteSecret.Name, err)
} }
By(fmt.Sprintf("Creating secret with name %s", updateSecret.Name)) ginkgo.By(fmt.Sprintf("Creating secret with name %s", updateSecret.Name))
if updateSecret, err = f.ClientSet.CoreV1().Secrets(f.Namespace.Name).Create(updateSecret); err != nil { if updateSecret, err = f.ClientSet.CoreV1().Secrets(f.Namespace.Name).Create(updateSecret); err != nil {
framework.Failf("unable to create test secret %s: %v", updateSecret.Name, err) framework.Failf("unable to create test secret %s: %v", updateSecret.Name, err)
} }
...@@ -362,65 +362,65 @@ var _ = Describe("[sig-storage] Projected secret", func() { ...@@ -362,65 +362,65 @@ var _ = Describe("[sig-storage] Projected secret", func() {
RestartPolicy: v1.RestartPolicyNever, RestartPolicy: v1.RestartPolicyNever,
}, },
} }
By("Creating the pod") ginkgo.By("Creating the pod")
f.PodClient().CreateSync(pod) f.PodClient().CreateSync(pod)
pollCreateLogs := func() (string, error) { pollCreateLogs := func() (string, error) {
return framework.GetPodLogs(f.ClientSet, f.Namespace.Name, pod.Name, createContainerName) return framework.GetPodLogs(f.ClientSet, f.Namespace.Name, pod.Name, createContainerName)
} }
Eventually(pollCreateLogs, podLogTimeout, framework.Poll).Should(ContainSubstring("Error reading file /etc/projected-secret-volumes/create/data-1")) gomega.Eventually(pollCreateLogs, podLogTimeout, framework.Poll).Should(gomega.ContainSubstring("Error reading file /etc/projected-secret-volumes/create/data-1"))
pollUpdateLogs := func() (string, error) { pollUpdateLogs := func() (string, error) {
return framework.GetPodLogs(f.ClientSet, f.Namespace.Name, pod.Name, updateContainerName) return framework.GetPodLogs(f.ClientSet, f.Namespace.Name, pod.Name, updateContainerName)
} }
Eventually(pollUpdateLogs, podLogTimeout, framework.Poll).Should(ContainSubstring("Error reading file /etc/projected-secret-volumes/update/data-3")) gomega.Eventually(pollUpdateLogs, podLogTimeout, framework.Poll).Should(gomega.ContainSubstring("Error reading file /etc/projected-secret-volumes/update/data-3"))
pollDeleteLogs := func() (string, error) { pollDeleteLogs := func() (string, error) {
return framework.GetPodLogs(f.ClientSet, f.Namespace.Name, pod.Name, deleteContainerName) return framework.GetPodLogs(f.ClientSet, f.Namespace.Name, pod.Name, deleteContainerName)
} }
Eventually(pollDeleteLogs, podLogTimeout, framework.Poll).Should(ContainSubstring("value-1")) gomega.Eventually(pollDeleteLogs, podLogTimeout, framework.Poll).Should(gomega.ContainSubstring("value-1"))
By(fmt.Sprintf("Deleting secret %v", deleteSecret.Name)) ginkgo.By(fmt.Sprintf("Deleting secret %v", deleteSecret.Name))
err = f.ClientSet.CoreV1().Secrets(f.Namespace.Name).Delete(deleteSecret.Name, &metav1.DeleteOptions{}) err = f.ClientSet.CoreV1().Secrets(f.Namespace.Name).Delete(deleteSecret.Name, &metav1.DeleteOptions{})
framework.ExpectNoError(err, "Failed to delete secret %q in namespace %q", deleteSecret.Name, f.Namespace.Name) framework.ExpectNoError(err, "Failed to delete secret %q in namespace %q", deleteSecret.Name, f.Namespace.Name)
By(fmt.Sprintf("Updating secret %v", updateSecret.Name)) ginkgo.By(fmt.Sprintf("Updating secret %v", updateSecret.Name))
updateSecret.ResourceVersion = "" // to force update updateSecret.ResourceVersion = "" // to force update
delete(updateSecret.Data, "data-1") delete(updateSecret.Data, "data-1")
updateSecret.Data["data-3"] = []byte("value-3") updateSecret.Data["data-3"] = []byte("value-3")
_, err = f.ClientSet.CoreV1().Secrets(f.Namespace.Name).Update(updateSecret) _, err = f.ClientSet.CoreV1().Secrets(f.Namespace.Name).Update(updateSecret)
framework.ExpectNoError(err, "Failed to update secret %q in namespace %q", updateSecret.Name, f.Namespace.Name) framework.ExpectNoError(err, "Failed to update secret %q in namespace %q", updateSecret.Name, f.Namespace.Name)
By(fmt.Sprintf("Creating secret with name %s", createSecret.Name)) ginkgo.By(fmt.Sprintf("Creating secret with name %s", createSecret.Name))
if createSecret, err = f.ClientSet.CoreV1().Secrets(f.Namespace.Name).Create(createSecret); err != nil { if createSecret, err = f.ClientSet.CoreV1().Secrets(f.Namespace.Name).Create(createSecret); err != nil {
framework.Failf("unable to create test secret %s: %v", createSecret.Name, err) framework.Failf("unable to create test secret %s: %v", createSecret.Name, err)
} }
By("waiting to observe update in volume") ginkgo.By("waiting to observe update in volume")
Eventually(pollCreateLogs, podLogTimeout, framework.Poll).Should(ContainSubstring("value-1")) gomega.Eventually(pollCreateLogs, podLogTimeout, framework.Poll).Should(gomega.ContainSubstring("value-1"))
Eventually(pollUpdateLogs, podLogTimeout, framework.Poll).Should(ContainSubstring("value-3")) gomega.Eventually(pollUpdateLogs, podLogTimeout, framework.Poll).Should(gomega.ContainSubstring("value-3"))
Eventually(pollDeleteLogs, podLogTimeout, framework.Poll).Should(ContainSubstring("Error reading file /etc/projected-secret-volumes/delete/data-1")) gomega.Eventually(pollDeleteLogs, podLogTimeout, framework.Poll).Should(gomega.ContainSubstring("Error reading file /etc/projected-secret-volumes/delete/data-1"))
}) })
//The secret is in pending during volume creation until the secret objects are available //The secret is in pending during volume creation until the secret objects are available
//or until mount the secret volume times out. There is no secret object defined for the pod, so it should return timeout exception unless it is marked optional. //or until mount the secret volume times out. There is no secret object defined for the pod, so it should return timeout exception unless it is marked optional.
//Slow (~5 mins) //Slow (~5 mins)
It("Should fail non-optional pod creation due to secret object does not exist [Slow]", func() { ginkgo.It("Should fail non-optional pod creation due to secret object does not exist [Slow]", func() {
volumeMountPath := "/etc/projected-secret-volumes" volumeMountPath := "/etc/projected-secret-volumes"
podName := "pod-secrets-" + string(uuid.NewUUID()) podName := "pod-secrets-" + string(uuid.NewUUID())
err := createNonOptionalSecretPod(f, volumeMountPath, podName) err := createNonOptionalSecretPod(f, volumeMountPath, podName)
Expect(err).To(HaveOccurred(), "created pod %q with non-optional secret in namespace %q", podName, f.Namespace.Name) gomega.Expect(err).To(gomega.HaveOccurred(), "created pod %q with non-optional secret in namespace %q", podName, f.Namespace.Name)
}) })
//Secret object defined for the pod, If a key is specified which is not present in the secret, //Secret object defined for the pod, If a key is specified which is not present in the secret,
// the volume setup will error unless it is marked optional, during the pod creation. // the volume setup will error unless it is marked optional, during the pod creation.
//Slow (~5 mins) //Slow (~5 mins)
It("Should fail non-optional pod creation due to the key in the secret object does not exist [Slow]", func() { ginkgo.It("Should fail non-optional pod creation due to the key in the secret object does not exist [Slow]", func() {
volumeMountPath := "/etc/secret-volumes" volumeMountPath := "/etc/secret-volumes"
podName := "pod-secrets-" + string(uuid.NewUUID()) podName := "pod-secrets-" + string(uuid.NewUUID())
err := createNonOptionalSecretPodWithSecret(f, volumeMountPath, podName) err := createNonOptionalSecretPodWithSecret(f, volumeMountPath, podName)
Expect(err).To(HaveOccurred(), "created pod %q with non-optional secret in namespace %q", podName, f.Namespace.Name) gomega.Expect(err).To(gomega.HaveOccurred(), "created pod %q with non-optional secret in namespace %q", podName, f.Namespace.Name)
}) })
}) })
...@@ -432,7 +432,7 @@ func doProjectedSecretE2EWithoutMapping(f *framework.Framework, defaultMode *int ...@@ -432,7 +432,7 @@ func doProjectedSecretE2EWithoutMapping(f *framework.Framework, defaultMode *int
secret = secretForTest(f.Namespace.Name, secretName) secret = secretForTest(f.Namespace.Name, secretName)
) )
By(fmt.Sprintf("Creating projection with secret that has name %s", secret.Name)) ginkgo.By(fmt.Sprintf("Creating projection with secret that has name %s", secret.Name))
var err error var err error
if secret, err = f.ClientSet.CoreV1().Secrets(f.Namespace.Name).Create(secret); err != nil { if secret, err = f.ClientSet.CoreV1().Secrets(f.Namespace.Name).Create(secret); err != nil {
framework.Failf("unable to create test secret %s: %v", secret.Name, err) framework.Failf("unable to create test secret %s: %v", secret.Name, err)
...@@ -510,7 +510,7 @@ func doProjectedSecretE2EWithMapping(f *framework.Framework, mode *int32) { ...@@ -510,7 +510,7 @@ func doProjectedSecretE2EWithMapping(f *framework.Framework, mode *int32) {
secret = secretForTest(f.Namespace.Name, name) secret = secretForTest(f.Namespace.Name, name)
) )
By(fmt.Sprintf("Creating projection with secret that has name %s", secret.Name)) ginkgo.By(fmt.Sprintf("Creating projection with secret that has name %s", secret.Name))
var err error var err error
if secret, err = f.ClientSet.CoreV1().Secrets(f.Namespace.Name).Create(secret); err != nil { if secret, err = f.ClientSet.CoreV1().Secrets(f.Namespace.Name).Create(secret); err != nil {
framework.Failf("unable to create test secret %s: %v", secret.Name, err) framework.Failf("unable to create test secret %s: %v", secret.Name, err)
......
...@@ -31,7 +31,7 @@ import ( ...@@ -31,7 +31,7 @@ import (
imageutils "k8s.io/kubernetes/test/utils/image" imageutils "k8s.io/kubernetes/test/utils/image"
utilpointer "k8s.io/utils/pointer" utilpointer "k8s.io/utils/pointer"
. "github.com/onsi/ginkgo" "github.com/onsi/ginkgo"
) )
const ( const (
...@@ -43,16 +43,16 @@ const ( ...@@ -43,16 +43,16 @@ const (
DockerRuntimeHandler = "docker" DockerRuntimeHandler = "docker"
) )
var _ = Describe("[sig-node] RuntimeClass", func() { var _ = ginkgo.Describe("[sig-node] RuntimeClass", func() {
f := framework.NewDefaultFramework("runtimeclass") f := framework.NewDefaultFramework("runtimeclass")
It("should reject a Pod requesting a non-existent RuntimeClass", func() { ginkgo.It("should reject a Pod requesting a non-existent RuntimeClass", func() {
rcName := f.Namespace.Name + "-nonexistent" rcName := f.Namespace.Name + "-nonexistent"
pod := createRuntimeClassPod(f, rcName) pod := createRuntimeClassPod(f, rcName)
expectSandboxFailureEvent(f, pod, fmt.Sprintf("\"%s\" not found", rcName)) expectSandboxFailureEvent(f, pod, fmt.Sprintf("\"%s\" not found", rcName))
}) })
It("should reject a Pod requesting a RuntimeClass with an unconfigured handler", func() { ginkgo.It("should reject a Pod requesting a RuntimeClass with an unconfigured handler", func() {
handler := f.Namespace.Name + "-handler" handler := f.Namespace.Name + "-handler"
rcName := createRuntimeClass(f, "unconfigured-handler", handler) rcName := createRuntimeClass(f, "unconfigured-handler", handler)
pod := createRuntimeClassPod(f, rcName) pod := createRuntimeClassPod(f, rcName)
...@@ -60,7 +60,7 @@ var _ = Describe("[sig-node] RuntimeClass", func() { ...@@ -60,7 +60,7 @@ var _ = Describe("[sig-node] RuntimeClass", func() {
}) })
// This test requires that the PreconfiguredRuntimeHandler has already been set up on nodes. // This test requires that the PreconfiguredRuntimeHandler has already been set up on nodes.
It("should run a Pod requesting a RuntimeClass with a configured handler [NodeFeature:RuntimeHandler]", func() { ginkgo.It("should run a Pod requesting a RuntimeClass with a configured handler [NodeFeature:RuntimeHandler]", func() {
// The built-in docker runtime does not support configuring runtime handlers. // The built-in docker runtime does not support configuring runtime handlers.
handler := PreconfiguredRuntimeHandler handler := PreconfiguredRuntimeHandler
if framework.TestContext.ContainerRuntime == "docker" { if framework.TestContext.ContainerRuntime == "docker" {
...@@ -72,15 +72,15 @@ var _ = Describe("[sig-node] RuntimeClass", func() { ...@@ -72,15 +72,15 @@ var _ = Describe("[sig-node] RuntimeClass", func() {
expectPodSuccess(f, pod) expectPodSuccess(f, pod)
}) })
It("should reject a Pod requesting a deleted RuntimeClass", func() { ginkgo.It("should reject a Pod requesting a deleted RuntimeClass", func() {
rcName := createRuntimeClass(f, "delete-me", "runc") rcName := createRuntimeClass(f, "delete-me", "runc")
rcClient := f.ClientSet.NodeV1beta1().RuntimeClasses() rcClient := f.ClientSet.NodeV1beta1().RuntimeClasses()
By("Deleting RuntimeClass "+rcName, func() { ginkgo.By("Deleting RuntimeClass "+rcName, func() {
err := rcClient.Delete(rcName, nil) err := rcClient.Delete(rcName, nil)
framework.ExpectNoError(err, "failed to delete RuntimeClass %s", rcName) framework.ExpectNoError(err, "failed to delete RuntimeClass %s", rcName)
By("Waiting for the RuntimeClass to disappear") ginkgo.By("Waiting for the RuntimeClass to disappear")
framework.ExpectNoError(wait.PollImmediate(framework.Poll, time.Minute, func() (bool, error) { framework.ExpectNoError(wait.PollImmediate(framework.Poll, time.Minute, func() (bool, error) {
_, err := rcClient.Get(rcName, metav1.GetOptions{}) _, err := rcClient.Get(rcName, metav1.GetOptions{})
if errors.IsNotFound(err) { if errors.IsNotFound(err) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment