-
Notifications
You must be signed in to change notification settings - Fork 217
/
manifests_test.go
75 lines (66 loc) · 2.96 KB
/
manifests_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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
package lvm
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/openshift/assisted-service/internal/common"
"github.com/openshift/assisted-service/models"
"sigs.k8s.io/yaml"
)
var _ = Describe("LVM manifest generation", func() {
noneHighAvailabilityMode := models.ClusterHighAvailabilityModeNone
operator := NewLvmOperator(common.GetTestLog())
var cluster *common.Cluster
getCluster := func(openshiftVersion string) *common.Cluster {
cluster := common.Cluster{Cluster: models.Cluster{
OpenshiftVersion: openshiftVersion,
HighAvailabilityMode: &noneHighAvailabilityMode,
}}
Expect(common.IsSingleNodeCluster(&cluster)).To(BeTrue())
return &cluster
}
Context("LVM Manifest", func() {
It("Check YAMLs of LVM in SNO deployment mode", func() {
cluster = getCluster("4.10.17")
openshiftManifests, manifest, err := operator.GenerateManifests(cluster)
Expect(err).ShouldNot(HaveOccurred())
Expect(openshiftManifests).To(HaveLen(3))
Expect(openshiftManifests["50_openshift-lvm_ns.yaml"]).NotTo(HaveLen(0))
Expect(openshiftManifests["50_openshift-lvm_subscription.yaml"]).NotTo(HaveLen(0))
Expect(openshiftManifests["50_openshift-lvm_operator_group.yaml"]).NotTo(HaveLen(0))
for _, manifest := range openshiftManifests {
_, err = yaml.YAMLToJSON(manifest)
Expect(err).ShouldNot(HaveOccurred())
}
_, err = yaml.YAMLToJSON(manifest)
Expect(err).ShouldNot(HaveOccurred(), "yamltojson err: %v", err)
})
})
It("Check Subscription information", func() {
cluster = getCluster("4.12.0-rc.4")
subscriptionInfo, err := getSubscriptionInfo(cluster.OpenshiftVersion)
Expect(err).ShouldNot(HaveOccurred())
Expect(subscriptionInfo["OPERATOR_SUBSCRIPTION_NAME"]).To(Equal(LvmsSubscriptionName))
Expect(subscriptionInfo["OPERATOR_SUBSCRIPTION_SPEC_NAME"]).To(Equal(LvmsSubscriptionName))
})
It("Check Subscription information", func() {
cluster = getCluster("4.12.0")
subscriptionInfo, err := getSubscriptionInfo(cluster.OpenshiftVersion)
Expect(err).ShouldNot(HaveOccurred())
Expect(subscriptionInfo["OPERATOR_SUBSCRIPTION_NAME"]).To(Equal(LvmsSubscriptionName))
Expect(subscriptionInfo["OPERATOR_SUBSCRIPTION_SPEC_NAME"]).To(Equal(LvmsSubscriptionName))
})
It("Check Subscription information", func() {
cluster = getCluster("4.10.17")
subscriptionInfo, err := getSubscriptionInfo(cluster.OpenshiftVersion)
Expect(err).ShouldNot(HaveOccurred())
Expect(subscriptionInfo["OPERATOR_SUBSCRIPTION_NAME"]).To(Equal(LvmoSubscriptionName))
Expect(subscriptionInfo["OPERATOR_SUBSCRIPTION_SPEC_NAME"]).To(Equal(LvmoSubscriptionName))
})
It("Check Subscription information", func() {
cluster = getCluster("4.11.0")
subscriptionInfo, err := getSubscriptionInfo(cluster.OpenshiftVersion)
Expect(err).ShouldNot(HaveOccurred())
Expect(subscriptionInfo["OPERATOR_SUBSCRIPTION_NAME"]).To(Equal(LvmoSubscriptionName))
Expect(subscriptionInfo["OPERATOR_SUBSCRIPTION_SPEC_NAME"]).To(Equal(LvmoSubscriptionName))
})
})