@@ -20,42 +20,37 @@ const (
2020)
2121
2222var  _  =  Describe ("Operator Install" , func () {
23- 	When ( "a valid Operator CR specifying a package "func () {
23+ 	It ( "resolves the specified package with correct bundle path "func () {
2424		var  (
25- 			operator  * operatorv1alpha1.Operator 
26- 			ctx       context.Context 
27- 			err       error 
28- 		)
29- 		BeforeEach (func () {
30- 			ctx  =  context .Background ()
31- 			operator  =  & operatorv1alpha1.Operator {
25+ 			ctx       context.Context             =  context .Background ()
26+ 			pkgName   string                      =  "prometheus" 
27+ 			operator  * operatorv1alpha1.Operator  =  & operatorv1alpha1.Operator {
3228				ObjectMeta : metav1.ObjectMeta {
3329					Name : fmt .Sprintf ("operator-%s" , rand .String (8 )),
3430				},
3531				Spec : operatorv1alpha1.OperatorSpec {
36- 					PackageName : "prometheus" ,
32+ 					PackageName : pkgName ,
3733				},
3834			}
39- 		})
40- 		AfterEach (func () {
41- 			By ("deleting the testing Operator resource" )
42- 			err  =  c .Delete (ctx , operator )
43- 			Expect (err ).ToNot (HaveOccurred ())
44- 		})
45- 		It ("resolves the specified package with correct bundle path" , func () {
46- 			By ("creating an operator CR" )
47- 			err  =  c .Create (ctx , operator )
48- 			Expect (err ).ToNot (HaveOccurred ())
49- 			// TODO dfranz: This test currently relies on the hard-coded CatalogSources found in bundle_cache.go 
50- 			// and should be re-worked to use a real or test catalog source when the hard-coded stuff is removed 
51- 			By ("operator CR status is updated with correct bundle path" )
52- 			Eventually (func (g  Gomega ) {
53- 				err  =  c .Get (ctx , types.NamespacedName {Name : operator .Name }, operator )
54- 				g .Expect (err ).ToNot (HaveOccurred ())
55- 				g .Expect (operator .Status .BundlePath ).To (Equal ("operatorhub/prometheus/0.47.0" ))
56- 				g .Expect (len (operator .Status .Conditions )).To (Equal (1 ))
57- 				g .Expect (operator .Status .Conditions [0 ].Message ).To (Equal ("resolution was successful" ))
58- 			}).WithTimeout (defaultTimeout ).WithPolling (defaultPoll ).Should (Succeed ())
59- 		})
35+ 		)
36+ 		ctx  =  context .Background ()
37+ 		By ("creating the Operator resource" )
38+ 		err  :=  c .Create (ctx , operator )
39+ 		Expect (err ).ToNot (HaveOccurred ())
40+ 
41+ 		// TODO dfranz: This test currently relies on the hard-coded CatalogSources found in bundle_cache.go 
42+ 		// and should be re-worked to use a real or test catalog source when the hard-coded stuff is removed 
43+ 		By ("eventually reporting a successful resolution and bundle path" )
44+ 		Eventually (func (g  Gomega ) {
45+ 			err  =  c .Get (ctx , types.NamespacedName {Name : operator .Name }, operator )
46+ 			g .Expect (err ).ToNot (HaveOccurred ())
47+ 			g .Expect (operator .Status .BundlePath ).To (Equal ("operatorhub/prometheus/0.47.0" ))
48+ 			g .Expect (len (operator .Status .Conditions )).To (Equal (1 ))
49+ 			g .Expect (operator .Status .Conditions [0 ].Message ).To (Equal ("resolution was successful" ))
50+ 		}).WithTimeout (defaultTimeout ).WithPolling (defaultPoll ).Should (Succeed ())
51+ 
52+ 		By ("deleting the Operator resource" )
53+ 		err  =  c .Delete (ctx , operator )
54+ 		Expect (err ).ToNot (HaveOccurred ())
6055	})
6156})
0 commit comments