From b024fb250d28350a87d356d441c12f083c3cefef Mon Sep 17 00:00:00 2001 From: Adit Sarfaty Date: Sun, 11 Nov 2018 08:46:03 +0200 Subject: [PATCH] NSX|V: Fix broken unittests Commit Ia769dadf69781ba511a19c52998949b668963a19 changed a unittests which was originally overriden by the plugin unitests to use dhcp disabled subnet. This patch makes the same change in the local unit test Change-Id: I0794c2fe2bdb2ec1215cc11652f15da62f8daf9d --- vmware_nsx/tests/unit/nsx_v/test_plugin.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/vmware_nsx/tests/unit/nsx_v/test_plugin.py b/vmware_nsx/tests/unit/nsx_v/test_plugin.py index faa9212513..3ab61d1c9a 100644 --- a/vmware_nsx/tests/unit/nsx_v/test_plugin.py +++ b/vmware_nsx/tests/unit/nsx_v/test_plugin.py @@ -15,6 +15,7 @@ import contextlib import copy +import itertools from eventlet import greenthread import mock @@ -1074,8 +1075,8 @@ class TestPortsV2(NsxVPluginV2TestCase, # simulate duplicate mac generation to make sure DBDuplicate is retried responses = ['12:34:56:78:00:00', '12:34:56:78:00:00', '12:34:56:78:00:01'] - with mock.patch.object(net, 'get_random_mac', - side_effect=responses) as grand_mac: + with mock.patch.object(net, 'random_mac_generator', + return_value=itertools.cycle(responses)) as grand_mac: with self.subnet(enable_dhcp=False) as s: with self.port(subnet=s) as p1, self.port(subnet=s) as p2: self.assertEqual('12:34:56:78:00:00',