This is an automated email from the ASF dual-hosted git repository.

dahn pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/master by this push:
     new 5291529  Adding zone disablement during deletion of the range plus one 
more tr… (#3028)
5291529 is described below

commit 529152959a19d6b41c224579b89b06a54479d126
Author: Boris Stoyanov - a.k.a Bobby <[email protected]>
AuthorDate: Mon Nov 19 10:28:15 2018 +0200

    Adding zone disablement during deletion of the range plus one more tr… 
(#3028)
    
    ## Description
    <!--- Describe your changes in detail -->
    Disabling the execution of tests that SystemVMs acquire mocked public IPs, 
since it's braking other tests along the execution.
    <!-- For new features, provide link to FS, dev ML discussion etc. -->
    <!-- In case of bug fix, the expected and actual behaviours, steps to 
reproduce. -->
    
    <!-- When "Fixes: #<id>" is specified, the issue/PR will automatically be 
closed when this PR gets merged -->
    <!-- For addressing multiple issues/PRs, use multiple "Fixes: #<id>" -->
    <!-- Fixes: # -->
    
    ## Types of changes
    <!--- What types of changes does your code introduce? Put an `x` in all the 
boxes that apply: -->
    - [X] Breaking change (fix or feature that would cause existing 
functionality to change)
    - [ ] New feature (non-breaking change which adds functionality)
    - [X] Bug fix (non-breaking change which fixes an issue)
    - [ ] Enhancement (improves an existing feature and functionality)
    - [X] Cleanup (Code refactoring and cleanup, that may add test cases)
    
    ## Screenshots (if appropriate):
    NA
    ## How Has This Been Tested?
    <!-- Please describe in detail how you tested your changes. -->
    <!-- Include details of your testing environment, and the tests you ran to 
-->
    <!-- see how your change affects other areas of the code, etc. -->
    The tests were executed and passed locally
    
    <!-- Please read the 
[CONTRIBUTING](https://github.com/apache/cloudstack/blob/master/CONTRIBUTING.md)
 document -->
---
 test/integration/smoke/test_public_ip_range.py | 69 +++++++++++++++++++++++---
 1 file changed, 61 insertions(+), 8 deletions(-)

diff --git a/test/integration/smoke/test_public_ip_range.py 
b/test/integration/smoke/test_public_ip_range.py
index 92b35ad..40bc098 100644
--- a/test/integration/smoke/test_public_ip_range.py
+++ b/test/integration/smoke/test_public_ip_range.py
@@ -297,6 +297,12 @@ class TestDedicatePublicIPRange(cloudstackTestCase):
             "Check whether System VM Public IP is in range dedicated to system 
vms"
         )
 
+        # Disable Zone to be sure System VMs will not get recreated between 
calls
+        cmd = updateZone.updateZoneCmd()
+        cmd.id = self.zone.id
+        cmd.allocationstate = 'Disabled'
+        self.apiclient.updateZone(cmd)
+
         # Delete System VM and IP range, so System VM can get IP from original 
ranges
         self.debug("Destroying System VM: %s" % systemvm_id)
         cmd = destroySystemVm.destroySystemVmCmd()
@@ -306,6 +312,12 @@ class TestDedicatePublicIPRange(cloudstackTestCase):
         domain_id = public_ip_range.vlan.domainid
         public_ip_range.delete(self.apiclient)
 
+        # Enable Zone
+        cmd = updateZone.updateZoneCmd()
+        cmd.id = self.zone.id
+        cmd.allocationstate = 'Enabled'
+        self.apiclient.updateZone(cmd)
+
         # Wait for System VM to start and check System VM public IP
         systemvm_id = self.wait_for_system_vm_start(
             domain_id,
@@ -353,10 +365,14 @@ class TestDedicatePublicIPRange(cloudstackTestCase):
             "vlan":self.services["vlan"]
         }
 
-        self.base_system_vm(
-            services,
-            'secondarystoragevm'
-        )
+        try:
+            self.base_system_vm(
+                services,
+                'secondarystoragevm'
+            )
+        except Exception:
+            self.delete_range()
+
         return
 
     @attr(tags = ["advanced", "publiciprange", "dedicate", "release"], 
required_hardware="false")
@@ -377,8 +393,45 @@ class TestDedicatePublicIPRange(cloudstackTestCase):
             "vlan":self.services["vlan"]
         }
 
-        self.base_system_vm(
-            services,
-            'consoleproxy'
-        )
+        try:
+            self.base_system_vm(
+                services,
+                'consoleproxy'
+            )
+        except Exception:
+            self.delete_range()
+
         return
+
+    def delete_range(self):
+
+        # List System VMs
+        system_vms = list_ssvms(
+            self.apiclient,
+        )
+
+        # Disable Zone to be sure System VMs will not get recreated between 
calls
+        cmd = updateZone.updateZoneCmd()
+        cmd.id = self.zone.id
+        cmd.allocationstate = 'Disabled'
+        self.apiclient.updateZone(cmd)
+
+        # Delete System VM and IP range, so System VM can get IP from original 
ranges
+        for v in system_vms:
+            self.debug("Destroying System VM: %s" % v.id)
+            cmd = destroySystemVm.destroySystemVmCmd()
+            cmd.id = v.id
+            self.apiclient.destroySystemVm(cmd)
+
+        public_ip_range = PublicIpRange.list(
+            self.apiclient,
+            forsystemvms=True
+        )
+
+        public_ip_range.delete(self.apiclient)
+
+        # Enable Zone
+        cmd = updateZone.updateZoneCmd()
+        cmd.id = self.zone.id
+        cmd.allocationstate = 'Enabled'
+        self.apiclient.updateZone(cmd)

Reply via email to