summaryrefslogtreecommitdiff
path: root/smoketest/scripts/cli
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2022-04-14 21:29:06 +0200
committerChristian Poessinger <christian@poessinger.com>2022-04-14 21:29:44 +0200
commitd40e86aeb4e91fa9f8191b3c49830d9ba227c92c (patch)
tree166f3851fee1c0cf03c0758b49c8647fa00f4ccb /smoketest/scripts/cli
parentdf045eca2f6c7a9257de5d32723d9ccc799346e5 (diff)
downloadvyos-1x-d40e86aeb4e91fa9f8191b3c49830d9ba227c92c.tar.gz
vyos-1x-d40e86aeb4e91fa9f8191b3c49830d9ba227c92c.zip
smoketest: firewall: ensure we can also run this test on a live system
... by cleaning existing CLI config first
Diffstat (limited to 'smoketest/scripts/cli')
-rwxr-xr-xsmoketest/scripts/cli/test_firewall.py22
1 files changed, 17 insertions, 5 deletions
diff --git a/smoketest/scripts/cli/test_firewall.py b/smoketest/scripts/cli/test_firewall.py
index 16b020e07..5448295fa 100755
--- a/smoketest/scripts/cli/test_firewall.py
+++ b/smoketest/scripts/cli/test_firewall.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
-# Copyright (C) 2021 VyOS maintainers and contributors
+# Copyright (C) 2021-2022 VyOS maintainers and contributors
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 or later as
@@ -36,12 +36,24 @@ sysfs_config = {
}
class TestFirewall(VyOSUnitTestSHIM.TestCase):
- def setUp(self):
- self.cli_set(['interfaces', 'ethernet', 'eth0', 'address', '172.16.10.1/24'])
+ @classmethod
+ def setUpClass(cls):
+ super(cls, cls).setUpClass()
+
+ # ensure we can also run this test on a live system - so lets clean
+ # out the current configuration :)
+ cls.cli_delete(cls, ['firewall'])
+
+ cls.cli_set(cls, ['interfaces', 'ethernet', 'eth0', 'address', '172.16.10.1/24'])
+
+ @classmethod
+ def tearDownClass(cls):
+ cls.cli_delete(cls, ['interfaces', 'ethernet', 'eth0', 'address', '172.16.10.1/24'])
+
+ super(cls, cls).tearDownClass()
def tearDown(self):
- self.cli_delete(['interfaces', 'ethernet', 'eth0'])
- self.cli_commit()
+ self.cli_delete(['interfaces', 'ethernet', 'eth0', 'firewall'])
self.cli_delete(['firewall'])
self.cli_commit()