summaryrefslogtreecommitdiff
path: root/test/test-network
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2022-01-28 06:59:43 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2022-01-28 06:59:52 +0900
commitb67f3d73b075346c6e06533111ec8f6b6ac617d7 (patch)
treeb7c574a691b0bd755a8736b60dd8f9045b6373b9 /test/test-network
parente6d31fc97af92ef59741b3948c984a7d1b2b70f3 (diff)
downloadsystemd-b67f3d73b075346c6e06533111ec8f6b6ac617d7.tar.gz
test-network: always cleanup the testing environment
Previously, if a subtest fail, then the cleanup process does not run, and affects the subsequent tests.
Diffstat (limited to 'test/test-network')
-rwxr-xr-xtest/test-network/systemd-networkd-tests.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py
index 0233c4dd1f..e7a84c7a98 100755
--- a/test/test-network/systemd-networkd-tests.py
+++ b/test/test-network/systemd-networkd-tests.py
@@ -3053,7 +3053,6 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
self.wait_operstate('test1', 'routable')
def _test_activation_policy(self, test):
- self.setUp()
conffile = '25-activation-policy.network'
if test:
conffile = f'{conffile}.d/{test}.conf'
@@ -3088,15 +3087,14 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
expect_up = initial_up if always else next_up
next_up = not next_up
- self.tearDown()
-
def test_activation_policy(self):
for test in ['up', 'always-up', 'manual', 'always-down', 'down', '']:
with self.subTest(test=test):
+ self.setUp()
self._test_activation_policy(test)
+ self.tearDown()
def _test_activation_policy_required_for_online(self, policy, required):
- self.setUp()
conffile = '25-activation-policy.network'
units = ['11-dummy.netdev', '12-dummy.netdev', '12-dummy.network', conffile]
if policy:
@@ -3131,13 +3129,13 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
yesno = 'yes' if expected else 'no'
self.assertRegex(output, f'Required For Online: {yesno}')
- self.tearDown()
-
def test_activation_policy_required_for_online(self):
for policy in ['up', 'always-up', 'manual', 'always-down', 'down', 'bound', '']:
for required in ['yes', 'no', '']:
with self.subTest(policy=policy, required=required):
+ self.setUp()
self._test_activation_policy_required_for_online(policy, required)
+ self.tearDown()
def test_domain(self):
copy_unit_to_networkd_unit_path('12-dummy.netdev', '24-search-domain.network')