Merge branch '2015.5' into '2015.8'

Conflits:
  - salt/minion.py
  - tests/integration/states/file.py
This commit is contained in:
rallytime 2016-05-06 12:03:38 -06:00
commit 0fd5e9d157
5 changed files with 62 additions and 4 deletions

View file

@ -569,7 +569,7 @@ def assertion(assertion):
.. code-block:: bash
salt '*' test.assert False
salt '*' test.assertion False
'''
assert assertion

View file

@ -116,9 +116,10 @@ class Serial(object):
gc.disable() # performance optimization for msgpack
return msgpack.loads(msg, use_list=True)
except Exception as exc:
log.critical('Could not deserialize msgpack message: {0}'
'This often happens when trying to read a file not in binary mode.'
'Please open an issue and include the following error: {1}'.format(msg, exc))
log.critical('Could not deserialize msgpack message.'
'This often happens when trying to read a file not in binary mode'
'To see message payload, enable debug logging and retry. Exception: {0}'.format(exc))
log.debug('Msgpack deserialization failure on message: {0}'.format(msg))
raise
finally:
gc.enable()

View file

@ -234,6 +234,8 @@ def build_centos(opts):
if major_release == 5:
python_bin = 'python26'
define_opts.extend(['--define', 'dist .el5'])
if os.path.exists('/etc/yum.repos.d/saltstack.repo'):
build_reqs.extend(['--enablerepo=saltstack'])
build_reqs.extend(['python26-devel'])
elif major_release == 6:
build_reqs.extend(['python-devel'])

View file

@ -113,6 +113,17 @@ class PillarModuleTest(integration.ModuleCase):
self.assertEqual(grepo.rp_location, repo.remotes.origin.url)
def test_pillar_items(self):
'''
Test to ensure we get expected output
from pillar.items
'''
get_items = self.run_function('pillar.items')
self.assertDictContainsSubset({'info': 'bar'}, get_items)
self.assertDictContainsSubset({'monty': 'python'}, get_items)
self.assertDictContainsSubset(
{'knights': ['Lancelot', 'Galahad', 'Bedevere', 'Robin']},
get_items)
if __name__ == '__main__':
from integration import run_tests

View file

@ -15,6 +15,7 @@ import re
import shutil
import yaml
from datetime import datetime
import logging
# Import Salt Testing libs
from salttesting import skipIf
@ -24,6 +25,19 @@ ensure_in_syspath('../../')
# Import salt libs
import integration
import salt.utils
from salttesting.helpers import (
destructiveTest
)
log = logging.getLogger(__name__)
_PKG_TARGETS = {
'Arch': ['python2-django', 'libpng'],
'Debian': ['python-plist', 'apg'],
'RedHat': ['xz-devel', 'zsh-html'],
'FreeBSD': ['aalib', 'pth'],
'Suse': ['aalib', 'python-pssh']
}
class CallTest(integration.ShellCase, integration.ShellCaseCommonTestsMixIn):
@ -67,6 +81,25 @@ class CallTest(integration.ShellCase, integration.ShellCaseCommonTestsMixIn):
self.assertIn('hello', ''.join(out))
self.assertIn('Succeeded: 1', ''.join(out))
@destructiveTest
@skipIf(sys.platform.startswith('win'), 'This test does not apply on Win')
def test_local_pkg_install(self):
'''
Test to ensure correct output when installing package
'''
get_os_family = self.run_call('--local grains.get os_family')
pkg_targets = _PKG_TARGETS.get(get_os_family[1].strip(), [])
check_pkg = self.run_call('--local pkg.list_pkgs')
for pkg in pkg_targets:
if pkg not in str(check_pkg):
out = self.run_call('--local pkg.install {0}'.format(pkg))
self.assertIn('local: ----------', ''.join(out))
self.assertIn('{0}: ----------'.format(pkg), ''.join(out))
self.assertIn('new:', ''.join(out))
self.assertIn('old:', ''.join(out))
else:
log.debug('The pkg: {0} is already installed on the machine'.format(pkg))
@skipIf(sys.platform.startswith('win'), 'This test does not apply on Win')
def test_user_delete_kw_output(self):
ret = self.run_call('-l quiet -d user.delete')
@ -391,6 +424,17 @@ class CallTest(integration.ShellCase, integration.ShellCaseCommonTestsMixIn):
# Restore umask
os.umask(current_umask)
def tearDown(self):
'''
Teardown method to remove installed packages
'''
check_pkg = self.run_call('--local pkg.list_pkgs')
get_os_family = self.run_call('--local grains.get os_family')
pkg_targets = _PKG_TARGETS.get(get_os_family[1].strip(), [])
check_pkg = self.run_call('--local pkg.list_pkgs')
for pkg in pkg_targets:
if pkg in str(check_pkg):
out = self.run_call('--local pkg.remove {0}'.format(pkg))
if __name__ == '__main__':
from integration import run_tests