@@ -73,15 +73,20 @@ var _ = Describe("Cluster Platform Use Cases :: ", Label("cluster"), Ordered, fu
7373 Expect (err ).NotTo (HaveOccurred ())
7474 }
7575 }
76+
77+ // Remove SonataFlowClusterPlatform created in the last run
78+ cmd := exec .Command ("kubectl" , "delete" , "sonataflowclusterplatform" , "--all" , "--wait" )
79+ _ , err := utils .Run (cmd )
80+ Expect (err ).NotTo (HaveOccurred ())
7681 })
7782 var _ = Context ("with supporting services enabled" , func () {
7883 DescribeTable ("against a platform in a separate namespace" , func (testcaseDir string , profile string , persistenceType string , withServices bool ) {
7984 By ("Deploy the SonataFlowPlatform CR" )
8085 var manifests []byte
8186 EventuallyWithOffset (1 , func () error {
8287 var err error
83- cmd := exec .Command ("kubectl" , "kustomize" , filepath . Join ( projectDir ,
84- test .GetSonataFlowE2EPlatformServicesDirectory () , profile , clusterWideEphemeral ))
88+ cmd := exec .Command ("kubectl" , "kustomize" ,
89+ test .GetPathFromE2EDirectory ( "platform" , "services" , profile , clusterWideEphemeral ))
8590 manifests , err = utils .Run (cmd )
8691 return err
8792 }, time .Minute , time .Second ).Should (Succeed ())
@@ -91,7 +96,7 @@ var _ = Describe("Cluster Platform Use Cases :: ", Label("cluster"), Ordered, fu
9196 _ , err := utils .Run (cmd )
9297 Expect (err ).NotTo (HaveOccurred ())
9398
94- By ("Wait for SonatatFlowPlatform CR in " + targetNamespace + " to be ready" )
99+ By ("Wait for SonataFlowPlatform CR in " + targetNamespace + " to be ready" )
95100 // wait for platform to be ready
96101 EventuallyWithOffset (1 , func () error {
97102 cmd = exec .Command ("kubectl" , "wait" , "sfplatform" , "-n" , targetNamespace , "sonataflow-platform" , "--for" , "condition=Succeed" , "--timeout=5s" )
@@ -116,7 +121,7 @@ var _ = Describe("Cluster Platform Use Cases :: ", Label("cluster"), Ordered, fu
116121 }, 20 * time .Minute , 5 ).Should (Succeed ())
117122
118123 if withServices {
119- By ("Deploy SonatatFlowPlatform CR with services configured in " + targetNamespace2 )
124+ By ("Deploy SonataFlowPlatform CR with services configured in " + targetNamespace2 )
120125 EventuallyWithOffset (1 , func () error {
121126 var err error
122127 cmd := exec .Command ("kubectl" , "kustomize" , filepath .Join (projectDir ,
@@ -148,18 +153,24 @@ var _ = Describe("Cluster Platform Use Cases :: ", Label("cluster"), Ordered, fu
148153 return returnedValue
149154 }, 20 * time .Minute , 5 ).Should (Equal ([]byte ("''" )))
150155
156+ By ("Replacing the image with a prebuilt one and rollout" )
157+ EventuallyWithOffset (1 , func () error {
158+ return kubectlPatchSonataFlowImageAndRollout (targetNamespace2 , prebuiltWorkflows .CallBack .Name , prebuiltWorkflows .CallBack .Tag )
159+ }, 3 * time .Minute , time .Second ).Should (Succeed ())
160+
161+ By ("Waiting for Data Index and Jobs Service URLs" )
151162 dataIndexServiceUrl := services .GenerateServiceURL (constants .DefaultHTTPProtocol , targetNamespace2 , "sonataflow-platform-" + constants .DataIndexServiceName )
152163 jobServiceUrl := services .GenerateServiceURL (constants .DefaultHTTPProtocol , targetNamespace2 , "sonataflow-platform-" + constants .JobServiceName )
153164 EventuallyWithOffset (1 , func () []byte {
154- cmd = exec .Command ("kubectl" , "get" , "sf" , "-n" , targetNamespace2 , "callbackstatetimeouts" , "-o" , "jsonpath='{.status.services.dataIndexRef.url}'" )
165+ cmd = exec .Command ("kubectl" , "get" , "sf" , "-n" , targetNamespace2 , prebuiltWorkflows . CallBack . Name , "-o" , "jsonpath='{.status.services.dataIndexRef.url}'" )
155166 returnedValue , _ := utils .Run (cmd )
156167 return returnedValue
157- }, 20 * time .Minute , 5 ).Should (Equal ([]byte ("'" + dataIndexServiceUrl + "'" )))
168+ }, 3 * time .Minute , 5 ).Should (Equal ([]byte ("'" + dataIndexServiceUrl + "'" )))
158169 EventuallyWithOffset (1 , func () []byte {
159- cmd = exec .Command ("kubectl" , "get" , "sf" , "-n" , targetNamespace2 , "callbackstatetimeouts" , "-o" , "jsonpath='{.status.services.jobServiceRef.url}'" )
170+ cmd = exec .Command ("kubectl" , "get" , "sf" , "-n" , targetNamespace2 , prebuiltWorkflows . CallBack . Name , "-o" , "jsonpath='{.status.services.jobServiceRef.url}'" )
160171 returnedValue , _ := utils .Run (cmd )
161172 return returnedValue
162- }, 20 * time .Minute , 5 ).Should (Equal ([]byte ("'" + jobServiceUrl + "'" )))
173+ }, 3 * time .Minute , 5 ).Should (Equal ([]byte ("'" + jobServiceUrl + "'" )))
163174 } else {
164175 EventuallyWithOffset (1 , func () error {
165176 var err error
@@ -193,32 +204,38 @@ var _ = Describe("Cluster Platform Use Cases :: ", Label("cluster"), Ordered, fu
193204 returnedValue , _ := utils .Run (cmd )
194205 return returnedValue
195206 }, 20 * time .Minute , 5 ).Should (Equal ([]byte ("'" + jobServiceUrl + "'" )))
207+
208+ By ("Replacing the image with a prebuilt one and rollout" )
209+ EventuallyWithOffset (1 , func () error {
210+ return kubectlPatchSonataFlowImageAndRollout (targetNamespace2 , prebuiltWorkflows .CallBack .Name , prebuiltWorkflows .CallBack .Tag )
211+ }, 3 * time .Minute , time .Second ).Should (Succeed ())
212+
213+ By ("Waiting for Data Index and Jobs Service URLs" )
196214 EventuallyWithOffset (1 , func () []byte {
197- cmd = exec .Command ("kubectl" , "get" , "sf" , "-n" , targetNamespace2 , "callbackstatetimeouts" , "-o" , "jsonpath='{.status.services.dataIndexRef.url}'" )
215+ cmd = exec .Command ("kubectl" , "get" , "sf" , "-n" , targetNamespace2 , prebuiltWorkflows . CallBack . Name , "-o" , "jsonpath='{.status.services.dataIndexRef.url}'" )
198216 returnedValue , _ := utils .Run (cmd )
199217 return returnedValue
200- }, 20 * time .Minute , 5 ).Should (Equal ([]byte ("'" + dataIndexServiceUrl + "'" )))
218+ }, 3 * time .Minute , 5 ).Should (Equal ([]byte ("'" + dataIndexServiceUrl + "'" )))
201219 EventuallyWithOffset (1 , func () []byte {
202- cmd = exec .Command ("kubectl" , "get" , "sf" , "-n" , targetNamespace2 , "callbackstatetimeouts" , "-o" , "jsonpath='{.status.services.jobServiceRef.url}'" )
220+ cmd = exec .Command ("kubectl" , "get" , "sf" , "-n" , targetNamespace2 , prebuiltWorkflows . CallBack . Name , "-o" , "jsonpath='{.status.services.jobServiceRef.url}'" )
203221 returnedValue , _ := utils .Run (cmd )
204222 return returnedValue
205- }, 20 * time .Minute , 5 ).Should (Equal ([]byte ("'" + jobServiceUrl + "'" )))
223+ }, 3 * time .Minute , 5 ).Should (Equal ([]byte ("'" + jobServiceUrl + "'" )))
206224 }
207225 cmd = exec .Command ("kubectl" , "delete" , "SonataFlowClusterPlatform" , "cluster" , "--wait" )
208226 _ , err = utils .Run (cmd )
209227 Expect (err ).NotTo (HaveOccurred ())
210228 },
211- Entry ("without services configured" , test .GetSonataFlowE2EPlatformNoServicesDirectory ( ), metadata .PreviewProfile .String (), ephemeral , false ),
212- Entry ("with services configured" , test .GetSonataFlowE2EPlatformServicesDirectory ( ), metadata .PreviewProfile .String (), "ephemeral-with-workflow" , true ),
229+ Entry ("without services configured" , test .GetPathFromE2EDirectory ( "platform" , "noservices" ), metadata .GitOpsProfile .String (), ephemeral , false ),
230+ Entry ("with services configured" , test .GetPathFromE2EDirectory ( "platform" , "services" ), metadata .GitOpsProfile .String (), "ephemeral-with-workflow" , true ),
213231 )
214232
215233 DescribeTable ("against a platform in a separate namespace" , func (testcaseDir string , profile string , persistenceType string ) {
216234 By ("Deploy the SonataFlowPlatform CR" )
217235 var manifests []byte
218236 EventuallyWithOffset (1 , func () error {
219237 var err error
220- cmd := exec .Command ("kubectl" , "kustomize" , filepath .Join (projectDir ,
221- test .GetSonataFlowE2EPlatformServicesDirectory (), profile , clusterWideEphemeral ))
238+ cmd := exec .Command ("kubectl" , "kustomize" , test .GetPathFromE2EDirectory ("platform" , "services" , profile , clusterWideEphemeral ))
222239 manifests , err = utils .Run (cmd )
223240 return err
224241 }, time .Minute , time .Second ).Should (Succeed ())
@@ -287,8 +304,8 @@ var _ = Describe("Cluster Platform Use Cases :: ", Label("cluster"), Ordered, fu
287304 _ , err = utils .Run (cmd )
288305 Expect (err ).NotTo (HaveOccurred ())
289306 },
290- Entry ("with only Data Index configured" , test .GetSonataFlowE2EPlatformServicesDirectory ( ), metadata .PreviewProfile .String (), ephemeralDataIndex ),
291- Entry ("with only Job Service configured" , test .GetSonataFlowE2EPlatformServicesDirectory ( ), metadata .PreviewProfile .String (), ephemeralJobService ),
307+ Entry ("with only Data Index configured" , test .GetPathFromE2EDirectory ( "platform" , "services" ), metadata .GitOpsProfile .String (), ephemeralDataIndex ),
308+ Entry ("with only Job Service configured" , test .GetPathFromE2EDirectory ( "platform" , "services" ), metadata .GitOpsProfile .String (), ephemeralJobService ),
292309 )
293310 })
294311})
0 commit comments