Skip to content

Commit

Permalink
one case
Browse files Browse the repository at this point in the history
Signed-off-by: LavenderQAQ <[email protected]>
  • Loading branch information
LavenderQAQ committed Oct 27, 2023
1 parent e1b2c65 commit 5a4e86f
Showing 1 changed file with 10 additions and 63 deletions.
73 changes: 10 additions & 63 deletions test/e2e/yurt/iot.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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())
// })
})
})

0 comments on commit 5a4e86f

Please sign in to comment.