Fix random test_unplug_ovs failures
https://review.openstack.org/#/c/476612/ introduced an abstract OVSDB API, but it seems the gate is randomly calling linux_net utils in the context of Windows plug and unplug. This was because one of the tests set sys.platform to Windows, resulting in random failures, depending on the order in which the tests ran. Change-Id: I7e2a548fa4edc743d913f71dde48f613a7a5a8df Partial-Bug: #1798051 Signed-off-by: Jan Gutter <jan.gutter@netronome.com>
This commit is contained in:
parent
8606af13c7
commit
330051a702
@ -19,4 +19,5 @@ OVS_VHOSTUSER_PREFIX = 'vhu'
|
||||
OVS_DATAPATH_SYSTEM = 'system'
|
||||
OVS_DATAPATH_NETDEV = 'netdev'
|
||||
|
||||
PLATFORM_LINUX = 'linux2'
|
||||
PLATFORM_WIN32 = 'win32'
|
||||
|
@ -11,7 +11,6 @@
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
import sys
|
||||
import testtools
|
||||
|
||||
from oslo_config import cfg
|
||||
@ -52,17 +51,17 @@ class BaseOVSTest(testtools.TestCase):
|
||||
calls = [mock.call('Interface', 'device', ('mtu_request', 1500))]
|
||||
self.mock_db_set.assert_has_calls(calls)
|
||||
|
||||
@mock.patch.object(sys, 'platform', return_value='linux')
|
||||
@mock.patch('sys.platform', constants.PLATFORM_LINUX)
|
||||
@mock.patch.object(linux_net, 'set_device_mtu')
|
||||
def test__update_device_mtu_interface_not_vhostuser_linux(self,
|
||||
mock_set_device_mtu, mock_platform):
|
||||
mock_set_device_mtu):
|
||||
self.br.update_device_mtu('device', 1500, 'not_vhost')
|
||||
mock_set_device_mtu.assert_has_calls([mock.call('device', 1500)])
|
||||
|
||||
@mock.patch('sys.platform', constants.PLATFORM_WIN32)
|
||||
@mock.patch.object(linux_net, 'set_device_mtu')
|
||||
def test__update_device_mtu_interface_not_vhostuser_windows(self,
|
||||
mock_set_device_mtu):
|
||||
sys.platform = constants.PLATFORM_WIN32
|
||||
self.br.update_device_mtu('device', 1500, 'not_vhost')
|
||||
mock_set_device_mtu.assert_not_called()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user