Files
open-cluster-management/test/e2e/addon_test.go
Jian Qiu c8ec75096d Reduce e2e process time (#210)
for work and addon e2e, we do not need to
restart klusterlet for each case

Signed-off-by: Jian Qiu <jqiu@redhat.com>
2023-07-06 00:19:50 -04:00

54 lines
2.0 KiB
Go

package e2e
import (
"context"
"fmt"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/rand"
)
var _ = Describe("Manage the managed cluster addons", func() {
var addOnName string
BeforeEach(func() {
addOnName = fmt.Sprintf("e2e-addon-%s", rand.String(6))
})
AfterEach(func() {
err := t.AddOnClinet.AddonV1alpha1().ManagedClusterAddOns(clusterName).Delete(context.TODO(), addOnName, metav1.DeleteOptions{})
Expect(err).ToNot(HaveOccurred())
})
It("Create one managed cluster addon and make sure it is available", func() {
By(fmt.Sprintf("create the addon %v on the managed cluster namespace %v", addOnName, clusterName))
err := t.CreateManagedClusterAddOn(clusterName, addOnName, addOnName)
Expect(err).ToNot(HaveOccurred())
By(fmt.Sprintf("create the addon lease %v on addon install namespace %v", addOnName, addOnName))
err = t.CreateManagedClusterAddOnLease(addOnName, addOnName)
Expect(err).ToNot(HaveOccurred())
By(fmt.Sprintf("wait the addon %v available condition to be true", addOnName))
Eventually(func() error {
return t.CheckManagedClusterAddOnStatus(clusterName, addOnName)
}, t.EventuallyTimeout*5, t.EventuallyInterval*5).Should(Succeed())
})
It("Create one managed cluster addon and make sure it is available in Hosted mode", func() {
By(fmt.Sprintf("create the addon %v on the managed cluster namespace %v", addOnName, clusterName))
err := t.CreateManagedClusterAddOn(clusterName, addOnName, addOnName)
Expect(err).ToNot(HaveOccurred())
By(fmt.Sprintf("create the addon lease %v on addon install namespace %v", addOnName, addOnName))
err = t.CreateManagedClusterAddOnLease(addOnName, addOnName)
Expect(err).ToNot(HaveOccurred())
By(fmt.Sprintf("wait the addon %v available condition to be true", addOnName))
Eventually(func() error {
return t.CheckManagedClusterAddOnStatus(clusterName, addOnName)
}, t.EventuallyTimeout*5, t.EventuallyInterval*5).Should(Succeed())
})
})