From 5a4e86f7f152e6732eb8119e44c554be3ff8689a Mon Sep 17 00:00:00 2001 From: LavenderQAQ Date: Fri, 27 Oct 2023 06:25:44 +0000 Subject: [PATCH] one case Signed-off-by: LavenderQAQ --- test/e2e/yurt/iot.go | 73 ++++++-------------------------------------- 1 file changed, 10 insertions(+), 63 deletions(-) diff --git a/test/e2e/yurt/iot.go b/test/e2e/yurt/iot.go index b05bb7b5f7e..6f7f800c98b 100644 --- a/test/e2e/yurt/iot.go +++ b/test/e2e/yurt/iot.go @@ -26,7 +26,6 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/rand" - "k8s.io/apimachinery/pkg/util/sets" "sigs.k8s.io/controller-runtime/pkg/client" appsv1alpha1 "github.com/openyurtio/openyurt/pkg/apis/apps/v1alpha1" @@ -149,70 +148,18 @@ var _ = Describe("OpenYurt IoT Test", func() { Expect(k8sClient.Delete(ctx, &iotv1alpha2.PlatformAdmin{ObjectMeta: metav1.ObjectMeta{Name: platformAdminName, Namespace: namespaceName}}, client.PropagationPolicy(metav1.DeletePropagationBackground))).Should(BeNil()) }) - It("PlatformAdmin should create the corresponding yurtappsets after it is created", func() { - By("verify the yurtappsets of platformadmin") - Eventually(func() error { - yurtappsetList := &appsv1alpha1.YurtAppSetList{} - if err := k8sClient.List(ctx, yurtappsetList, client.InNamespace(namespaceName)); err != nil { - return err + It("The levski version of PlatformAdmin should be stable in ready state after it is created", func() { + By("verify the status of platformadmin") + Eventually(func() bool { + testPlatfromAdmin := &iotv1alpha2.PlatformAdmin{} + if err := k8sClient.Get(ctx, client.ObjectKey{Name: platformAdminName, Namespace: namespaceName}, testPlatfromAdmin); err != nil { + return false } - - existYas := sets.NewString() - for _, yas := range yurtappsetList.Items { - existYas.Insert(yas.Name) - } - neededYas := []string{"edgex-core-command", "edgex-core-consul", "edgex-core-metadata", "edgex-redis"} - for _, yas := range neededYas { - if !existYas.Has(yas) { - return fmt.Errorf("yurtappset %s is not found", yas) - } + if testPlatfromAdmin.Status.Ready == true { + return true } - return nil - }).WithTimeout(timeout).WithPolling(500 * time.Millisecond).Should(Succeed()) + return false + }).WithTimeout(timeout).WithPolling(500*time.Millisecond).Should(BeTrue(), func() string { return "The levski version of PlatformAdmin is not ready" }) }) - - // It("PlatformAdmin should create the corresponding services after it is created", func() { - // By("verify the services of platformadmin") - // Eventually(func() error { - // yurtappsetList := &appsv1alpha1.YurtAppSetList{} - // if err := k8sClient.List(ctx, yurtappsetList, client.InNamespace(namespaceName)); err != nil { - // return err - // } - - // existYas := sets.NewString() - // for _, yas := range yurtappsetList.Items { - // existYas.Insert(yas.Name) - // } - // neededYas := []string{"edgex-core-command", "edgex-core-consul", "edgex-core-metadata", "edgex-redis"} - // for _, yas := range neededYas { - // if !existYas.Has(yas) { - // return fmt.Errorf("yurtappset %s is not found", yas) - // } - // } - // return nil - // }).WithTimeout(timeout).WithPolling(500 * time.Millisecond).Should(Succeed()) - // }) - - // It("PlatformAdmin should create the corresponding configmaps after it is created", func() { - // By("verify the configmaps of platformadmin") - // Eventually(func() error { - // yurtappsetList := &appsv1alpha1.YurtAppSetList{} - // if err := k8sClient.List(ctx, yurtappsetList, client.InNamespace(namespaceName)); err != nil { - // return err - // } - - // existYas := sets.NewString() - // for _, yas := range yurtappsetList.Items { - // existYas.Insert(yas.Name) - // } - // neededYas := []string{"edgex-core-command", "edgex-core-consul", "edgex-core-metadata", "edgex-redis"} - // for _, yas := range neededYas { - // if !existYas.Has(yas) { - // return fmt.Errorf("yurtappset %s is not found", yas) - // } - // } - // return nil - // }).WithTimeout(timeout).WithPolling(500 * time.Millisecond).Should(Succeed()) - // }) }) })