@@ -6987,6 +6987,61 @@ var _ = SIGDescribe("Rollout v1beta1", func() {
69876987 cond = getRolloutCondition (rollout .Status , v1beta1 .RolloutConditionSucceeded )
69886988 Expect (string (cond .Status )).Should (Equal (string (metav1 .ConditionTrue )))
69896989 })
6990+
6991+ It ("V1->V2: release 1 and delete rollout cr" , func () {
6992+ By ("Creating Rollout..." )
6993+ rollout := & v1beta1.Rollout {}
6994+ Expect (ReadYamlToObject ("./test_data/rollout/rollout_v1beta1_native_daemonset_base.yaml" , rollout )).ToNot (HaveOccurred ())
6995+ CreateObject (rollout )
6996+
6997+ By ("Creating workload and waiting for all pods ready..." )
6998+ // workload
6999+ workload := & apps.DaemonSet {}
7000+ Expect (ReadYamlToObject ("./test_data/rollout/native_daemonset.yaml" , workload )).ToNot (HaveOccurred ())
7001+ CreateObject (workload )
7002+ WaitNativeDaemonSetPodsReady (workload )
7003+
7004+ // check rollout status
7005+ Expect (GetObject (rollout .Name , rollout )).NotTo (HaveOccurred ())
7006+ Expect (GetObject (workload .Name , workload )).NotTo (HaveOccurred ())
7007+ Expect (rollout .Status .Phase ).Should (Equal (v1beta1 .RolloutPhaseHealthy ))
7008+ By ("check rollout status success" )
7009+
7010+ // v1 -> v2, start rollout action
7011+ By ("Update daemonset env VERSION from(version1) -> to(version2)" )
7012+ newEnvs := mergeEnvVar (workload .Spec .Template .Spec .Containers [0 ].Env , v1.EnvVar {Name : "VERSION" , Value : "version2" })
7013+ workload .Spec .Template .Spec .Containers [0 ].Env = newEnvs
7014+ UpdateNativeDaemonSet (workload )
7015+ time .Sleep (time .Second * 3 )
7016+
7017+ // wait step 1 complete
7018+ WaitRolloutStepPaused (rollout .Name , 1 )
7019+ // check workload status & paused
7020+ Expect (GetObject (workload .Name , workload )).NotTo (HaveOccurred ())
7021+ Expect (workload .Status .UpdatedNumberScheduled ).Should (BeNumerically ("==" , 1 ))
7022+ By ("check daemonset status success, 1 pod updated" )
7023+
7024+ // check rollout status
7025+ Expect (GetObject (rollout .Name , rollout )).NotTo (HaveOccurred ())
7026+ Expect (rollout .Status .Phase ).Should (Equal (v1beta1 .RolloutPhaseProgressing ))
7027+ Expect (rollout .Status .CanaryStatus .CurrentStepIndex ).Should (BeNumerically ("==" , 1 ))
7028+ Expect (rollout .Status .CanaryStatus .NextStepIndex ).Should (BeNumerically ("==" , 2 ))
7029+
7030+ // delete rollout CR
7031+ By ("Delete rollout CR" )
7032+ Expect (k8sClient .Delete (context .TODO (), rollout )).NotTo (HaveOccurred ())
7033+ WaitRolloutNotFound (rollout .Name )
7034+ By ("rollout CR deleted" )
7035+
7036+ // wait 5 seconds and check workload status remains unchanged
7037+ By ("Wait 5 seconds and verify workload status remains paused" )
7038+ time .Sleep (time .Second * 5 )
7039+
7040+ // check workload status - should still have only 1 pod updated (paused state)
7041+ Expect (GetObject (workload .Name , workload )).NotTo (HaveOccurred ())
7042+ Expect (workload .Status .UpdatedNumberScheduled ).Should (BeNumerically ("==" , 1 ))
7043+ By ("Verified: workload remains paused with 1 pod updated after rollout CR deletion" )
7044+ })
69907045 })
69917046})
69927047
0 commit comments