From 2d95529bb627a3d3ecdb64d07f3ba97c28473be6 Mon Sep 17 00:00:00 2001 From: asarfaty Date: Wed, 8 Jan 2020 09:23:23 +0200 Subject: [PATCH] Fix broken unit tests Commit I0a1c128858c1d639e80763cac0df358949c56cfb broke ipv6 unit tests, becasue it prevents setting a new port as compute Change-Id: Id5d27a0971bd2f8be072261ee23933043f77518f --- vmware_nsx/tests/unit/nsx_v/test_plugin.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/vmware_nsx/tests/unit/nsx_v/test_plugin.py b/vmware_nsx/tests/unit/nsx_v/test_plugin.py index 24ac1c4fbb..2c555e5aeb 100644 --- a/vmware_nsx/tests/unit/nsx_v/test_plugin.py +++ b/vmware_nsx/tests/unit/nsx_v/test_plugin.py @@ -1270,7 +1270,9 @@ class TestPortsV2(NsxVPluginV2TestCase, data['port']['fixed_ips']) def _update_port_index(self, port_id, device_id, index): - data = {'port': {'device_id': device_id, 'vnic_index': index}} + data = {'port': {'device_owner': 'compute:None', + 'device_id': device_id, + 'vnic_index': index}} req = self.new_update_request('ports', data, port_id) res = self.deserialize('json', req.get_response(self.api)) @@ -1291,9 +1293,11 @@ class TestPortsV2(NsxVPluginV2TestCase, with self.port(subnet=subnet, device_id=device_id, mac_address=port_mac, - fixed_ips=fixed_ip_data, - device_owner='compute:None') as port: - self.assertIsNone(port['port']['vnic_index']) + fixed_ips=fixed_ip_data) as port: + # set port as compute first + res = self._update_port_index( + port['port']['id'], device_id, None) + self.assertIsNone(res['port']['vnic_index']) self.fc2.approve_assigned_addresses = ( mock.Mock().approve_assigned_addresses)