Repository: cloudstack Updated Branches: refs/heads/4.9 bef2236d3 -> 5d7288b85
CLOUDSTACK-9634: fix marvin test failure test_router_dhcp_opts marvin, VirtualMachine object, nic attribute does not have nic's in any particualr order in the array. soi check isdefault attribute to the get non-default nic earlier test made assumption that nic[0] is default nic, which is not true always Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/a07e7ac0 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/a07e7ac0 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/a07e7ac0 Branch: refs/heads/4.9 Commit: a07e7ac0991921ce4e4899ed33dcde49be530ffd Parents: 5811d33 Author: Murali Reddy <[email protected]> Authored: Wed Nov 30 16:24:02 2016 +0530 Committer: Murali Reddy <[email protected]> Committed: Wed Nov 30 17:32:03 2016 +0530 ---------------------------------------------------------------------- test/integration/smoke/test_router_dhcphosts.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a07e7ac0/test/integration/smoke/test_router_dhcphosts.py ---------------------------------------------------------------------- diff --git a/test/integration/smoke/test_router_dhcphosts.py b/test/integration/smoke/test_router_dhcphosts.py index 3a59998..668475e 100644 --- a/test/integration/smoke/test_router_dhcphosts.py +++ b/test/integration/smoke/test_router_dhcphosts.py @@ -749,8 +749,19 @@ class TestRouterDHCPOpts(cloudstackTestCase): "Check list port forwarding rules" ) - self.logger.debug("Testing DHCP options for VMs %s and %s" % (self.vm_1.id, self.vm_2.id)) - self.test_dhcphopts(self.vm_2.nic[1].ipaddress, network1_router) - self.test_dhcphopts(self.vm_1.nic[0].ipaddress, network2_router) + vm1_non_default_nic_ip = self.get_vm_non_default_nic_ip(self.vm_1) + vm2_non_default_nic_ip = self.get_vm_non_default_nic_ip(self.vm_2) + + self.logger.debug("Testing DHCP options for VM's %s IP address %s in virtual router %s" % (self.vm_2.id, vm2_non_default_nic_ip, str(network1_router) )) + self.test_dhcphopts(vm2_non_default_nic_ip, network1_router) + + self.logger.debug("Testing DHCP options for VM's %s IP address %s in virtual router %s" % (self.vm_1.id, vm1_non_default_nic_ip, str(network2_router) )) + self.test_dhcphopts(vm1_non_default_nic_ip, network2_router) return + + def get_vm_non_default_nic_ip(self, vm): + if vm.nic[0].isdefault: + return vm.nic[1].ipaddress + else: + return vm.nic[0].ipaddress
