@@ -18,6 +18,7 @@ package envtest
1818
1919import (
2020 "context"
21+ "path/filepath"
2122
2223 "time"
2324
@@ -60,7 +61,7 @@ var _ = Describe("Test", func() {
6061 It ("should install the CRDs into the cluster" , func (done Done ) {
6162
6263 crds , err = InstallCRDs (env .Config , CRDInstallOptions {
63- Paths : []string {"." },
64+ Paths : []string {filepath . Join ( "." , "testdata" ) },
6465 })
6566 Expect (err ).NotTo (HaveOccurred ())
6667
@@ -86,6 +87,11 @@ var _ = Describe("Test", func() {
8687 Expect (err ).NotTo (HaveOccurred ())
8788 Expect (crd .Spec .Names .Kind ).To (Equal ("FirstMate" ))
8889
90+ crd = & v1beta1.CustomResourceDefinition {}
91+ err = c .Get (context .TODO (), types.NamespacedName {Name : "drivers.crew.example.com" }, crd )
92+ Expect (err ).NotTo (HaveOccurred ())
93+ Expect (crd .Spec .Names .Kind ).To (Equal ("Driver" ))
94+
8995 err = WaitForCRDs (env .Config , []* v1beta1.CustomResourceDefinition {
9096 {
9197 Spec : v1beta1.CustomResourceDefinitionSpec {
@@ -118,7 +124,27 @@ var _ = Describe("Test", func() {
118124 Names : v1beta1.CustomResourceDefinitionNames {
119125 Plural : "firstmates" ,
120126 }},
121- }},
127+ },
128+ {
129+ Spec : v1beta1.CustomResourceDefinitionSpec {
130+ Group : "crew.example.com" ,
131+ Names : v1beta1.CustomResourceDefinitionNames {
132+ Plural : "drivers" ,
133+ },
134+ Versions : []v1beta1.CustomResourceDefinitionVersion {
135+ {
136+ Name : "v1" ,
137+ Storage : true ,
138+ Served : true ,
139+ },
140+ {
141+ Name : "v2" ,
142+ Storage : false ,
143+ Served : true ,
144+ },
145+ }},
146+ },
147+ },
122148 CRDInstallOptions {maxTime : 50 * time .Millisecond , pollInterval : 15 * time .Millisecond },
123149 )
124150 Expect (err ).NotTo (HaveOccurred ())
@@ -145,9 +171,11 @@ var _ = Describe("Test", func() {
145171 err := WaitForCRDs (env .Config ,
146172 []* v1beta1.CustomResourceDefinition {
147173 {
148- Spec : v1beta1.CustomResourceDefinitionSpec {Names : v1beta1.CustomResourceDefinitionNames {
149- Plural : "notfound" ,
150- }},
174+ Spec : v1beta1.CustomResourceDefinitionSpec {
175+ Version : "v1" ,
176+ Names : v1beta1.CustomResourceDefinitionNames {
177+ Plural : "notfound" ,
178+ }},
151179 },
152180 },
153181 CRDInstallOptions {maxTime : 50 * time .Millisecond , pollInterval : 15 * time .Millisecond },
0 commit comments