]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Fix broken port query in Extraroute test case
authorKevin Benton <blak111@gmail.com>
Sat, 20 Sep 2014 07:17:58 +0000 (00:17 -0700)
committerKevin Benton <blak111@gmail.com>
Fri, 26 Sep 2014 23:10:43 +0000 (16:10 -0700)
One of the queries in an extra route test case tries
to filter based on the port owner, but the _list_ports
method it calls doesn't take a device_owner parameter.
This can cause failures if a DHCP port is created on
the same subnet.

Change-Id: I0e62027ae4d98944ef91a5d457d43d4224441b2f

neutron/tests/unit/test_db_plugin.py
neutron/tests/unit/test_extension_extraroute.py

index 7754cc2b12d6a4a03f75d80a4b44df0c791f5202..f6b8204886b24dfdc8906450a59b559accf6c1ab 100644 (file)
@@ -368,10 +368,12 @@ class NeutronDbPluginV2TestCase(testlib_api.WebTestCase,
 
     def _list_ports(self, fmt, expected_res_status=None,
                     net_id=None, **kwargs):
-        query_params = None
+        query_params = []
         if net_id:
-            query_params = "network_id=%s" % net_id
-        port_req = self.new_list_request('ports', fmt, query_params)
+            query_params.append("network_id=%s" % net_id)
+        if kwargs.get('device_owner'):
+            query_params.append("device_owner=%s" % kwargs.get('device_owner'))
+        port_req = self.new_list_request('ports', fmt, '&'.join(query_params))
         if ('set_context' in kwargs and
                 kwargs['set_context'] is True and
                 'tenant_id' in kwargs):
index f2fa6e33944ad4636daf9b9012abd4ed692c957c..dad220370f8072ec6cfded0b5501e85f9d7560bb 100644 (file)
@@ -403,7 +403,7 @@ class ExtraRouteDBTestCaseBase(object):
                     200,
                     s['subnet']['network_id'],
                     tenant_id=r['router']['tenant_id'],
-                    device_own=constants.DEVICE_OWNER_ROUTER_GW)
+                    device_owner=constants.DEVICE_OWNER_ROUTER_GW)
                 port_list = self.deserialize('json', port_res)
                 self.assertEqual(len(port_list['ports']), 1)