diff options
author | Christian Poessinger <christian@poessinger.com> | 2021-01-26 20:07:21 +0100 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2021-01-26 20:49:55 +0100 |
commit | b48890396dcff074d1e9336ca1db9d3eafe2a12f (patch) | |
tree | 323856c78e25d9d4676a52ed9d19072a03845d1a /smoketest/scripts/cli/test_interfaces_bonding.py | |
parent | cec848e4a668ed51868d5fa50504a2f8bb1b4eb7 (diff) | |
download | vyos-1x-b48890396dcff074d1e9336ca1db9d3eafe2a12f.tar.gz vyos-1x-b48890396dcff074d1e9336ca1db9d3eafe2a12f.zip |
smoketest: refactor setUp() for all interface based testcases
It does not make sense (at all!) to re-initialize the entire class with every
call to setUp(). We neither change the enabled/disabled tastcases dynamically,
not do we adjust the testinterfaces during a run.
Remove the runtime overhead and place one-time init calls into setUpClass()
instead.
Diffstat (limited to 'smoketest/scripts/cli/test_interfaces_bonding.py')
-rwxr-xr-x | smoketest/scripts/cli/test_interfaces_bonding.py | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/smoketest/scripts/cli/test_interfaces_bonding.py b/smoketest/scripts/cli/test_interfaces_bonding.py index 882d38760..b65d97d30 100755 --- a/smoketest/scripts/cli/test_interfaces_bonding.py +++ b/smoketest/scripts/cli/test_interfaces_bonding.py @@ -25,34 +25,32 @@ from vyos.configsession import ConfigSessionError from vyos.util import read_file class BondingInterfaceTest(BasicInterfaceTest.BaseTest): - def setUp(self): - self._test_ip = True - self._test_ipv6 = True - self._test_ipv6_pd = True - self._test_ipv6_dhcpc6 = True - self._test_mtu = True - self._test_vlan = True - self._test_qinq = True - self._base_path = ['interfaces', 'bonding'] - self._interfaces = ['bond0'] - self._mirror_interfaces = ['dum21354'] - self._members = [] + @classmethod + def setUpClass(cls): + cls._test_ip = True + cls._test_ipv6 = True + cls._test_ipv6_pd = True + cls._test_ipv6_dhcpc6 = True + cls._test_mtu = True + cls._test_vlan = True + cls._test_qinq = True + cls._base_path = ['interfaces', 'bonding'] + cls._interfaces = ['bond0'] + cls._mirror_interfaces = ['dum21354'] + cls._members = [] # we need to filter out VLAN interfaces identified by a dot (.) # in their name - just in case! if 'TEST_ETH' in os.environ: - self._members = os.environ['TEST_ETH'].split() + cls._members = os.environ['TEST_ETH'].split() else: - for tmp in Section.interfaces("ethernet"): + for tmp in Section.interfaces('ethernet'): if not '.' in tmp: - self._members.append(tmp) - - self._options['bond0'] = [] - for member in self._members: - self._options['bond0'].append(f'member interface {member}') - - super().setUp() + cls._members.append(tmp) + cls._options['bond0'] = [] + for member in cls._members: + cls._options['bond0'].append(f'member interface {member}') def test_add_single_ip_address(self): super().test_add_single_ip_address() |