@@ -96,8 +96,11 @@ var _ = Describe("OpenStackOperator controller", func() {
9696 version := GetOpenStackVersion (names .OpenStackVersionName )
9797 g .Expect (version ).Should (Not (BeNil ()))
9898
99- g .Expect (* version .Status .AvailableVersion ).Should (Equal ("0.0.1" ))
100- g .Expect (version .Spec .TargetVersion ).Should (Equal ("0.0.1" ))
99+ // no condition which reflects an update is available
100+ g .Expect (version .Status .Conditions .Has (corev1 .OpenStackVersionMinorUpdateAvailable )).To (BeFalse ())
101+
102+ g .Expect (* version .Status .AvailableVersion ).Should (ContainSubstring ("0.0.1" ))
103+ g .Expect (version .Spec .TargetVersion ).Should (ContainSubstring ("0.0.1" ))
101104
102105 g .Expect (version .Status .ContainerImages .AgentImage ).ShouldNot (BeNil ())
103106 g .Expect (version .Status .ContainerImages .AnsibleeeImage ).ShouldNot (BeNil ())
@@ -291,15 +294,15 @@ var _ = Describe("OpenStackOperator controller", func() {
291294 targetOvnControllerVersion = * version .Status .ContainerImages .OvnControllerImage
292295 g .Expect (version ).Should (Not (BeNil ()))
293296
294- g .Expect (* version .Status .AvailableVersion ).Should (Equal ("0.0.1" ))
295- g .Expect (version .Spec .TargetVersion ).Should (Equal ("0.0.1" ))
296-
297+ g .Expect (* version .Status .AvailableVersion ).Should (ContainSubstring ("0.0.1" ))
298+ g .Expect (version .Spec .TargetVersion ).Should (ContainSubstring ("0.0.1" ))
299+ updatedVersion = * version . Status . AvailableVersion
297300 }, timeout , interval ).Should (Succeed ())
298301
299302 // inject an "old" version
300303 Eventually (func (g Gomega ) {
301304 version := GetOpenStackVersion (names .OpenStackVersionName )
302- version .Status .ContainerImageVersionDefaults [initialVersion ] = version .Status .ContainerImageVersionDefaults ["0.0.1" ]
305+ version .Status .ContainerImageVersionDefaults [initialVersion ] = version .Status .ContainerImageVersionDefaults [updatedVersion ]
303306 version .Status .ContainerImageVersionDefaults [initialVersion ].OvnControllerImage = & testOvnControllerImage
304307 g .Expect (th .K8sClient .Status ().Update (th .Ctx , version )).To (Succeed ())
305308
@@ -391,6 +394,15 @@ var _ = Describe("OpenStackOperator controller", func() {
391394
392395 // 1) switch to version 0.0.1, this triggers a minor update
393396 osversion := GetOpenStackVersion (names .OpenStackVersionName )
397+
398+ // should have a condition which reflects an update is available
399+ th .ExpectCondition (
400+ names .OpenStackVersionName ,
401+ ConditionGetterFunc (OpenStackVersionConditionGetter ),
402+ corev1 .OpenStackVersionMinorUpdateAvailable ,
403+ k8s_corev1 .ConditionTrue ,
404+ )
405+
394406 osversion .Spec .TargetVersion = updatedVersion
395407 Expect (k8sClient .Update (ctx , osversion )).Should (Succeed ())
396408
@@ -536,7 +548,8 @@ var _ = Describe("OpenStackOperator controller", func() {
536548 k8s_corev1 .ConditionTrue ,
537549 )
538550 g .Expect (osversion .Status .DeployedVersion ).Should (Equal (& updatedVersion )) // we're done here
539-
551+ // no condition which reflects an update is available
552+ g .Expect (osversion .Status .Conditions .Has (corev1 .OpenStackVersionMinorUpdateAvailable )).To (BeFalse ())
540553 }, timeout , interval ).Should (Succeed ())
541554
542555 })
0 commit comments