@@ -36,6 +36,9 @@ var _ = Describe("Test", func() {
3636 var s * runtime.Scheme
3737 var c client.Client
3838
39+ var validDirectory = filepath .Join ("." , "testdata" )
40+ var invalidDirectory = "fake"
41+
3942 // Initialize the client
4043 BeforeEach (func (done Done ) {
4144 crds = []* v1beta1.CustomResourceDefinition {}
@@ -72,7 +75,7 @@ var _ = Describe("Test", func() {
7275 It ("should install the CRDs into the cluster" , func (done Done ) {
7376
7477 crds , err = InstallCRDs (env .Config , CRDInstallOptions {
75- Paths : []string {filepath . Join ( "." , "testdata" ) },
78+ Paths : []string {validDirectory },
7679 })
7780 Expect (err ).NotTo (HaveOccurred ())
7881
@@ -164,14 +167,16 @@ var _ = Describe("Test", func() {
164167 }, 5 )
165168
166169 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 }})
168171 Expect (err ).NotTo (HaveOccurred ())
169172
170173 close (done )
171174 }, 5 )
172175
173176 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+ })
175180 Expect (err ).To (HaveOccurred ())
176181
177182 close (done )
@@ -232,7 +237,7 @@ var _ = Describe("Test", func() {
232237 It ("should uninstall the CRDs from the cluster" , func (done Done ) {
233238
234239 crds , err = InstallCRDs (env .Config , CRDInstallOptions {
235- Paths : []string {filepath . Join ( "." , "testdata" ) },
240+ Paths : []string {validDirectory },
236241 })
237242 Expect (err ).NotTo (HaveOccurred ())
238243
@@ -321,7 +326,7 @@ var _ = Describe("Test", func() {
321326 Expect (err ).NotTo (HaveOccurred ())
322327
323328 err = UninstallCRDs (env .Config , CRDInstallOptions {
324- Paths : []string {filepath . Join ( "." , "testdata" ) },
329+ Paths : []string {validDirectory },
325330 })
326331 Expect (err ).NotTo (HaveOccurred ())
327332
@@ -349,4 +354,20 @@ var _ = Describe("Test", func() {
349354 close (done )
350355 }, 30 )
351356 })
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+ })
352373})
0 commit comments