mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Fixed Regression issues mentioned under CLOUDSTACK-6708
Signed-off-by: santhosh <santhosh.edukulla@gmail.com> Conflicts: test/integration/smoke/test_deploy_vm.py test/integration/smoke/test_network.py test/integration/smoke/test_routers.py test/integration/smoke/test_vm_life_cycle.py
This commit is contained in:
parent
00778de96e
commit
aab6e1222f
@ -42,7 +42,6 @@ class TestDeployVM(cloudstackTestCase):
|
|||||||
self.apiclient = self.testClient.getApiClient()
|
self.apiclient = self.testClient.getApiClient()
|
||||||
|
|
||||||
self.testdata = self.testClient.getParsedTestDataConfig()
|
self.testdata = self.testClient.getParsedTestDataConfig()
|
||||||
|
|
||||||
# Get Zone, Domain and Default Built-in template
|
# Get Zone, Domain and Default Built-in template
|
||||||
self.domain = get_domain(self.apiclient)
|
self.domain = get_domain(self.apiclient)
|
||||||
self.zone = get_zone(self.apiclient, self.testClient.getZoneForTests())
|
self.zone = get_zone(self.apiclient, self.testClient.getZoneForTests())
|
||||||
@ -117,7 +116,7 @@ class TestDeployVM(cloudstackTestCase):
|
|||||||
"""Test Multiple Deploy Virtual Machine
|
"""Test Multiple Deploy Virtual Machine
|
||||||
|
|
||||||
# Validate the following:
|
# Validate the following:
|
||||||
# 1. deploy 2 virtual machines
|
# 1. deploy 2 virtual machines
|
||||||
# 2. listVirtualMachines using 'ids' parameter returns accurate information
|
# 2. listVirtualMachines using 'ids' parameter returns accurate information
|
||||||
"""
|
"""
|
||||||
self.virtual_machine = VirtualMachine.create(
|
self.virtual_machine = VirtualMachine.create(
|
||||||
@ -207,6 +206,7 @@ class TestDeployVMVolumeCreationFailure(cloudstackTestCase):
|
|||||||
self.mock_volume_failure
|
self.mock_volume_failure
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@attr(tags = ['advanced'], BugId="CLOUDSTACK-6873", required_hardware="false")
|
@attr(tags = ['advanced'], BugId="CLOUDSTACK-6873", required_hardware="false")
|
||||||
def test_deploy_vm_volume_creation_failure(self):
|
def test_deploy_vm_volume_creation_failure(self):
|
||||||
"""Test Deploy Virtual Machine - volume creation failure and retry
|
"""Test Deploy Virtual Machine - volume creation failure and retry
|
||||||
|
|||||||
@ -5,9 +5,9 @@
|
|||||||
# to you under the Apache License, Version 2.0 (the
|
# to you under the Apache License, Version 2.0 (the
|
||||||
# "License"); you may not use this file except in compliance
|
# "License"); you may not use this file except in compliance
|
||||||
# with the License. You may obtain a copy of the License at
|
# with the License. You may obtain a copy of the License at
|
||||||
#
|
#
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
#
|
#
|
||||||
# Unless required by applicable law or agreed to in writing,
|
# Unless required by applicable law or agreed to in writing,
|
||||||
# software distributed under the License is distributed on an
|
# software distributed under the License is distributed on an
|
||||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
@ -23,6 +23,7 @@ from marvin.cloudstackAPI import *
|
|||||||
from marvin.lib.utils import *
|
from marvin.lib.utils import *
|
||||||
from marvin.lib.base import *
|
from marvin.lib.base import *
|
||||||
from marvin.lib.common import *
|
from marvin.lib.common import *
|
||||||
|
from marvin.lib.utils import (random_gen)
|
||||||
from nose.plugins.attrib import attr
|
from nose.plugins.attrib import attr
|
||||||
|
|
||||||
#Import System modules
|
#Import System modules
|
||||||
@ -66,21 +67,22 @@ class TestHosts(cloudstackTestCase):
|
|||||||
#Create clusters with Hypervisor type Simulator/XEN/KVM/VWare
|
#Create clusters with Hypervisor type Simulator/XEN/KVM/VWare
|
||||||
"""
|
"""
|
||||||
for k, v in self.services["clusters"].items():
|
for k, v in self.services["clusters"].items():
|
||||||
|
v["clustername"] = v["clustername"] + "-" + random_gen()
|
||||||
cluster = Cluster.create(
|
cluster = Cluster.create(
|
||||||
self.apiclient,
|
self.apiclient,
|
||||||
v,
|
v,
|
||||||
zoneid=self.zone.id,
|
zoneid=self.zone.id,
|
||||||
podid=self.pod.id,
|
podid=self.pod.id,
|
||||||
hypervisor=self.hypervisor
|
hypervisor=v["hypervisor"].lower()
|
||||||
)
|
)
|
||||||
self.debug(
|
self.debug(
|
||||||
"Created Cluster for hypervisor type %s & ID: %s" %(
|
"Created Cluster for hypervisor type %s & ID: %s" %(
|
||||||
v["hypervisor"],
|
v["hypervisor"],
|
||||||
cluster.id
|
cluster.id
|
||||||
))
|
))
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
cluster.hypervisortype,
|
cluster.hypervisortype.lower(),
|
||||||
v["hypervisor"],
|
v["hypervisor"].lower(),
|
||||||
"Check hypervisor type is " + v["hypervisor"] + " or not"
|
"Check hypervisor type is " + v["hypervisor"] + " or not"
|
||||||
)
|
)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
@ -103,7 +105,7 @@ class TestHosts(cloudstackTestCase):
|
|||||||
self.services["hosts"][hypervisor_type],
|
self.services["hosts"][hypervisor_type],
|
||||||
zoneid=self.zone.id,
|
zoneid=self.zone.id,
|
||||||
podid=self.pod.id,
|
podid=self.pod.id,
|
||||||
hypervisor=self.hypervisor
|
hypervisor=v["hypervisor"].lower()
|
||||||
)
|
)
|
||||||
if host == FAILED:
|
if host == FAILED:
|
||||||
self.fail("Host Creation Failed")
|
self.fail("Host Creation Failed")
|
||||||
@ -112,9 +114,8 @@ class TestHosts(cloudstackTestCase):
|
|||||||
host.id,
|
host.id,
|
||||||
cluster.id
|
cluster.id
|
||||||
))
|
))
|
||||||
|
#Cleanup Host & Cluster
|
||||||
#Cleanup Host & Cluster
|
self.cleanup.append(host)
|
||||||
self.cleanup.append(host)
|
|
||||||
self.cleanup.append(cluster)
|
self.cleanup.append(cluster)
|
||||||
|
|
||||||
list_hosts_response = list_hosts(
|
list_hosts_response = list_hosts(
|
||||||
@ -162,8 +163,8 @@ class TestHosts(cloudstackTestCase):
|
|||||||
"Check cluster ID with list clusters response"
|
"Check cluster ID with list clusters response"
|
||||||
)
|
)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
cluster_response.hypervisortype,
|
cluster_response.hypervisortype.lower(),
|
||||||
cluster.hypervisortype,
|
cluster.hypervisortype.lower(),
|
||||||
"Check hypervisor type with is " + v["hypervisor"] + " or not"
|
"Check hypervisor type with is " + v["hypervisor"] + " or not"
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|||||||
@ -5,9 +5,9 @@
|
|||||||
# to you under the Apache License, Version 2.0 (the
|
# to you under the Apache License, Version 2.0 (the
|
||||||
# "License"); you may not use this file except in compliance
|
# "License"); you may not use this file except in compliance
|
||||||
# with the License. You may obtain a copy of the License at
|
# with the License. You may obtain a copy of the License at
|
||||||
#
|
#
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
#
|
#
|
||||||
# Unless required by applicable law or agreed to in writing,
|
# Unless required by applicable law or agreed to in writing,
|
||||||
# software distributed under the License is distributed on an
|
# software distributed under the License is distributed on an
|
||||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
@ -160,16 +160,10 @@ class TestPublicIP(cloudstackTestCase):
|
|||||||
self.apiclient,
|
self.apiclient,
|
||||||
id=ip_address.ipaddress.id
|
id=ip_address.ipaddress.id
|
||||||
)
|
)
|
||||||
self.assertEqual(
|
if list_pub_ip_addr_resp is None:
|
||||||
isinstance(list_pub_ip_addr_resp, list),
|
return
|
||||||
True,
|
if (list_pub_ip_addr_resp) and (isinstance(list_pub_ip_addr_resp, list)) and (len(list_pub_ip_addr_resp) > 0):
|
||||||
"Check list response returns a valid list"
|
self.fail("list public ip response is not empty")
|
||||||
)
|
|
||||||
self.assertEqual(
|
|
||||||
len(list_pub_ip_addr_resp),
|
|
||||||
0,
|
|
||||||
"Check if the list public ip api response is not zero"
|
|
||||||
)
|
|
||||||
return
|
return
|
||||||
|
|
||||||
@attr(tags = ["advanced", "advancedns", "smoke"], required_hardware="false")
|
@attr(tags = ["advanced", "advancedns", "smoke"], required_hardware="false")
|
||||||
@ -328,7 +322,7 @@ class TestPortForwarding(cloudstackTestCase):
|
|||||||
'Running',
|
'Running',
|
||||||
"VM state should be Running before creating a NAT rule."
|
"VM state should be Running before creating a NAT rule."
|
||||||
)
|
)
|
||||||
# Open up firewall port for SSH
|
# Open up firewall port for SSH
|
||||||
fw_rule = FireWallRule.create(
|
fw_rule = FireWallRule.create(
|
||||||
self.apiclient,
|
self.apiclient,
|
||||||
ipaddressid=src_nat_ip_addr.id,
|
ipaddressid=src_nat_ip_addr.id,
|
||||||
@ -381,7 +375,7 @@ class TestPortForwarding(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
if vm_response[0].state != 'Running':
|
if vm_response[0].state != 'Running':
|
||||||
self.fail("State of VM : %s is not found to be Running" % str(self.virtual_machine.ipaddress))
|
self.fail("State of VM : %s is not found to be Running" % str(self.virtual_machine.ipaddress))
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.fail(
|
self.fail(
|
||||||
"SSH Access failed for %s: %s" % \
|
"SSH Access failed for %s: %s" % \
|
||||||
@ -451,7 +445,7 @@ class TestPortForwarding(cloudstackTestCase):
|
|||||||
'Running',
|
'Running',
|
||||||
"VM state should be Running before creating a NAT rule."
|
"VM state should be Running before creating a NAT rule."
|
||||||
)
|
)
|
||||||
# Open up firewall port for SSH
|
# Open up firewall port for SSH
|
||||||
fw_rule = FireWallRule.create(
|
fw_rule = FireWallRule.create(
|
||||||
self.apiclient,
|
self.apiclient,
|
||||||
ipaddressid=ip_address.ipaddress.id,
|
ipaddressid=ip_address.ipaddress.id,
|
||||||
@ -790,7 +784,6 @@ class TestReleaseIP(cloudstackTestCase):
|
|||||||
|
|
||||||
retriesCount = 10
|
retriesCount = 10
|
||||||
isIpAddressDisassociated = False
|
isIpAddressDisassociated = False
|
||||||
|
|
||||||
while retriesCount > 0:
|
while retriesCount > 0:
|
||||||
listResponse = list_publicIP(
|
listResponse = list_publicIP(
|
||||||
self.apiclient,
|
self.apiclient,
|
||||||
|
|||||||
@ -5,9 +5,9 @@
|
|||||||
# to you under the Apache License, Version 2.0 (the
|
# to you under the Apache License, Version 2.0 (the
|
||||||
# "License"); you may not use this file except in compliance
|
# "License"); you may not use this file except in compliance
|
||||||
# with the License. You may obtain a copy of the License at
|
# with the License. You may obtain a copy of the License at
|
||||||
#
|
#
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
#
|
#
|
||||||
# Unless required by applicable law or agreed to in writing,
|
# Unless required by applicable law or agreed to in writing,
|
||||||
# software distributed under the License is distributed on an
|
# software distributed under the License is distributed on an
|
||||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
@ -183,6 +183,7 @@ class TestRouterServices(cloudstackTestCase):
|
|||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@attr(tags = ["advanced", "advancedns"], required_hardware="false")
|
@attr(tags = ["advanced", "advancedns"], required_hardware="false")
|
||||||
def test_02_router_internal_adv(self):
|
def test_02_router_internal_adv(self):
|
||||||
"""Test router internal advanced zone
|
"""Test router internal advanced zone
|
||||||
@ -203,7 +204,6 @@ class TestRouterServices(cloudstackTestCase):
|
|||||||
True,
|
True,
|
||||||
"Check list response returns a valid list"
|
"Check list response returns a valid list"
|
||||||
)
|
)
|
||||||
|
|
||||||
router = list_router_response[0]
|
router = list_router_response[0]
|
||||||
|
|
||||||
hosts = list_hosts(
|
hosts = list_hosts(
|
||||||
@ -252,7 +252,6 @@ class TestRouterServices(cloudstackTestCase):
|
|||||||
self.skipTest("Marvin configuration has no host credentials to check router services")
|
self.skipTest("Marvin configuration has no host credentials to check router services")
|
||||||
res = str(result)
|
res = str(result)
|
||||||
self.debug("Dnsmasq process status: %s" % res)
|
self.debug("Dnsmasq process status: %s" % res)
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
res.count("running"),
|
res.count("running"),
|
||||||
1,
|
1,
|
||||||
@ -461,7 +460,6 @@ class TestRouterServices(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
self.skipTest("Marvin configuration has no host credentials to check router services")
|
self.skipTest("Marvin configuration has no host credentials to check router services")
|
||||||
|
|
||||||
# res = 12:37:14 up 1 min, 0 users, load average: 0.61, 0.22, 0.08
|
# res = 12:37:14 up 1 min, 0 users, load average: 0.61, 0.22, 0.08
|
||||||
# Split result to check the uptime
|
# Split result to check the uptime
|
||||||
result = res[0].split()
|
result = res[0].split()
|
||||||
@ -653,7 +651,6 @@ class TestRouterServices(cloudstackTestCase):
|
|||||||
"Check list response returns a valid list"
|
"Check list response returns a valid list"
|
||||||
)
|
)
|
||||||
router = list_router_response[0]
|
router = list_router_response[0]
|
||||||
|
|
||||||
self.debug("Stopping the router with ID: %s" % router.id)
|
self.debug("Stopping the router with ID: %s" % router.id)
|
||||||
#Stop the router
|
#Stop the router
|
||||||
cmd = stopRouter.stopRouterCmd()
|
cmd = stopRouter.stopRouterCmd()
|
||||||
@ -723,6 +720,13 @@ class TestRouterServices(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
def verifyRouterResponse(self,router_response,ip):
|
||||||
|
if (router_response) and (isinstance(router_response, list)) and \
|
||||||
|
(router_response[0].state == "Running") and \
|
||||||
|
(router_response[0].publicip == ip):
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
@attr(tags = ["advanced", "advancedns", "smoke"], required_hardware="false")
|
@attr(tags = ["advanced", "advancedns", "smoke"], required_hardware="false")
|
||||||
def test_09_reboot_router(self):
|
def test_09_reboot_router(self):
|
||||||
"""Test reboot router
|
"""Test reboot router
|
||||||
@ -746,32 +750,22 @@ class TestRouterServices(cloudstackTestCase):
|
|||||||
public_ip = router.publicip
|
public_ip = router.publicip
|
||||||
|
|
||||||
self.debug("Rebooting the router with ID: %s" % router.id)
|
self.debug("Rebooting the router with ID: %s" % router.id)
|
||||||
|
|
||||||
#Reboot the router
|
#Reboot the router
|
||||||
cmd = rebootRouter.rebootRouterCmd()
|
cmd = rebootRouter.rebootRouterCmd()
|
||||||
cmd.id = router.id
|
cmd.id = router.id
|
||||||
self.apiclient.rebootRouter(cmd)
|
self.apiclient.rebootRouter(cmd)
|
||||||
|
|
||||||
#List routers to check state of router
|
#List routers to check state of router
|
||||||
router_response = list_routers(
|
retries_cnt = 6
|
||||||
|
while retries_cnt >= 0:
|
||||||
|
router_response = list_routers(
|
||||||
self.apiclient,
|
self.apiclient,
|
||||||
id=router.id
|
id=router.id
|
||||||
)
|
)
|
||||||
self.assertEqual(
|
if self.verifyRouterResponse(router_response,public_ip):
|
||||||
isinstance(router_response, list),
|
self.debug("Router is running successfully after reboot")
|
||||||
True,
|
return
|
||||||
"Check list response returns a valid list"
|
time.sleep(10)
|
||||||
)
|
retries_cnt = retries_cnt - 1
|
||||||
#List router should have router in running state and same public IP
|
self.fail("Router response after reboot is either is invalid or in stopped state")
|
||||||
self.assertEqual(
|
|
||||||
router_response[0].state,
|
|
||||||
'Running',
|
|
||||||
"Check list router response for router state"
|
|
||||||
)
|
|
||||||
|
|
||||||
self.assertEqual(
|
|
||||||
router_response[0].publicip,
|
|
||||||
public_ip,
|
|
||||||
"Check list router response for router public IP"
|
|
||||||
)
|
|
||||||
return
|
return
|
||||||
|
|||||||
@ -498,14 +498,14 @@ class TestVMLifeCycle(cloudstackTestCase):
|
|||||||
# For XenServer and VMware, migration is possible between hosts belonging to different clusters
|
# For XenServer and VMware, migration is possible between hosts belonging to different clusters
|
||||||
# with the help of XenMotion and Vmotion respectively.
|
# with the help of XenMotion and Vmotion respectively.
|
||||||
|
|
||||||
if hypervisor == "kvm":
|
if hypervisor.lower() in ["kvm","simulator"]:
|
||||||
#identify suitable host
|
#identify suitable host
|
||||||
clusters = [h.clusterid for h in hosts]
|
clusters = [h.clusterid for h in hosts]
|
||||||
#find hosts withe same clusterid
|
#find hosts withe same clusterid
|
||||||
clusters = [cluster for index, cluster in enumerate(clusters) if clusters.count(cluster) > 1]
|
clusters = [cluster for index, cluster in enumerate(clusters) if clusters.count(cluster) > 1]
|
||||||
|
|
||||||
if len(clusters) <= 1:
|
if len(clusters) <= 1:
|
||||||
self.skipTest("In KVM, Live Migration needs two hosts within same cluster")
|
self.skipTest("In " + hypervisor.lower() + " Live Migration needs two hosts within same cluster")
|
||||||
|
|
||||||
suitable_hosts = [host for host in hosts if host.clusterid == clusters[0]]
|
suitable_hosts = [host for host in hosts if host.clusterid == clusters[0]]
|
||||||
else:
|
else:
|
||||||
@ -548,7 +548,7 @@ class TestVMLifeCycle(cloudstackTestCase):
|
|||||||
|
|
||||||
@attr(configuration = "expunge.interval")
|
@attr(configuration = "expunge.interval")
|
||||||
@attr(configuration = "expunge.delay")
|
@attr(configuration = "expunge.delay")
|
||||||
@attr(tags = ["devcloud", "advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="false")
|
@attr(tags = ["devcloud", "advanced", "advancedns", "smoke", "basic", "sg"],BugId="CLOUDSTACK-6708", required_hardware="false")
|
||||||
def test_09_expunge_vm(self):
|
def test_09_expunge_vm(self):
|
||||||
"""Test destroy(expunge) Virtual Machine
|
"""Test destroy(expunge) Virtual Machine
|
||||||
"""
|
"""
|
||||||
@ -576,7 +576,7 @@ class TestVMLifeCycle(cloudstackTestCase):
|
|||||||
name='expunge.interval'
|
name='expunge.interval'
|
||||||
)
|
)
|
||||||
expunge_cycle = int(config[0].value)
|
expunge_cycle = int(config[0].value)
|
||||||
wait_time = expunge_cycle * 2
|
wait_time = expunge_cycle * 4
|
||||||
while wait_time >= 0:
|
while wait_time >= 0:
|
||||||
list_vm_response = VirtualMachine.list(
|
list_vm_response = VirtualMachine.list(
|
||||||
self.apiclient,
|
self.apiclient,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user