@@ -36,6 +36,9 @@ var _ = Describe("Test", func() {
36
36
var s * runtime.Scheme
37
37
var c client.Client
38
38
39
+ var validDirectory = filepath .Join ("." , "testdata" )
40
+ var invalidDirectory = "fake"
41
+
39
42
// Initialize the client
40
43
BeforeEach (func (done Done ) {
41
44
crds = []* v1beta1.CustomResourceDefinition {}
@@ -72,7 +75,7 @@ var _ = Describe("Test", func() {
72
75
It ("should install the CRDs into the cluster" , func (done Done ) {
73
76
74
77
crds , err = InstallCRDs (env .Config , CRDInstallOptions {
75
- Paths : []string {filepath . Join ( "." , "testdata" ) },
78
+ Paths : []string {validDirectory },
76
79
})
77
80
Expect (err ).NotTo (HaveOccurred ())
78
81
@@ -164,14 +167,16 @@ var _ = Describe("Test", func() {
164
167
}, 5 )
165
168
166
169
It ("should not return an not error if the directory doesn't exist" , func (done Done ) {
167
- crds , err = InstallCRDs (env .Config , CRDInstallOptions {Paths : []string {"fake" }})
170
+ crds , err = InstallCRDs (env .Config , CRDInstallOptions {Paths : []string {invalidDirectory }})
168
171
Expect (err ).NotTo (HaveOccurred ())
169
172
170
173
close (done )
171
174
}, 5 )
172
175
173
176
It ("should return an error if the directory doesn't exist" , func (done Done ) {
174
- crds , err = InstallCRDs (env .Config , CRDInstallOptions {Paths : []string {"fake" }, ErrorIfPathMissing : true })
177
+ crds , err = InstallCRDs (env .Config , CRDInstallOptions {
178
+ Paths : []string {invalidDirectory }, ErrorIfPathMissing : true ,
179
+ })
175
180
Expect (err ).To (HaveOccurred ())
176
181
177
182
close (done )
@@ -232,7 +237,7 @@ var _ = Describe("Test", func() {
232
237
It ("should uninstall the CRDs from the cluster" , func (done Done ) {
233
238
234
239
crds , err = InstallCRDs (env .Config , CRDInstallOptions {
235
- Paths : []string {filepath . Join ( "." , "testdata" ) },
240
+ Paths : []string {validDirectory },
236
241
})
237
242
Expect (err ).NotTo (HaveOccurred ())
238
243
@@ -321,7 +326,7 @@ var _ = Describe("Test", func() {
321
326
Expect (err ).NotTo (HaveOccurred ())
322
327
323
328
err = UninstallCRDs (env .Config , CRDInstallOptions {
324
- Paths : []string {filepath . Join ( "." , "testdata" ) },
329
+ Paths : []string {validDirectory },
325
330
})
326
331
Expect (err ).NotTo (HaveOccurred ())
327
332
@@ -349,4 +354,20 @@ var _ = Describe("Test", func() {
349
354
close (done )
350
355
}, 30 )
351
356
})
357
+
358
+ Describe ("Start" , func () {
359
+ It ("should raise an error" , func (done Done ) {
360
+ env = & Environment {ErrorIfCRDPathMissing : true , CRDDirectoryPaths : []string {invalidDirectory }}
361
+ _ , err := env .Start ()
362
+ Expect (err ).To (HaveOccurred ())
363
+ close (done )
364
+ }, 30 )
365
+
366
+ It ("should not raise an error" , func (done Done ) {
367
+ env = & Environment {ErrorIfCRDPathMissing : false , CRDDirectoryPaths : []string {invalidDirectory }}
368
+ _ , err := env .Start ()
369
+ Expect (err ).NotTo (HaveOccurred ())
370
+ close (done )
371
+ }, 30 )
372
+ })
352
373
})
0 commit comments