mirror of
https://github.com/valitydev/salt.git
synced 2024-11-06 16:45:27 +00:00
Remove crufty un-needed tests
This commit is contained in:
parent
effa77de7f
commit
757382638d
@ -150,43 +150,6 @@ class CallTest(ShellCase, testprogram.TestProgramCase, ShellCaseCommonTestsMixin
|
|||||||
]
|
]
|
||||||
self.assertTrue(True in ['returnTOmaster' in a for a in master_out])
|
self.assertTrue(True in ['returnTOmaster' in a for a in master_out])
|
||||||
|
|
||||||
@skipIf(salt.utils.platform.is_windows(), 'Skip on Windows')
|
|
||||||
def test_issue_7754(self):
|
|
||||||
old_cwd = os.getcwd()
|
|
||||||
config_dir = os.path.join(TMP, 'issue-7754')
|
|
||||||
if not os.path.isdir(config_dir):
|
|
||||||
os.makedirs(config_dir)
|
|
||||||
|
|
||||||
os.chdir(config_dir)
|
|
||||||
|
|
||||||
with salt.utils.files.fopen(self.get_config_file_path('minion'), 'r') as fh_:
|
|
||||||
minion_config = salt.utils.yaml.safe_load(fh_)
|
|
||||||
minion_config['log_file'] = 'file:///dev/log/LOG_LOCAL3'
|
|
||||||
with salt.utils.files.fopen(os.path.join(config_dir, 'minion'), 'w') as fh_:
|
|
||||||
salt.utils.yaml.safe_dump(minion_config, fh_, default_flow_style=False)
|
|
||||||
ret = self.run_script(
|
|
||||||
'salt-call',
|
|
||||||
'--config-dir {0} cmd.run "echo foo"'.format(
|
|
||||||
config_dir
|
|
||||||
),
|
|
||||||
timeout=60,
|
|
||||||
catch_stderr=True,
|
|
||||||
with_retcode=True
|
|
||||||
)
|
|
||||||
try:
|
|
||||||
self.assertIn('local:', ret[0])
|
|
||||||
self.assertFalse(os.path.isdir(os.path.join(config_dir, 'file:')))
|
|
||||||
except AssertionError:
|
|
||||||
# We now fail when we're unable to properly set the syslog logger
|
|
||||||
self.assertIn(
|
|
||||||
'Failed to setup the Syslog logging handler', '\n'.join(ret[1])
|
|
||||||
)
|
|
||||||
self.assertEqual(ret[2], 2)
|
|
||||||
finally:
|
|
||||||
self.chdir(old_cwd)
|
|
||||||
if os.path.isdir(config_dir):
|
|
||||||
shutil.rmtree(config_dir)
|
|
||||||
|
|
||||||
@skipIf(salt.utils.platform.is_windows(), 'Skip on Windows')
|
@skipIf(salt.utils.platform.is_windows(), 'Skip on Windows')
|
||||||
def test_syslog_file_not_found(self):
|
def test_syslog_file_not_found(self):
|
||||||
'''
|
'''
|
||||||
|
@ -36,8 +36,6 @@ log = logging.getLogger(__name__)
|
|||||||
|
|
||||||
class CopyTest(ShellCase, ShellCaseCommonTestsMixin):
|
class CopyTest(ShellCase, ShellCaseCommonTestsMixin):
|
||||||
|
|
||||||
_call_binary_ = 'salt-cp'
|
|
||||||
|
|
||||||
def test_cp_testfile(self):
|
def test_cp_testfile(self):
|
||||||
'''
|
'''
|
||||||
test salt-cp
|
test salt-cp
|
||||||
@ -126,59 +124,3 @@ class CopyTest(ShellCase, ShellCaseCommonTestsMixin):
|
|||||||
)
|
)
|
||||||
data = salt.utils.yaml.safe_load('\n'.join(ret))
|
data = salt.utils.yaml.safe_load('\n'.join(ret))
|
||||||
self.assertTrue(data[minion])
|
self.assertTrue(data[minion])
|
||||||
|
|
||||||
@skipIf(salt.utils.platform.is_windows(), 'Skip on Windows OS')
|
|
||||||
def test_issue_7754(self):
|
|
||||||
config_dir = os.path.join(TMP, 'issue-7754')
|
|
||||||
|
|
||||||
try:
|
|
||||||
os.makedirs(config_dir)
|
|
||||||
except OSError as exc:
|
|
||||||
if exc.errno != errno.EEXIST:
|
|
||||||
raise
|
|
||||||
|
|
||||||
config_file_name = 'master'
|
|
||||||
with salt.utils.files.fopen(self.get_config_file_path(config_file_name), 'r') as fhr:
|
|
||||||
config = salt.utils.yaml.safe_load(fhr)
|
|
||||||
config['log_file'] = 'file:///dev/log/LOG_LOCAL3'
|
|
||||||
with salt.utils.files.fopen(os.path.join(config_dir, config_file_name), 'w') as fhw:
|
|
||||||
salt.utils.yaml.safe_dump(config, fhw, default_flow_style=False)
|
|
||||||
|
|
||||||
try:
|
|
||||||
fd_, fn_ = tempfile.mkstemp()
|
|
||||||
os.close(fd_)
|
|
||||||
|
|
||||||
with salt.utils.files.fopen(fn_, 'w') as fp_:
|
|
||||||
fp_.write('Hello world!\n')
|
|
||||||
|
|
||||||
ret = self.run_script(
|
|
||||||
self._call_binary_,
|
|
||||||
'--out pprint --config-dir {0} \'*minion\' {1} {0}/{2}'.format(
|
|
||||||
config_dir,
|
|
||||||
fn_,
|
|
||||||
os.path.basename(fn_),
|
|
||||||
),
|
|
||||||
catch_stderr=True,
|
|
||||||
with_retcode=True
|
|
||||||
)
|
|
||||||
|
|
||||||
self.assertIn('minion', '\n'.join(ret[0]))
|
|
||||||
self.assertIn('sub_minion', '\n'.join(ret[0]))
|
|
||||||
self.assertFalse(os.path.isdir(os.path.join(config_dir, 'file:')))
|
|
||||||
except AssertionError:
|
|
||||||
if os.path.exists('/dev/log') and ret[2] != 2:
|
|
||||||
# If there's a syslog device and the exit code was not 2, 'No
|
|
||||||
# such file or directory', raise the error
|
|
||||||
raise
|
|
||||||
self.assertIn(
|
|
||||||
'Failed to setup the Syslog logging handler', '\n'.join(ret[1])
|
|
||||||
)
|
|
||||||
self.assertEqual(ret[2], 2)
|
|
||||||
finally:
|
|
||||||
try:
|
|
||||||
os.remove(fn_)
|
|
||||||
except OSError as exc:
|
|
||||||
if exc.errno != errno.ENOENT:
|
|
||||||
raise
|
|
||||||
if os.path.isdir(config_dir):
|
|
||||||
shutil.rmtree(config_dir)
|
|
||||||
|
@ -281,32 +281,3 @@ class KeyTest(ShellCase, ShellCaseCommonTestsMixin):
|
|||||||
)
|
)
|
||||||
finally:
|
finally:
|
||||||
shutil.rmtree(tempdir)
|
shutil.rmtree(tempdir)
|
||||||
|
|
||||||
def test_issue_7754(self):
|
|
||||||
old_cwd = os.getcwd()
|
|
||||||
config_dir = os.path.join(TMP, 'issue-7754')
|
|
||||||
if not os.path.isdir(config_dir):
|
|
||||||
os.makedirs(config_dir)
|
|
||||||
|
|
||||||
os.chdir(config_dir)
|
|
||||||
|
|
||||||
config_file_name = 'master'
|
|
||||||
with salt.utils.files.fopen(self.get_config_file_path(config_file_name), 'r') as fhr:
|
|
||||||
config = salt.utils.yaml.safe_load(fhr)
|
|
||||||
config['log_file'] = 'file:///dev/log/LOG_LOCAL3'
|
|
||||||
with salt.utils.files.fopen(os.path.join(config_dir, config_file_name), 'w') as fhw:
|
|
||||||
salt.utils.yaml.safe_dump(config, fhw, default_flow_style=False)
|
|
||||||
ret = self.run_script(
|
|
||||||
self._call_binary_,
|
|
||||||
'--config-dir {0} -L'.format(
|
|
||||||
config_dir
|
|
||||||
),
|
|
||||||
timeout=60
|
|
||||||
)
|
|
||||||
try:
|
|
||||||
self.assertIn('minion', '\n'.join(ret))
|
|
||||||
self.assertFalse(os.path.isdir(os.path.join(config_dir, 'file:')))
|
|
||||||
finally:
|
|
||||||
self.chdir(old_cwd)
|
|
||||||
if os.path.isdir(config_dir):
|
|
||||||
shutil.rmtree(config_dir)
|
|
||||||
|
@ -29,53 +29,6 @@ from tests.integration.utils import testprogram
|
|||||||
@skipIf(True, 'This test file should be in an isolated test space.')
|
@skipIf(True, 'This test file should be in an isolated test space.')
|
||||||
class MasterTest(ShellCase, testprogram.TestProgramCase, ShellCaseCommonTestsMixin):
|
class MasterTest(ShellCase, testprogram.TestProgramCase, ShellCaseCommonTestsMixin):
|
||||||
|
|
||||||
_call_binary_ = 'salt-master'
|
|
||||||
|
|
||||||
def test_issue_7754(self):
|
|
||||||
old_cwd = os.getcwd()
|
|
||||||
config_dir = os.path.join(TMP, 'issue-7754')
|
|
||||||
if not os.path.isdir(config_dir):
|
|
||||||
os.makedirs(config_dir)
|
|
||||||
|
|
||||||
os.chdir(config_dir)
|
|
||||||
|
|
||||||
config_file_name = 'master'
|
|
||||||
pid_path = os.path.join(config_dir, '{0}.pid'.format(config_file_name))
|
|
||||||
with salt.utils.files.fopen(self.get_config_file_path(config_file_name), 'r') as fhr:
|
|
||||||
config = salt.utils.yaml.safe_load(fhr)
|
|
||||||
config['root_dir'] = config_dir
|
|
||||||
config['log_file'] = 'file:///tmp/log/LOG_LOCAL3'
|
|
||||||
config['ret_port'] = config['ret_port'] + 10
|
|
||||||
config['publish_port'] = config['publish_port'] + 10
|
|
||||||
|
|
||||||
with salt.utils.files.fopen(os.path.join(config_dir, config_file_name), 'w') as fhw:
|
|
||||||
salt.utils.yaml.safe_dump(config, fhw, default_flow_style=False)
|
|
||||||
|
|
||||||
ret = self.run_script(
|
|
||||||
self._call_binary_,
|
|
||||||
'--config-dir {0} --pid-file {1} -l debug'.format(
|
|
||||||
config_dir,
|
|
||||||
pid_path
|
|
||||||
),
|
|
||||||
timeout=5,
|
|
||||||
catch_stderr=True,
|
|
||||||
with_retcode=True
|
|
||||||
)
|
|
||||||
|
|
||||||
# Now kill it if still running
|
|
||||||
if os.path.exists(pid_path):
|
|
||||||
with salt.utils.files.fopen(pid_path) as fhr:
|
|
||||||
try:
|
|
||||||
os.kill(int(fhr.read()), signal.SIGKILL)
|
|
||||||
except OSError:
|
|
||||||
pass
|
|
||||||
try:
|
|
||||||
self.assertFalse(os.path.isdir(os.path.join(config_dir, 'file:')))
|
|
||||||
finally:
|
|
||||||
self.chdir(old_cwd)
|
|
||||||
if os.path.isdir(config_dir):
|
|
||||||
shutil.rmtree(config_dir)
|
|
||||||
|
|
||||||
def test_exit_status_unknown_user(self):
|
def test_exit_status_unknown_user(self):
|
||||||
'''
|
'''
|
||||||
Ensure correct exit status when the master is configured to run as an unknown user.
|
Ensure correct exit status when the master is configured to run as an unknown user.
|
||||||
|
@ -26,7 +26,6 @@ class MatchTest(ShellCase, ShellCaseCommonTestsMixin):
|
|||||||
'''
|
'''
|
||||||
Test salt matchers
|
Test salt matchers
|
||||||
'''
|
'''
|
||||||
_call_binary_ = 'salt'
|
|
||||||
|
|
||||||
def test_list(self):
|
def test_list(self):
|
||||||
'''
|
'''
|
||||||
@ -365,44 +364,3 @@ class MatchTest(ShellCase, ShellCaseCommonTestsMixin):
|
|||||||
'''
|
'''
|
||||||
data = self.run_salt('-d minion salt ldap.search "filter=ou=People"', catch_stderr=True)
|
data = self.run_salt('-d minion salt ldap.search "filter=ou=People"', catch_stderr=True)
|
||||||
self.assertIn('You can only get documentation for one method at one time', '\n'.join(data[1]))
|
self.assertIn('You can only get documentation for one method at one time', '\n'.join(data[1]))
|
||||||
|
|
||||||
@skipIf(salt.utils.platform.is_windows(), 'Skip on Windows OS')
|
|
||||||
def test_issue_7754(self):
|
|
||||||
'''
|
|
||||||
Skip on Windows because Syslog is not installed
|
|
||||||
'''
|
|
||||||
old_cwd = os.getcwd()
|
|
||||||
config_dir = os.path.join(TMP, 'issue-7754')
|
|
||||||
if not os.path.isdir(config_dir):
|
|
||||||
os.makedirs(config_dir)
|
|
||||||
|
|
||||||
os.chdir(config_dir)
|
|
||||||
|
|
||||||
config_file_name = 'master'
|
|
||||||
with salt.utils.files.fopen(self.get_config_file_path(config_file_name), 'r') as fhr:
|
|
||||||
config = salt.utils.yaml.safe_load(fhr)
|
|
||||||
config['log_file'] = 'file:///dev/log/LOG_LOCAL3'
|
|
||||||
with salt.utils.files.fopen(os.path.join(config_dir, config_file_name), 'w') as fhw:
|
|
||||||
salt.utils.yaml.safe_dump(config, fhw, default_flow_style=False)
|
|
||||||
ret = self.run_script(
|
|
||||||
self._call_binary_,
|
|
||||||
'--config-dir {0} minion test.ping'.format(
|
|
||||||
config_dir
|
|
||||||
),
|
|
||||||
timeout=60,
|
|
||||||
catch_stderr=True,
|
|
||||||
with_retcode=True
|
|
||||||
)
|
|
||||||
try:
|
|
||||||
self.assertIn('minion', '\n'.join(ret[0]))
|
|
||||||
self.assertFalse(os.path.isdir(os.path.join(config_dir, 'file:')))
|
|
||||||
except AssertionError:
|
|
||||||
# We now fail when we're unable to properly set the syslog logger
|
|
||||||
self.assertIn(
|
|
||||||
'Failed to setup the Syslog logging handler', '\n'.join(ret[1])
|
|
||||||
)
|
|
||||||
self.assertEqual(ret[2], 2)
|
|
||||||
finally:
|
|
||||||
self.chdir(old_cwd)
|
|
||||||
if os.path.isdir(config_dir):
|
|
||||||
shutil.rmtree(config_dir)
|
|
||||||
|
@ -42,7 +42,6 @@ class MinionTest(ShellCase, testprogram.TestProgramCase, ShellCaseCommonTestsMix
|
|||||||
'''
|
'''
|
||||||
Various integration tests for the salt-minion executable.
|
Various integration tests for the salt-minion executable.
|
||||||
'''
|
'''
|
||||||
_call_binary_ = 'salt-minion'
|
|
||||||
|
|
||||||
_test_minions = (
|
_test_minions = (
|
||||||
'minion',
|
'minion',
|
||||||
|
@ -33,8 +33,6 @@ class RunTest(ShellCase, testprogram.TestProgramCase, ShellCaseCommonTestsMixin)
|
|||||||
Test the salt-run command
|
Test the salt-run command
|
||||||
'''
|
'''
|
||||||
|
|
||||||
_call_binary_ = 'salt-run'
|
|
||||||
|
|
||||||
def _add_user(self):
|
def _add_user(self):
|
||||||
'''
|
'''
|
||||||
helper method to add user
|
helper method to add user
|
||||||
@ -92,51 +90,6 @@ class RunTest(ShellCase, testprogram.TestProgramCase, ShellCaseCommonTestsMixin)
|
|||||||
data = self.run_run('-d virt.list foo', catch_stderr=True)
|
data = self.run_run('-d virt.list foo', catch_stderr=True)
|
||||||
self.assertIn('You can only get documentation for one method at one time', '\n'.join(data[1]))
|
self.assertIn('You can only get documentation for one method at one time', '\n'.join(data[1]))
|
||||||
|
|
||||||
@skipIf(salt.utils.platform.is_windows(), 'Skip on Windows OS')
|
|
||||||
def test_issue_7754(self):
|
|
||||||
'''
|
|
||||||
Skip on windows because syslog not available
|
|
||||||
'''
|
|
||||||
old_cwd = os.getcwd()
|
|
||||||
config_dir = os.path.join(TMP, 'issue-7754')
|
|
||||||
if not os.path.isdir(config_dir):
|
|
||||||
os.makedirs(config_dir)
|
|
||||||
|
|
||||||
os.chdir(config_dir)
|
|
||||||
|
|
||||||
config_file_name = 'master'
|
|
||||||
with salt.utils.files.fopen(self.get_config_file_path(config_file_name), 'r') as fhr:
|
|
||||||
config = salt.utils.yaml.safe_load(fhr)
|
|
||||||
config['log_file'] = 'file:///dev/log/LOG_LOCAL3'
|
|
||||||
with salt.utils.files.fopen(os.path.join(config_dir, config_file_name), 'w') as fhw:
|
|
||||||
salt.utils.yaml.safe_dump(config, fhw, default_flow_style=False)
|
|
||||||
ret = self.run_script(
|
|
||||||
self._call_binary_,
|
|
||||||
'--config-dir {0} -d'.format(
|
|
||||||
config_dir
|
|
||||||
),
|
|
||||||
timeout=60,
|
|
||||||
catch_stderr=True,
|
|
||||||
with_retcode=True
|
|
||||||
)
|
|
||||||
try:
|
|
||||||
self.assertIn('doc.runner:', ret[0])
|
|
||||||
self.assertFalse(os.path.isdir(os.path.join(config_dir, 'file:')))
|
|
||||||
except AssertionError:
|
|
||||||
if os.path.exists('/dev/log') and ret[2] != 2:
|
|
||||||
# If there's a syslog device and the exit code was not 2,
|
|
||||||
# 'No such file or directory', raise the error
|
|
||||||
raise
|
|
||||||
self.assertIn(
|
|
||||||
'Failed to setup the Syslog logging handler',
|
|
||||||
'\n'.join(ret[1])
|
|
||||||
)
|
|
||||||
self.assertEqual(ret[2], 2)
|
|
||||||
finally:
|
|
||||||
self.chdir(old_cwd)
|
|
||||||
if os.path.isdir(config_dir):
|
|
||||||
shutil.rmtree(config_dir)
|
|
||||||
|
|
||||||
def test_exit_status_unknown_argument(self):
|
def test_exit_status_unknown_argument(self):
|
||||||
'''
|
'''
|
||||||
Ensure correct exit status when an unknown argument is passed to salt-run.
|
Ensure correct exit status when an unknown argument is passed to salt-run.
|
||||||
|
@ -36,54 +36,6 @@ class SyndicTest(ShellCase, testprogram.TestProgramCase, ShellCaseCommonTestsMix
|
|||||||
Test the salt-syndic command
|
Test the salt-syndic command
|
||||||
'''
|
'''
|
||||||
|
|
||||||
_call_binary_ = 'salt-syndic'
|
|
||||||
|
|
||||||
def test_issue_7754(self):
|
|
||||||
old_cwd = os.getcwd()
|
|
||||||
config_dir = os.path.join(TMP, 'issue-7754')
|
|
||||||
if not os.path.isdir(config_dir):
|
|
||||||
os.makedirs(config_dir)
|
|
||||||
|
|
||||||
os.chdir(config_dir)
|
|
||||||
|
|
||||||
for fname in ('master', 'minion'):
|
|
||||||
pid_path = os.path.join(config_dir, '{0}.pid'.format(fname))
|
|
||||||
with salt.utils.files.fopen(self.get_config_file_path(fname), 'r') as fhr:
|
|
||||||
config = salt.utils.yaml.safe_load(fhr)
|
|
||||||
config['log_file'] = config['syndic_log_file'] = 'file:///tmp/log/LOG_LOCAL3'
|
|
||||||
config['root_dir'] = config_dir
|
|
||||||
if 'ret_port' in config:
|
|
||||||
config['ret_port'] = int(config['ret_port']) + 10
|
|
||||||
config['publish_port'] = int(config['publish_port']) + 10
|
|
||||||
|
|
||||||
with salt.utils.files.fopen(os.path.join(config_dir, fname), 'w') as fhw:
|
|
||||||
salt.utils.yaml.safe_dump(config, fhw, default_flow_style=False)
|
|
||||||
|
|
||||||
ret = self.run_script(
|
|
||||||
self._call_binary_,
|
|
||||||
'--config-dir={0} --pid-file={1} -l debug'.format(
|
|
||||||
config_dir,
|
|
||||||
pid_path
|
|
||||||
),
|
|
||||||
timeout=5,
|
|
||||||
catch_stderr=True,
|
|
||||||
with_retcode=True
|
|
||||||
)
|
|
||||||
|
|
||||||
# Now kill it if still running
|
|
||||||
if os.path.exists(pid_path):
|
|
||||||
with salt.utils.files.fopen(pid_path) as fhr:
|
|
||||||
try:
|
|
||||||
os.kill(int(fhr.read()), SIGKILL)
|
|
||||||
except OSError:
|
|
||||||
pass
|
|
||||||
try:
|
|
||||||
self.assertFalse(os.path.isdir(os.path.join(config_dir, 'file:')))
|
|
||||||
finally:
|
|
||||||
self.chdir(old_cwd)
|
|
||||||
if os.path.isdir(config_dir):
|
|
||||||
shutil.rmtree(config_dir)
|
|
||||||
|
|
||||||
@skipIf(salt.utils.platform.is_windows(), 'Skip on Windows OS')
|
@skipIf(salt.utils.platform.is_windows(), 'Skip on Windows OS')
|
||||||
def test_exit_status_unknown_user(self):
|
def test_exit_status_unknown_user(self):
|
||||||
'''
|
'''
|
||||||
|
Loading…
Reference in New Issue
Block a user