@@ -12,7 +12,6 @@ import (
1212
1313 //revive:disable-next-line:dot-imports
1414 . "github.com/openstack-k8s-operators/lib-common/modules/common/test/helpers"
15- ansibleeev1 "github.com/openstack-k8s-operators/openstack-ansibleee-operator/api/v1beta1"
1615 baremetalv1 "github.com/openstack-k8s-operators/openstack-baremetal-operator/api/v1beta1"
1716 corev1 "k8s.io/api/core/v1"
1817 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -134,7 +133,8 @@ var _ = Describe("Dataplane Deployment Test", func() {
134133 CreateDataplaneService (dataplaneGlobalServiceName , true )
135134 // with EDPMServiceType set
136135 CreateDataPlaneServiceFromSpec (dataplaneUpdateServiceName , map [string ]interface {}{
137- "EDPMServiceType" : "foo-service" })
136+ "edpmServiceType" : "foo-update-service" ,
137+ "openStackAnsibleEERunnerImage" : "foo-image:latest" })
138138
139139 DeferCleanup (th .DeleteService , dataplaneServiceName )
140140 DeferCleanup (th .DeleteService , dataplaneGlobalServiceName )
@@ -210,25 +210,22 @@ var _ = Describe("Dataplane Deployment Test", func() {
210210 Name : aeeName ,
211211 Namespace : dataplaneDeploymentName .Namespace ,
212212 }
213- ansibleEE := & ansibleeev1.OpenStackAnsibleEE {
214- ObjectMeta : metav1.ObjectMeta {
215- Name : ansibleeeName .Name ,
216- Namespace : ansibleeeName .Namespace ,
217- }}
218- g .Expect (th .K8sClient .Get (th .Ctx , ansibleeeName , ansibleEE )).To (Succeed ())
219- ansibleEE .Status .JobStatus = ansibleeev1 .JobStatusSucceeded
213+ ansibleEE := GetAnsibleee (ansibleeeName )
220214
215+ ansibleEE .Status .Succeeded = 1
221216 g .Expect (th .K8sClient .Status ().Update (th .Ctx , ansibleEE )).To (Succeed ())
222- g .Expect (ansibleEE .Spec .ExtraVars ).To (HaveKey ("edpm_override_hosts" ))
223217 if service .Spec .EDPMServiceType != "" {
224- g .Expect (string (ansibleEE .Spec .ExtraVars ["edpm_service_type" ])).To (Equal (fmt .Sprintf ("\" %s\" " , service .Spec .EDPMServiceType )))
218+ g .Expect (findEnvVar (ansibleEE .Spec .Template .Spec .Containers [0 ].Env ).Value ).To (ContainSubstring ("edpm_service_type" ))
219+ g .Expect (findEnvVar (ansibleEE .Spec .Template .Spec .Containers [0 ].Env ).Value ).To (ContainSubstring (service .Spec .EDPMServiceType ))
225220 } else {
226- g .Expect (string (ansibleEE .Spec .ExtraVars [ "edpm_service_type" ]) ).To (Equal ( fmt . Sprintf ( " \" %s \" " , serviceName ) ))
221+ g .Expect (findEnvVar (ansibleEE .Spec .Template . Spec . Containers [ 0 ]. Env ). Value ).To (ContainSubstring ( serviceName ))
227222 }
228223 if service .Spec .DeployOnAllNodeSets {
229- g .Expect (string (ansibleEE .Spec .ExtraVars ["edpm_override_hosts" ])).To (Equal ("\" all\" " ))
224+ g .Expect (findEnvVar (ansibleEE .Spec .Template .Spec .Containers [0 ].Env ).Value ).To (ContainSubstring ("edpm_override_hosts" ))
225+ g .Expect (findEnvVar (ansibleEE .Spec .Template .Spec .Containers [0 ].Env ).Value ).To (ContainSubstring ("all" ))
230226 } else {
231- g .Expect (string (ansibleEE .Spec .ExtraVars ["edpm_override_hosts" ])).To (Equal (fmt .Sprintf ("\" %s\" " , dataplaneNodeSetName .Name )))
227+ g .Expect (findEnvVar (ansibleEE .Spec .Template .Spec .Containers [0 ].Env ).Value ).To (ContainSubstring ("edpm_override_hosts" ))
228+ g .Expect (findEnvVar (ansibleEE .Spec .Template .Spec .Containers [0 ].Env ).Value ).To (ContainSubstring (dataplaneNodeSetName .Name ))
232229 }
233230 }, th .Timeout , th .Interval ).Should (Succeed ())
234231 }
@@ -281,7 +278,8 @@ var _ = Describe("Dataplane Deployment Test", func() {
281278 CreateDataplaneService (dataplaneServiceName , false )
282279 CreateDataplaneService (dataplaneGlobalServiceName , true )
283280 CreateDataPlaneServiceFromSpec (dataplaneUpdateServiceName , map [string ]interface {}{
284- "EDPMServiceType" : "foo-service" })
281+ "edpmServiceType" : "foo-update-service" ,
282+ "openStackAnsibleEERunnerImage" : "foo-image:latest" })
285283
286284 DeferCleanup (th .DeleteService , dataplaneServiceName )
287285 DeferCleanup (th .DeleteService , dataplaneGlobalServiceName )
@@ -430,19 +428,21 @@ var _ = Describe("Dataplane Deployment Test", func() {
430428 }
431429 ansibleEE := GetAnsibleee (ansibleeeName )
432430 if service .Spec .DeployOnAllNodeSets {
433- g .Expect (ansibleEE .Spec .ExtraMounts [ 0 ] .Volumes ).Should (HaveLen (4 ))
431+ g .Expect (ansibleEE .Spec .Template . Spec .Volumes ).Should (HaveLen (4 ))
434432 } else {
435- g .Expect (ansibleEE .Spec .ExtraMounts [ 0 ] .Volumes ).Should (HaveLen (2 ))
433+ g .Expect (ansibleEE .Spec .Template . Spec .Volumes ).Should (HaveLen (2 ))
436434 }
437- ansibleEE .Status .JobStatus = ansibleeev1 . JobStatusSucceeded
435+ ansibleEE .Status .Succeeded = 1
438436 g .Expect (th .K8sClient .Status ().Update (th .Ctx , ansibleEE )).To (Succeed ())
439437 if service .Spec .EDPMServiceType != "" {
440- g .Expect (string (ansibleEE .Spec .ExtraVars [ "edpm_service_type" ]) ).To (Equal ( fmt . Sprintf ( " \" %s \" " , service .Spec .EDPMServiceType ) ))
438+ g .Expect (findEnvVar (ansibleEE .Spec .Template . Spec . Containers [ 0 ]. Env ). Value ).To (ContainSubstring ( service .Spec .EDPMServiceType ))
441439 } else {
442- g .Expect (string (ansibleEE .Spec .ExtraVars [ "edpm_service_type" ]) ).To (Equal ( fmt . Sprintf ( " \" %s \" " , serviceName ) ))
440+ g .Expect (findEnvVar (ansibleEE .Spec .Template . Spec . Containers [ 0 ]. Env ). Value ).To (ContainSubstring ( serviceName ))
443441 }
444442 if service .Spec .DeployOnAllNodeSets {
445- g .Expect (string (ansibleEE .Spec .ExtraVars ["edpm_override_hosts" ])).To (Equal ("\" all\" " ))
443+ g .Expect (findEnvVar (ansibleEE .Spec .Template .Spec .Containers [0 ].Env ).Value ).To (ContainSubstring ("edpm_override_hosts" ))
444+ g .Expect (findEnvVar (ansibleEE .Spec .Template .Spec .Containers [0 ].Env ).Value ).To (ContainSubstring ("all" ))
445+
446446 }
447447 }, th .Timeout , th .Interval ).Should (Succeed ())
448448 }
@@ -467,16 +467,16 @@ var _ = Describe("Dataplane Deployment Test", func() {
467467 }
468468 ansibleEE := GetAnsibleee (ansibleeeName )
469469 if service .Spec .DeployOnAllNodeSets {
470- g .Expect (ansibleEE .Spec .ExtraMounts [ 0 ] .Volumes ).Should (HaveLen (4 ))
470+ g .Expect (ansibleEE .Spec .Template . Spec .Volumes ).Should (HaveLen (4 ))
471471 } else {
472- g .Expect (ansibleEE .Spec .ExtraMounts [ 0 ] .Volumes ).Should (HaveLen (2 ))
472+ g .Expect (ansibleEE .Spec .Template . Spec .Volumes ).Should (HaveLen (2 ))
473473 }
474- ansibleEE .Status .JobStatus = ansibleeev1 . JobStatusSucceeded
474+ ansibleEE .Status .Succeeded = 1
475475 g .Expect (th .K8sClient .Status ().Update (th .Ctx , ansibleEE )).To (Succeed ())
476476 if service .Spec .EDPMServiceType != "" {
477- g .Expect (string (ansibleEE .Spec .ExtraVars [ "edpm_service_type" ]) ).To (Equal ( fmt . Sprintf ( " \" %s \" " , service .Spec .EDPMServiceType ) ))
477+ g .Expect (findEnvVar (ansibleEE .Spec .Template . Spec . Containers [ 0 ]. Env ). Value ).To (ContainSubstring ( service .Spec .EDPMServiceType ))
478478 } else {
479- g .Expect (string (ansibleEE .Spec .ExtraVars [ "edpm_service_type" ]) ).To (Equal ( fmt . Sprintf ( " \" %s \" " , serviceName ) ))
479+ g .Expect (findEnvVar (ansibleEE .Spec .Template . Spec . Containers [ 0 ]. Env ). Value ).To (ContainSubstring ( serviceName ))
480480 }
481481 }, th .Timeout , th .Interval ).Should (Succeed ())
482482 }
@@ -694,7 +694,7 @@ var _ = Describe("Dataplane Deployment Test", func() {
694694 }
695695 Eventually (func (g Gomega ) {
696696 ansibleEE := GetAnsibleee (ansibleeeName )
697- ansibleEE .Status .JobStatus = ansibleeev1 . JobStatusSucceeded
697+ ansibleEE .Status .Succeeded = 1
698698 g .Expect (th .K8sClient .Status ().Update (th .Ctx , ansibleEE )).To (Succeed ())
699699 }, th .Timeout , th .Interval ).Should (Succeed ())
700700
@@ -897,7 +897,7 @@ var _ = Describe("Dataplane Deployment Test", func() {
897897 Namespace : dataplaneMultiNodesetDeploymentName .Namespace ,
898898 }
899899 ansibleEE := GetAnsibleee (ansibleeeName )
900- ansibleEE .Status .JobStatus = ansibleeev1 . JobStatusSucceeded
900+ ansibleEE .Status .Succeeded = 1
901901 g .Expect (th .K8sClient .Status ().Update (th .Ctx , ansibleEE )).To (Succeed ())
902902 }, th .Timeout , th .Interval ).Should (Succeed ())
903903 }
@@ -922,7 +922,7 @@ var _ = Describe("Dataplane Deployment Test", func() {
922922 Namespace : dataplaneMultiNodesetDeploymentName .Namespace ,
923923 }
924924 ansibleEE := GetAnsibleee (ansibleeeName )
925- ansibleEE .Status .JobStatus = ansibleeev1 . JobStatusSucceeded
925+ ansibleEE .Status .Succeeded = 1
926926 g .Expect (th .K8sClient .Status ().Update (th .Ctx , ansibleEE )).To (Succeed ())
927927 }, th .Timeout , th .Interval ).Should (Succeed ())
928928 }
@@ -1023,7 +1023,7 @@ var _ = Describe("Dataplane Deployment Test", func() {
10231023 }
10241024 Eventually (func (g Gomega ) {
10251025 ansibleEE := GetAnsibleee (ansibleeeName )
1026- ansibleEE .Status .JobStatus = ansibleeev1 . JobStatusSucceeded
1026+ ansibleEE .Status .Succeeded = 1
10271027 g .Expect (th .K8sClient .Status ().Update (th .Ctx , ansibleEE )).To (Succeed ())
10281028 }, th .Timeout , th .Interval ).Should (Succeed ())
10291029
0 commit comments