mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-27 21:26:03 +00:00
Update test/e2e for test/e2e/framework refactoring
This commit is contained in:
@@ -22,14 +22,15 @@ import (
|
||||
|
||||
"k8s.io/kubernetes/pkg/api"
|
||||
"k8s.io/kubernetes/pkg/util"
|
||||
"k8s.io/kubernetes/test/e2e/framework"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
var _ = KubeDescribe("ConfigMap", func() {
|
||||
var _ = framework.KubeDescribe("ConfigMap", func() {
|
||||
|
||||
f := NewDefaultFramework("configmap")
|
||||
f := framework.NewDefaultFramework("configmap")
|
||||
|
||||
It("should be consumable from pods in volume [Conformance]", func() {
|
||||
doConfigMapE2EWithoutMappings(f, 0, 0)
|
||||
@@ -82,12 +83,12 @@ var _ = KubeDescribe("ConfigMap", func() {
|
||||
defer func() {
|
||||
By("Cleaning up the configMap")
|
||||
if err := f.Client.ConfigMaps(f.Namespace.Name).Delete(configMap.Name); err != nil {
|
||||
Failf("unable to delete configMap %v: %v", configMap.Name, err)
|
||||
framework.Failf("unable to delete configMap %v: %v", configMap.Name, err)
|
||||
}
|
||||
}()
|
||||
var err error
|
||||
if configMap, err = f.Client.ConfigMaps(f.Namespace.Name).Create(configMap); err != nil {
|
||||
Failf("unable to create test configMap %s: %v", configMap.Name, err)
|
||||
framework.Failf("unable to create test configMap %s: %v", configMap.Name, err)
|
||||
}
|
||||
|
||||
pod := &api.Pod{
|
||||
@@ -133,13 +134,13 @@ var _ = KubeDescribe("ConfigMap", func() {
|
||||
_, err = f.Client.Pods(f.Namespace.Name).Create(pod)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
expectNoError(waitForPodRunningInNamespace(f.Client, pod.Name, f.Namespace.Name))
|
||||
framework.ExpectNoError(framework.WaitForPodRunningInNamespace(f.Client, pod.Name, f.Namespace.Name))
|
||||
|
||||
pollLogs := func() (string, error) {
|
||||
return getPodLogs(f.Client, f.Namespace.Name, pod.Name, containerName)
|
||||
return framework.GetPodLogs(f.Client, f.Namespace.Name, pod.Name, containerName)
|
||||
}
|
||||
|
||||
Eventually(pollLogs, podLogTimeout, poll).Should(ContainSubstring("value-1"))
|
||||
Eventually(pollLogs, podLogTimeout, framework.Poll).Should(ContainSubstring("value-1"))
|
||||
|
||||
By(fmt.Sprintf("Updating configmap %v", configMap.Name))
|
||||
configMap.ResourceVersion = "" // to force update
|
||||
@@ -148,7 +149,7 @@ var _ = KubeDescribe("ConfigMap", func() {
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
By("waiting to observe update in volume")
|
||||
Eventually(pollLogs, podLogTimeout, poll).Should(ContainSubstring("value-2"))
|
||||
Eventually(pollLogs, podLogTimeout, framework.Poll).Should(ContainSubstring("value-2"))
|
||||
})
|
||||
|
||||
It("should be consumable via environment variable [Conformance]", func() {
|
||||
@@ -158,12 +159,12 @@ var _ = KubeDescribe("ConfigMap", func() {
|
||||
defer func() {
|
||||
By("Cleaning up the configMap")
|
||||
if err := f.Client.ConfigMaps(f.Namespace.Name).Delete(configMap.Name); err != nil {
|
||||
Failf("unable to delete configMap %v: %v", configMap.Name, err)
|
||||
framework.Failf("unable to delete configMap %v: %v", configMap.Name, err)
|
||||
}
|
||||
}()
|
||||
var err error
|
||||
if configMap, err = f.Client.ConfigMaps(f.Namespace.Name).Create(configMap); err != nil {
|
||||
Failf("unable to create test configMap %s: %v", configMap.Name, err)
|
||||
framework.Failf("unable to create test configMap %s: %v", configMap.Name, err)
|
||||
}
|
||||
|
||||
pod := &api.Pod{
|
||||
@@ -195,13 +196,13 @@ var _ = KubeDescribe("ConfigMap", func() {
|
||||
},
|
||||
}
|
||||
|
||||
testContainerOutput("consume configMaps", f.Client, pod, 0, []string{
|
||||
framework.TestContainerOutput("consume configMaps", f.Client, pod, 0, []string{
|
||||
"CONFIG_DATA_1=value-1",
|
||||
}, f.Namespace.Name)
|
||||
})
|
||||
})
|
||||
|
||||
func newConfigMap(f *Framework, name string) *api.ConfigMap {
|
||||
func newConfigMap(f *framework.Framework, name string) *api.ConfigMap {
|
||||
return &api.ConfigMap{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
Namespace: f.Namespace.Name,
|
||||
@@ -215,7 +216,7 @@ func newConfigMap(f *Framework, name string) *api.ConfigMap {
|
||||
}
|
||||
}
|
||||
|
||||
func doConfigMapE2EWithoutMappings(f *Framework, uid, fsGroup int64) {
|
||||
func doConfigMapE2EWithoutMappings(f *framework.Framework, uid, fsGroup int64) {
|
||||
var (
|
||||
name = "configmap-test-volume-" + string(util.NewUUID())
|
||||
volumeName = "configmap-volume"
|
||||
@@ -227,12 +228,12 @@ func doConfigMapE2EWithoutMappings(f *Framework, uid, fsGroup int64) {
|
||||
defer func() {
|
||||
By("Cleaning up the configMap")
|
||||
if err := f.Client.ConfigMaps(f.Namespace.Name).Delete(configMap.Name); err != nil {
|
||||
Failf("unable to delete configMap %v: %v", configMap.Name, err)
|
||||
framework.Failf("unable to delete configMap %v: %v", configMap.Name, err)
|
||||
}
|
||||
}()
|
||||
var err error
|
||||
if configMap, err = f.Client.ConfigMaps(f.Namespace.Name).Create(configMap); err != nil {
|
||||
Failf("unable to create test configMap %s: %v", configMap.Name, err)
|
||||
framework.Failf("unable to create test configMap %s: %v", configMap.Name, err)
|
||||
}
|
||||
|
||||
pod := &api.Pod{
|
||||
@@ -279,13 +280,13 @@ func doConfigMapE2EWithoutMappings(f *Framework, uid, fsGroup int64) {
|
||||
pod.Spec.SecurityContext.FSGroup = &fsGroup
|
||||
}
|
||||
|
||||
testContainerOutput("consume configMaps", f.Client, pod, 0, []string{
|
||||
framework.TestContainerOutput("consume configMaps", f.Client, pod, 0, []string{
|
||||
"content of file \"/etc/configmap-volume/data-1\": value-1",
|
||||
}, f.Namespace.Name)
|
||||
|
||||
}
|
||||
|
||||
func doConfigMapE2EWithMappings(f *Framework, uid, fsGroup int64) {
|
||||
func doConfigMapE2EWithMappings(f *framework.Framework, uid, fsGroup int64) {
|
||||
var (
|
||||
name = "configmap-test-volume-map-" + string(util.NewUUID())
|
||||
volumeName = "configmap-volume"
|
||||
@@ -297,12 +298,12 @@ func doConfigMapE2EWithMappings(f *Framework, uid, fsGroup int64) {
|
||||
defer func() {
|
||||
By("Cleaning up the configMap")
|
||||
if err := f.Client.ConfigMaps(f.Namespace.Name).Delete(configMap.Name); err != nil {
|
||||
Failf("unable to delete configMap %v: %v", configMap.Name, err)
|
||||
framework.Failf("unable to delete configMap %v: %v", configMap.Name, err)
|
||||
}
|
||||
}()
|
||||
var err error
|
||||
if configMap, err = f.Client.ConfigMaps(f.Namespace.Name).Create(configMap); err != nil {
|
||||
Failf("unable to create test configMap %s: %v", configMap.Name, err)
|
||||
framework.Failf("unable to create test configMap %s: %v", configMap.Name, err)
|
||||
}
|
||||
|
||||
pod := &api.Pod{
|
||||
@@ -355,7 +356,7 @@ func doConfigMapE2EWithMappings(f *Framework, uid, fsGroup int64) {
|
||||
pod.Spec.SecurityContext.FSGroup = &fsGroup
|
||||
}
|
||||
|
||||
testContainerOutput("consume configMaps", f.Client, pod, 0, []string{
|
||||
framework.TestContainerOutput("consume configMaps", f.Client, pod, 0, []string{
|
||||
"content of file \"/etc/configmap-volume/path/to/data-2\": value-2",
|
||||
}, f.Namespace.Name)
|
||||
}
|
||||
|
Reference in New Issue
Block a user