Browse Source

Merge "Fix sort issue in test_dhcp_agent_scheduler.test_filter_bindings" into stable/queens

changes/56/677056/1
Zuul 1 month ago
parent
commit
cf60191de6
1 changed files with 5 additions and 3 deletions
  1. 5
    3
      neutron/tests/unit/scheduler/test_dhcp_agent_scheduler.py

+ 5
- 3
neutron/tests/unit/scheduler/test_dhcp_agent_scheduler.py View File

@@ -14,6 +14,7 @@
14 14
 # limitations under the License.
15 15
 
16 16
 import datetime
17
+from operator import attrgetter
17 18
 import random
18 19
 
19 20
 import mock
@@ -500,7 +501,7 @@ class TestNetworksFailover(TestDhcpSchedulerBaseTestCase,
500 501
     def test_filter_bindings(self):
501 502
         self.ctx = context.get_admin_context()
502 503
         dhcp_agt_ids = self._create_dhcp_agents()
503
-        network_ids = self._create_test_networks(num_net=4)
504
+        network_ids = sorted(self._create_test_networks(num_net=4))
504 505
         ndab_obj1 = network_obj.NetworkDhcpAgentBinding(self.ctx,
505 506
             network_id=network_ids[0], dhcp_agent_id=dhcp_agt_ids[0])
506 507
         ndab_obj1.create()
@@ -513,8 +514,9 @@ class TestNetworksFailover(TestDhcpSchedulerBaseTestCase,
513 514
         ndab_obj4 = network_obj.NetworkDhcpAgentBinding(self.ctx,
514 515
             network_id=network_ids[3], dhcp_agent_id=dhcp_agt_ids[1])
515 516
         ndab_obj4.create()
516
-        bindings_objs = network_obj.NetworkDhcpAgentBinding.get_objects(
517
-            self.ctx)
517
+        bindings_objs = sorted(network_obj.NetworkDhcpAgentBinding.get_objects(
518
+            self.ctx), key=attrgetter('network_id'))
519
+
518 520
         with mock.patch.object(self, 'agent_starting_up',
519 521
                                side_effect=[True, False]):
520 522
             res = [b for b in self._filter_bindings(None, bindings_objs)]

Loading…
Cancel
Save