@@ -22,89 +22,89 @@ import (
22
22
infrav1 "sigs.k8s.io/cluster-api-provider-cloudstack/api/v1beta3"
23
23
dummies "sigs.k8s.io/cluster-api-provider-cloudstack/test/dummies/v1beta3"
24
24
25
- . "github.com/onsi/ginkgo/v2"
26
- . "github.com/onsi/gomega"
25
+ "github.com/onsi/ginkgo/v2"
26
+ gomega "github.com/onsi/gomega"
27
27
)
28
28
29
- var _ = Describe ("CloudStackMachine webhook" , func () {
29
+ var _ = ginkgo . Describe ("CloudStackMachine webhook" , func () {
30
30
var ctx context.Context
31
31
forbiddenRegex := "admission webhook.*denied the request.*Forbidden\\ : %s"
32
32
requiredRegex := "admission webhook.*denied the request.*Required value\\ : %s"
33
33
34
- BeforeEach (func () { // Reset test vars to initial state.
34
+ ginkgo . BeforeEach (func () { // Reset test vars to initial state.
35
35
dummies .SetDummyVars ()
36
36
ctx = context .Background ()
37
37
_ = k8sClient .Delete (ctx , dummies .CSMachine1 ) // Clear out any remaining machines. Ignore errors.
38
38
})
39
39
40
- Context ("When creating a CloudStackMachine" , func () {
41
- It ("should accept CloudStackMachine with all attributes" , func () {
42
- Expect (k8sClient .Create (ctx , dummies .CSMachine1 )).Should (Succeed ())
40
+ ginkgo . Context ("When creating a CloudStackMachine" , func () {
41
+ ginkgo . It ("should accept CloudStackMachine with all attributes" , func () {
42
+ gomega . Expect (k8sClient .Create (ctx , dummies .CSMachine1 )).Should (gomega . Succeed ())
43
43
})
44
44
45
- It ("should accept a CloudStackMachine with disk Offering attribute" , func () {
45
+ ginkgo . It ("should accept a CloudStackMachine with disk Offering attribute" , func () {
46
46
dummies .CSMachine1 .Spec .DiskOffering = dummies .DiskOffering
47
- Expect (k8sClient .Create (ctx , dummies .CSMachine1 )).Should (Succeed ())
47
+ gomega . Expect (k8sClient .Create (ctx , dummies .CSMachine1 )).Should (gomega . Succeed ())
48
48
})
49
49
50
- It ("should accept a CloudStackMachine with positive disk Offering size attribute" , func () {
50
+ ginkgo . It ("should accept a CloudStackMachine with positive disk Offering size attribute" , func () {
51
51
dummies .CSMachine1 .Spec .DiskOffering = dummies .DiskOffering
52
52
dummies .CSMachine1 .Spec .DiskOffering .CustomSize = 1
53
- Expect (k8sClient .Create (ctx , dummies .CSMachine1 )).Should (Succeed ())
53
+ gomega . Expect (k8sClient .Create (ctx , dummies .CSMachine1 )).Should (gomega . Succeed ())
54
54
})
55
55
56
- It ("should not accept a CloudStackMachine with negative disk Offering size attribute" , func () {
56
+ ginkgo . It ("should not accept a CloudStackMachine with negative disk Offering size attribute" , func () {
57
57
dummies .CSMachine1 .Spec .DiskOffering = dummies .DiskOffering
58
58
dummies .CSMachine1 .Spec .DiskOffering .CustomSize = - 1
59
- Expect (k8sClient .Create (ctx , dummies .CSMachine1 )).Should (MatchError (MatchRegexp (forbiddenRegex , "customSizeInGB" )))
59
+ gomega . Expect (k8sClient .Create (ctx , dummies .CSMachine1 )).Should (gomega . MatchError (gomega . MatchRegexp (forbiddenRegex , "customSizeInGB" )))
60
60
})
61
61
62
- It ("should reject a CloudStackMachine with missing Offering attribute" , func () {
62
+ ginkgo . It ("should reject a CloudStackMachine with missing Offering attribute" , func () {
63
63
dummies .CSMachine1 .Spec .Offering = infrav1.CloudStackResourceIdentifier {ID : "" , Name : "" }
64
- Expect (k8sClient .Create (ctx , dummies .CSMachine1 )).
65
- Should (MatchError (MatchRegexp (requiredRegex , "Offering" )))
64
+ gomega . Expect (k8sClient .Create (ctx , dummies .CSMachine1 )).
65
+ Should (gomega . MatchError (gomega . MatchRegexp (requiredRegex , "Offering" )))
66
66
})
67
67
68
- It ("should reject a CloudStackMachine with missing Template attribute" , func () {
68
+ ginkgo . It ("should reject a CloudStackMachine with missing Template attribute" , func () {
69
69
dummies .CSMachine1 .Spec .Template = infrav1.CloudStackResourceIdentifier {ID : "" , Name : "" }
70
- Expect (k8sClient .Create (ctx , dummies .CSMachine1 )).
71
- Should (MatchError (MatchRegexp (requiredRegex , "Template" )))
70
+ gomega . Expect (k8sClient .Create (ctx , dummies .CSMachine1 )).
71
+ Should (gomega . MatchError (gomega . MatchRegexp (requiredRegex , "Template" )))
72
72
})
73
73
})
74
74
75
- Context ("When updating a CloudStackMachine" , func () {
76
- BeforeEach (func () {
77
- Ω (k8sClient .Create (ctx , dummies .CSMachine1 )).Should (Succeed ())
75
+ ginkgo . Context ("When updating a CloudStackMachine" , func () {
76
+ ginkgo . BeforeEach (func () {
77
+ gomega . Ω (k8sClient .Create (ctx , dummies .CSMachine1 )).Should (gomega . Succeed ())
78
78
})
79
79
80
- It ("should reject VM offering updates to the CloudStackMachine" , func () {
80
+ ginkgo . It ("should reject VM offering updates to the CloudStackMachine" , func () {
81
81
dummies .CSMachine1 .Spec .Offering = infrav1.CloudStackResourceIdentifier {Name : "ArbitraryUpdateOffering" }
82
- Ω (k8sClient .Update (ctx , dummies .CSMachine1 )).
83
- Should (MatchError (MatchRegexp (forbiddenRegex , "offering" )))
82
+ gomega . Ω (k8sClient .Update (ctx , dummies .CSMachine1 )).
83
+ Should (gomega . MatchError (gomega . MatchRegexp (forbiddenRegex , "offering" )))
84
84
})
85
85
86
- It ("should reject VM template updates to the CloudStackMachine" , func () {
86
+ ginkgo . It ("should reject VM template updates to the CloudStackMachine" , func () {
87
87
dummies .CSMachine1 .Spec .Template = infrav1.CloudStackResourceIdentifier {Name : "ArbitraryUpdateTemplate" }
88
- Ω (k8sClient .Update (ctx , dummies .CSMachine1 )).
89
- Should (MatchError (MatchRegexp (forbiddenRegex , "template" )))
88
+ gomega . Ω (k8sClient .Update (ctx , dummies .CSMachine1 )).
89
+ Should (gomega . MatchError (gomega . MatchRegexp (forbiddenRegex , "template" )))
90
90
})
91
91
92
- It ("should reject VM disk offering updates to the CloudStackMachine" , func () {
92
+ ginkgo . It ("should reject VM disk offering updates to the CloudStackMachine" , func () {
93
93
dummies .CSMachine1 .Spec .DiskOffering .Name = "medium"
94
- Ω (k8sClient .Update (ctx , dummies .CSMachine1 )).
95
- Should (MatchError (MatchRegexp (forbiddenRegex , "diskOffering" )))
94
+ gomega . Ω (k8sClient .Update (ctx , dummies .CSMachine1 )).
95
+ Should (gomega . MatchError (gomega . MatchRegexp (forbiddenRegex , "diskOffering" )))
96
96
})
97
97
98
- It ("should reject updates to VM details of the CloudStackMachine" , func () {
98
+ ginkgo . It ("should reject updates to VM details of the CloudStackMachine" , func () {
99
99
dummies .CSMachine1 .Spec .Details = map [string ]string {"memoryOvercommitRatio" : "1.5" }
100
- Ω (k8sClient .Update (ctx , dummies .CSMachine1 )).
101
- Should (MatchError (MatchRegexp (forbiddenRegex , "details" )))
100
+ gomega . Ω (k8sClient .Update (ctx , dummies .CSMachine1 )).
101
+ Should (gomega . MatchError (gomega . MatchRegexp (forbiddenRegex , "details" )))
102
102
})
103
103
104
- It ("should reject updates to the list of affinty groups of the CloudStackMachine" , func () {
104
+ ginkgo . It ("should reject updates to the list of affinty groups of the CloudStackMachine" , func () {
105
105
dummies .CSMachine1 .Spec .AffinityGroupIDs = []string {"28b907b8-75a7-4214-bd3d-6c61961fc2af" }
106
- Ω (k8sClient .Update (ctx , dummies .CSMachine1 )).
107
- Should (MatchError (MatchRegexp (forbiddenRegex , "AffinityGroupIDs" )))
106
+ gomega . Ω (k8sClient .Update (ctx , dummies .CSMachine1 )).
107
+ Should (gomega . MatchError (gomega . MatchRegexp (forbiddenRegex , "AffinityGroupIDs" )))
108
108
})
109
109
})
110
110
})
0 commit comments