Browse Source

Rollback multiple times a daemonset using updateStrategy type: RollingUpdate and --to-revision=0 arg

Change-Id: I368ccd75b668457467400052c4307a085da76f0a
Artem Grechanichenko 2 years ago
parent
commit
a1f1304fba
1 changed files with 84 additions and 0 deletions
  1. 84
    0
      fuel_ccp_tests/tests/system/test_daemonsets.py

+ 84
- 0
fuel_ccp_tests/tests/system/test_daemonsets.py View File

@@ -650,3 +650,87 @@ class TestDaemonsetsUpdates():
650 650
                 self.to_nginx_image_1_12),
651 651
             timeout=2 * 60
652 652
         )
653
+
654
+    @pytest.mark.revert_snapshot(ext.SNAPSHOT.k8s_deployed)
655
+    @pytest.mark.fail_snapshot
656
+    @pytest.mark.snapshot_needed
657
+    def test_daemonset_multirollout_rollingupdate_default(self, underlay,
658
+                                                          k8scluster,
659
+                                                          config,
660
+                                                          show_step):
661
+        """Rollback multiple times a daemonset using updateStrategy type:
662
+           RollingUpdate --to-revision=0
663
+
664
+        Scenario:
665
+            1. Deploy k8s using fuel-ccp-installer
666
+            2. Create a DaemonSet for nginx with image version 1_10 and
667
+               update strategy RollingUpdate
668
+            3. Wait until nginx pods are created and become 'ready'
669
+            4. Check that the image version in the nginx pods is 1_10
670
+               Check that the image version in the nginx daemonset is 1_10
671
+            5. Change nginx image version to 1_11 using YAML
672
+            6. Wait for 10 seconds (needs to check that there were
673
+               no auto updates of the nginx pods)
674
+            7. Check that the image version in the nginx daemonset
675
+               is updated to 1_11
676
+               Wait for ~120 sec that the image version
677
+               in the nginx pods is changed to 1_11
678
+            8. Rollback the nginx daemonset:
679
+               kubectl rollout undo daemonset/nginx
680
+            9. Check that the image version in the nginx daemonset is
681
+               downgraded to 1_10
682
+               Wait for ~120 sec that the image version
683
+               in the nginx pods is downgraded to 1_10
684
+            10. Rollback the nginx daemonset:
685
+               kubectl rollout undo daemonset/nginx --to-revision=0
686
+            11. Check that the image version in the nginx daemonset
687
+               is updated to 1_11
688
+               Wait for ~120 sec that the image version
689
+               in the nginx pods is changed to 1_11
690
+            12. Rollback the nginx daemonset:
691
+               kubectl rollout undo daemonset/nginx --to-revision=0
692
+            13. Check that the image version in the nginx daemonset is
693
+               downgraded to 1_10
694
+               Wait for ~120 sec that the image version
695
+               in the nginx pods is downgraded to 1_10
696
+
697
+        Duration: 3000 seconds
698
+        """
699
+
700
+        self.test_daemonset_rollout_rollingupdate(underlay, k8scluster,
701
+                                                  config, show_step)
702
+        k8sclient = k8scluster.api
703
+
704
+        # STEP #10
705
+        show_step(10)
706
+        cmd = "kubectl rollout undo daemonset/nginx --to-revision=0"
707
+        underlay.check_call(cmd,
708
+                            host=config.k8s.kube_host)
709
+
710
+        # STEP #11
711
+        show_step(11)
712
+        self.check_nginx_ds_image(k8sclient, self.to_nginx_image)
713
+        # Pods should have new image version
714
+        helpers.wait_pass(
715
+            lambda: self.check_nginx_pods_image(
716
+                k8sclient,
717
+                self.to_nginx_image),
718
+            timeout=2 * 60
719
+        )
720
+
721
+        # STEP #12
722
+        show_step(12)
723
+        cmd = "kubectl rollout undo daemonset/nginx --to-revision=0"
724
+        underlay.check_call(cmd,
725
+                            host=config.k8s.kube_host)
726
+
727
+        # STEP #13
728
+        show_step(13)
729
+        self.check_nginx_ds_image(k8sclient, self.from_nginx_image)
730
+        # Pods should have new image version
731
+        helpers.wait_pass(
732
+            lambda: self.check_nginx_pods_image(
733
+                k8sclient,
734
+                self.from_nginx_image),
735
+            timeout=2 * 60
736
+        )

Loading…
Cancel
Save