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

Lucio Correia luciojhc at linux.vnet.ibm.com
Fri Feb 12 16:59:09 UTC 2016


Reviewed-By: Lucio Correia <luciojhc at linux.vnet.ibm.com>

On 12-02-2016 14:26, 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 | 17 ++++++++++++++---
>   1 file changed, 14 insertions(+), 3 deletions(-)
>
> diff --git a/tests/test_mock_network.py b/tests/test_mock_network.py
> index 4b0a284..3a9b7b5 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
> @@ -69,6 +80,6 @@ class MockNetworkTests(unittest.TestCase):
>           )
>           if len(interfaces) > 0:
>               iface = interfaces[0]['name']
> -            _do_network_test(self, model, {'name': u'macvtap-network',
> -                                           'connection': 'macvtap',
> +            _do_network_test(self, model, {'name': u'vlan-tagged-bridge',
> +                                           'connection': 'bridge',
>                                              'interface': iface, 'vlan_id': 987})
>


-- 
Lucio Correia
Software Engineer
IBM LTC Brazil




More information about the Kimchi-devel mailing list