forked from open-cluster-management-io/ocm
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathaddon_test.go
53 lines (43 loc) · 1.99 KB
/
addon_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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", Label("addon"), func() {
var addOnName string
BeforeEach(func() {
addOnName = fmt.Sprintf("e2e-addon-%s", rand.String(6))
})
AfterEach(func() {
err := hub.AddonClient.AddonV1alpha1().ManagedClusterAddOns(universalClusterName).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, universalClusterName))
err := hub.CreateManagedClusterAddOn(universalClusterName, addOnName, addOnName)
Expect(err).ToNot(HaveOccurred())
By(fmt.Sprintf("create the addon lease %v on addon install namespace %v", addOnName, addOnName))
err = hub.CreateManagedClusterAddOnLease(addOnName, addOnName)
Expect(err).ToNot(HaveOccurred())
By(fmt.Sprintf("wait the addon %v available condition to be true", addOnName))
Eventually(func() error {
return hub.CheckManagedClusterAddOnStatus(universalClusterName, addOnName)
}).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, universalClusterName))
err := hub.CreateManagedClusterAddOn(universalClusterName, addOnName, addOnName)
Expect(err).ToNot(HaveOccurred())
By(fmt.Sprintf("create the addon lease %v on addon install namespace %v", addOnName, addOnName))
err = hub.CreateManagedClusterAddOnLease(addOnName, addOnName)
Expect(err).ToNot(HaveOccurred())
By(fmt.Sprintf("wait the addon %v available condition to be true", addOnName))
Eventually(func() error {
return hub.CheckManagedClusterAddOnStatus(universalClusterName, addOnName)
}).Should(Succeed())
})
})