@@ -32,6 +32,12 @@ var _ = Describe("resourceOptions", func() {
32
32
)
33
33
34
34
var (
35
+ fullGVK resource.GVK
36
+ noDomainGVK resource.GVK
37
+ noGroupGVK resource.GVK
38
+ )
39
+
40
+ BeforeEach (func () {
35
41
fullGVK = resource.GVK {
36
42
Group : group ,
37
43
Domain : domain ,
@@ -48,7 +54,7 @@ var _ = Describe("resourceOptions", func() {
48
54
Version : version ,
49
55
Kind : kind ,
50
56
}
51
- )
57
+ } )
52
58
53
59
Context ("validate" , func () {
54
60
DescribeTable ("should succeed for valid options" ,
@@ -68,13 +74,14 @@ var _ = Describe("resourceOptions", func() {
68
74
69
75
Context ("newResource" , func () {
70
76
DescribeTable ("should succeed if the Resource is valid" ,
71
- func (options resourceOptions ) {
77
+ func (getOpts func () resourceOptions ) {
78
+ options := getOpts ()
79
+
72
80
Expect (options .validate ()).To (Succeed ())
73
81
74
82
resource := options .newResource ()
75
83
Expect (resource .Validate ()).To (Succeed ())
76
84
Expect (resource .GVK .IsEqualTo (options .GVK )).To (BeTrue ())
77
- // Plural is checked in the next test
78
85
Expect (resource .Path ).To (Equal ("" ))
79
86
Expect (resource .API ).NotTo (BeNil ())
80
87
Expect (resource .API .CRDVersion ).To (Equal ("" ))
@@ -86,9 +93,9 @@ var _ = Describe("resourceOptions", func() {
86
93
Expect (resource .Webhooks .Validation ).To (BeFalse ())
87
94
Expect (resource .Webhooks .Conversion ).To (BeFalse ())
88
95
},
89
- Entry ("full GVK" , resourceOptions { GVK : fullGVK }),
90
- Entry ("missing domain" , resourceOptions { GVK : noDomainGVK }),
91
- Entry ("missing group" , resourceOptions { GVK : noGroupGVK }),
96
+ Entry ("full GVK" , func () resourceOptions { return resourceOptions { GVK : fullGVK } }),
97
+ Entry ("missing domain" , func () resourceOptions { return resourceOptions { GVK : noDomainGVK } }),
98
+ Entry ("missing group" , func () resourceOptions { return resourceOptions { GVK : noGroupGVK } }),
92
99
)
93
100
94
101
DescribeTable ("should default the Plural by pluralizing the Kind" ,
0 commit comments