aboutsummaryrefslogtreecommitdiffstats
path: root/os_net_config/tests
diff options
context:
space:
mode:
authorDan Prince <dprince@redhat.com>2014-08-15 09:53:58 -0400
committerDan Prince <dprince@redhat.com>2014-08-15 09:53:58 -0400
commit2d3af95651223ca142e99c9c2bbe284481e3f33d (patch)
tree61cadb5f6c8263d7c4a09ad120947bde76a0be4a /os_net_config/tests
parent79c82ffcf8aee74a607ea269ef6baa67c85369d6 (diff)
ifcfg: Exclude ifcfg-lo from cleanup
This interface should always exist... we don't want to clean it up.
Diffstat (limited to 'os_net_config/tests')
-rw-r--r--os_net_config/tests/test_impl_ifcfg.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/os_net_config/tests/test_impl_ifcfg.py b/os_net_config/tests/test_impl_ifcfg.py
index a5c621c..9038987 100644
--- a/os_net_config/tests/test_impl_ifcfg.py
+++ b/os_net_config/tests/test_impl_ifcfg.py
@@ -221,7 +221,7 @@ class TestIfcfgNetConfigApply(base.TestCase):
self.temp_ifcfg_file = tempfile.NamedTemporaryFile()
self.temp_route_file = tempfile.NamedTemporaryFile()
self.temp_bridge_file = tempfile.NamedTemporaryFile()
- self.temp_cleanup_file = tempfile.NamedTemporaryFile()
+ self.temp_cleanup_file = tempfile.NamedTemporaryFile(delete=False)
def test_ifcfg_path(name):
return self.temp_ifcfg_file.name
@@ -294,3 +294,15 @@ class TestIfcfgNetConfigApply(base.TestCase):
def test_cleanup(self):
self.provider.apply(cleanup=True)
self.assertTrue(not os.path.exists(self.temp_cleanup_file.name))
+
+ def test_cleanup_not_loopback(self):
+ tmp_lo_file = '%s-lo' % self.temp_cleanup_file.name
+ utils.write_config(tmp_lo_file, 'foo')
+
+ def test_cleanup_pattern():
+ return '%s-*' % self.temp_cleanup_file.name
+ self.stubs.Set(impl_ifcfg, 'cleanup_pattern', test_cleanup_pattern)
+
+ self.provider.apply(cleanup=True)
+ self.assertTrue(os.path.exists(tmp_lo_file))
+ os.remove(tmp_lo_file)