[Kimchi-devel] [PATCH] [Kimchi] test_mock_network.py: fixes due to backend changes

Daniel Henrique Barboza danielhb at linux.vnet.ibm.com
Fri Feb 12 16:23:16 UTC 2016



On 02/12/2016 02:17 PM, Lucio Correia wrote:
> On 12-02-2016 13:53, dhbarboza82 at gmail.com wrote:
>> From: Daniel Henrique Barboza <dhbarboza82 at gmail.com>
>>
>> This patch makes the following improvements in test_vlag_tag_bridge:
>>
>> - fixed connection type. Recent backend changes do not allow
>> for connection='macvtap' and 'vlan_id' to be sent together.
>>
>> - added Network Manager check. The test can fail randomly if
>> Network Manager is active.
>>
>> - fixed copyright format.
>>
>> Signed-off-by: Daniel Henrique Barboza <dhbarboza82 at gmail.com>
>> ---
>>   tests/test_mock_network.py | 15 +++++++++++++--
>>   1 file changed, 13 insertions(+), 2 deletions(-)
>>
>> diff --git a/tests/test_mock_network.py b/tests/test_mock_network.py
>> index 4b0a284..d9810f3 100644
>> --- a/tests/test_mock_network.py
>> +++ b/tests/test_mock_network.py
>> @@ -2,7 +2,7 @@
>>   #
>>   # Project Kimchi
>>   #
>> -# Copyright IBM, Corp. 2015
>> +# Copyright IBM Corp, 2015-2016
>>   #
>>   # This library is free software; you can redistribute it and/or
>>   # modify it under the terms of the GNU Lesser General Public
>> @@ -26,6 +26,7 @@ from functools import partial
>>   from tests.utils import get_free_port, patch_auth, request, run_server
>>
>>   from wok.plugins.kimchi.mockmodel import MockModel
>> +from wok.utils import run_command
>>
>>   from test_model_network import _do_network_test
>>
>> @@ -56,11 +57,21 @@ def tearDownModule():
>>       os.unlink('/tmp/obj-store-test')
>>
>>
>> +def is_network_manager_running():
>> +    out, err, rc = run_command(['nmcli', 'dev', 'status'])
>> +    if rc != 0:
>> +        return False
>> +    return True
>> +
>> +
>>   class MockNetworkTests(unittest.TestCase):
>>       def setUp(self):
>>           self.request = partial(request, host, ssl_port)
>>           model.reset()
>>
>> +    @unittest.skipIf(is_network_manager_running(),
>> +                     'test_vlan_tag_bridge skipped because Network '
>> +                     'Manager is running.')
>>       def test_vlan_tag_bridge(self):
>>           # Verify the current system has at least one interface to 
>> create a
>>           # bridged network
>> @@ -70,5 +81,5 @@ class MockNetworkTests(unittest.TestCase):
>>           if len(interfaces) > 0:
>>               iface = interfaces[0]['name']
>>               _do_network_test(self, model, {'name': u'macvtap-network',
> It would be nice to change 'name' as well to something like 
> 'vlan-tagged-bridge'

I'll change it in v2. Nice catch.
>
>> - 'connection': 'macvtap',
>> +                                           'connection': 'bridge',
>>                                              'interface': iface, 
>> 'vlan_id': 987})
>>
>
>




More information about the Kimchi-devel mailing list