Wrap the test in a try/finally to ensure that the keys get cleaned up.

We're seeing the keys appear later on in some tests, such as here:

integration.modules.saltutil.SaltUtilModuleTest.test_wheel_just_function
This commit is contained in:
Mike Place 2016-08-21 20:22:26 +09:00
parent 93182fabdc
commit ea8fb37b48

View File

@ -200,13 +200,14 @@ class CallTest(integration.ShellCase, testprogram.TestProgramCase, integration.S
'log_level_logfile': 'info',
'transport': self.master_opts['transport'],
}
try:
# Remove existing logfile
if os.path.isfile(logfile):
os.unlink(logfile)
start = datetime.now()
# Let's first test with a master running
with salt.utils.fopen(minion_config_file, 'w') as fh_:
fh_.write(
yaml.dump(minion_config, default_flow_style=False)
@ -296,7 +297,6 @@ class CallTest(integration.ShellCase, testprogram.TestProgramCase, integration.S
),
timeout=15
)
try:
self.assertIn('local:', ret)
finally:
if os.path.isfile(minion_config_file):
@ -305,6 +305,7 @@ class CallTest(integration.ShellCase, testprogram.TestProgramCase, integration.S
if os.path.isfile(this_minion_key):
os.unlink(this_minion_key)
def test_issue_7754(self):
old_cwd = os.getcwd()
config_dir = os.path.join(integration.TMP, 'issue-7754')