summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorShelley-BaoYue <baoyue2@huawei.com>2022-09-26 20:44:54 +0800
committerShelley-BaoYue <baoyue2@huawei.com>2022-09-27 20:07:52 +0800
commit1a4d2cd0f277415c25cf2870a0b9d85a97fe910e (patch)
tree6d48135ed12a327930ba0415467d3f874dc60a77 /tests
parentMerge pull request #4240 from vincentgoat/app_cache_id (diff)
downloadkubeedge-1a4d2cd0f277415c25cf2870a0b9d85a97fe910e.tar.gz
bugfix statefulset
Signed-off-by: Shelley-BaoYue <baoyue2@huawei.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/e2e/deployment/deployment_test.go74
1 files changed, 37 insertions, 37 deletions
diff --git a/tests/e2e/deployment/deployment_test.go b/tests/e2e/deployment/deployment_test.go
index 7ee1297a8..c8f4a3ba7 100644
--- a/tests/e2e/deployment/deployment_test.go
+++ b/tests/e2e/deployment/deployment_test.go
@@ -17,6 +17,7 @@ limitations under the License.
package deployment
import (
+ "context"
"fmt"
"net/http"
"time"
@@ -27,6 +28,7 @@ import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
+ "k8s.io/apimachinery/pkg/util/wait"
clientset "k8s.io/client-go/kubernetes"
"github.com/kubeedge/kubeedge/tests/e2e/constants"
@@ -261,48 +263,46 @@ var _ = Describe("Application deployment test in E2E scenario", func() {
By(fmt.Sprintf("wait for pod of StatefulSet %s running", UID))
utils.WaitforPodsRunning(ctx.Cfg.KubeConfigPath, *podList, 240*time.Second)
})
+ It("Delete statefulSet pod multi times", func() {
+ replica := int32(2)
+ // Generate the random string and assign as a UID
+ UID = "edge-statefulset-" + utils.GetRandomString(5)
- /*
- It("Delete statefulSet pod multi times", func() {
- replica := int32(2)
- // Generate the random string and assign as a UID
- UID = "edge-statefulset-" + utils.GetRandomString(5)
-
- By(fmt.Sprintf("create StatefulSet %s", UID))
- d := utils.NewTestStatefulSet(UID, ctx.Cfg.AppImageURL[1], replica)
- ss, err := utils.CreateStatefulSet(clientSet, d)
- Expect(err).To(BeNil())
+ By(fmt.Sprintf("create StatefulSet %s", UID))
+ d := utils.NewTestStatefulSet(UID, ctx.Cfg.AppImageURL[1], replica)
+ ss, err := utils.CreateStatefulSet(clientSet, d)
+ Expect(err).To(BeNil())
- utils.WaitForStatusReplicas(clientSet, ss, replica)
+ utils.WaitForStatusReplicas(clientSet, ss, replica)
- By(fmt.Sprintf("get pod for StatefulSet %s", UID))
- labelSelector := labels.SelectorFromSet(map[string]string{"app": UID})
- podList, err := utils.ListPods(clientSet, corev1.NamespaceDefault, labelSelector, nil)
- Expect(err).To(BeNil())
- Expect(len(podList.Items)).ShouldNot(Equal(0))
+ By(fmt.Sprintf("get pod for StatefulSet %s", UID))
+ labelSelector := labels.SelectorFromSet(map[string]string{"app": UID})
+ podList, err := utils.ListPods(clientSet, corev1.NamespaceDefault, labelSelector, nil)
+ Expect(err).To(BeNil())
+ Expect(len(podList.Items)).ShouldNot(Equal(0))
- By(fmt.Sprintf("wait for pod of StatefulSet %s running", UID))
- utils.WaitforPodsRunning(ctx.Cfg.KubeConfigPath, *podList, 240*time.Second)
+ By(fmt.Sprintf("wait for pod of StatefulSet %s running", UID))
+ utils.WaitforPodsRunning(ctx.Cfg.KubeConfigPath, *podList, 240*time.Second)
- deletePodName := fmt.Sprintf("%s-1", UID)
- for i := 0; i < 5; i++ {
- By(fmt.Sprintf("delete pod %s", deletePodName))
- err = utils.DeletePod(clientSet, deletePodName, "default")
- Expect(err).To(BeNil())
+ deletePodName := fmt.Sprintf("%s-1", UID)
+ for i := 0; i < 5; i++ {
+ By(fmt.Sprintf("delete pod %s", deletePodName))
+ err = utils.DeletePod(clientSet, deletePodName, "default")
+ Expect(err).To(BeNil())
- By(fmt.Sprintf("wait for pod %s running again", fmt.Sprintf("%s-1", UID)))
- err = wait.Poll(5*time.Second, 120*time.Second, func() (bool, error) {
- pod, err := clientSet.CoreV1().Pods("default").Get(context.TODO(), deletePodName, metav1.GetOptions{})
- if err != nil {
- return false, err
- }
- if pod.Status.Phase == corev1.PodRunning {
- return true, nil
- }
- return false, nil
- })
- Expect(err).To(BeNil())
- }
- }*/
+ By(fmt.Sprintf("wait for pod %s running again", fmt.Sprintf("%s-1", UID)))
+ err = wait.Poll(5*time.Second, 120*time.Second, func() (bool, error) {
+ pod, err := clientSet.CoreV1().Pods("default").Get(context.TODO(), deletePodName, metav1.GetOptions{})
+ if err != nil {
+ return false, err
+ }
+ if pod.Status.Phase == corev1.PodRunning {
+ return true, nil
+ }
+ return false, nil
+ })
+ Expect(err).To(BeNil())
+ }
+ })
})
})