@@ -32,6 +32,12 @@ var _ = Describe("resourceOptions", func() {
3232 )
3333
3434 var (
35+ fullGVK resource.GVK
36+ noDomainGVK resource.GVK
37+ noGroupGVK resource.GVK
38+ )
39+
40+ BeforeEach (func () {
3541 fullGVK = resource.GVK {
3642 Group : group ,
3743 Domain : domain ,
@@ -48,7 +54,7 @@ var _ = Describe("resourceOptions", func() {
4854 Version : version ,
4955 Kind : kind ,
5056 }
51- )
57+ } )
5258
5359 Context ("validate" , func () {
5460 DescribeTable ("should succeed for valid options" ,
@@ -68,13 +74,14 @@ var _ = Describe("resourceOptions", func() {
6874
6975 Context ("newResource" , func () {
7076 DescribeTable ("should succeed if the Resource is valid" ,
71- func (options resourceOptions ) {
77+ func (getOpts func () resourceOptions ) {
78+ options := getOpts ()
79+
7280 Expect (options .validate ()).To (Succeed ())
7381
7482 resource := options .newResource ()
7583 Expect (resource .Validate ()).To (Succeed ())
7684 Expect (resource .GVK .IsEqualTo (options .GVK )).To (BeTrue ())
77- // Plural is checked in the next test
7885 Expect (resource .Path ).To (Equal ("" ))
7986 Expect (resource .API ).NotTo (BeNil ())
8087 Expect (resource .API .CRDVersion ).To (Equal ("" ))
@@ -86,9 +93,9 @@ var _ = Describe("resourceOptions", func() {
8693 Expect (resource .Webhooks .Validation ).To (BeFalse ())
8794 Expect (resource .Webhooks .Conversion ).To (BeFalse ())
8895 },
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 } }),
9299 )
93100
94101 DescribeTable ("should default the Plural by pluralizing the Kind" ,
0 commit comments