2017-03-31 21:16:36 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
'''
|
|
|
|
Tests for the salt-run command
|
|
|
|
'''
|
|
|
|
# Import Python libs
|
2017-12-15 01:21:00 +00:00
|
|
|
from __future__ import absolute_import, print_function, unicode_literals
|
2017-03-31 21:16:36 +00:00
|
|
|
|
|
|
|
# Import Salt Testing libs
|
2017-04-03 16:04:09 +00:00
|
|
|
from tests.support.case import ShellCase
|
2017-03-31 21:16:36 +00:00
|
|
|
|
2018-08-09 16:40:14 +00:00
|
|
|
import logging
|
|
|
|
log = logging.getLogger(__name__)
|
|
|
|
|
2017-03-31 21:16:36 +00:00
|
|
|
|
2017-04-03 16:04:09 +00:00
|
|
|
class ManageTest(ShellCase):
|
2017-03-31 21:16:36 +00:00
|
|
|
'''
|
|
|
|
Test the manage runner
|
|
|
|
'''
|
|
|
|
def test_cache(self):
|
|
|
|
'''
|
|
|
|
Store, list, fetch, then flush data
|
|
|
|
'''
|
|
|
|
# Store the data
|
|
|
|
ret = self.run_run_plus(
|
|
|
|
'cache.store',
|
2017-03-31 21:21:26 +00:00
|
|
|
bank='cachetest/runner',
|
2017-03-31 21:16:36 +00:00
|
|
|
key='test_cache',
|
|
|
|
data='The time has come the walrus said',
|
|
|
|
)
|
|
|
|
# Make sure we can see the new key
|
2017-03-31 21:21:26 +00:00
|
|
|
ret = self.run_run_plus('cache.list', bank='cachetest/runner')
|
2017-03-31 21:16:36 +00:00
|
|
|
self.assertIn('test_cache', ret['return'])
|
|
|
|
# Make sure we can see the new data
|
2017-03-31 21:21:26 +00:00
|
|
|
ret = self.run_run_plus('cache.fetch', bank='cachetest/runner', key='test_cache')
|
2017-03-31 21:16:36 +00:00
|
|
|
self.assertIn('The time has come the walrus said', ret['return'])
|
|
|
|
# Make sure we can delete the data
|
2017-03-31 21:21:26 +00:00
|
|
|
ret = self.run_run_plus('cache.flush', bank='cachetest/runner', key='test_cache')
|
|
|
|
ret = self.run_run_plus('cache.list', bank='cachetest/runner')
|
2017-03-31 21:16:36 +00:00
|
|
|
self.assertNotIn('test_cache', ret['return'])
|
2018-08-09 16:40:14 +00:00
|
|
|
|
|
|
|
def test_grains(self):
|
|
|
|
'''
|
|
|
|
Test cache.grains
|
|
|
|
'''
|
|
|
|
# Store the data
|
|
|
|
ret = self.run_run_plus(
|
|
|
|
'cache.grains',
|
|
|
|
tgt='minion'
|
|
|
|
)
|
|
|
|
|
|
|
|
self.assertIn('minion', ret['return'])
|
|
|
|
|
|
|
|
def test_pillar(self):
|
|
|
|
'''
|
|
|
|
Test cache.pillar
|
|
|
|
'''
|
|
|
|
# Store the data
|
|
|
|
ret = self.run_run_plus(
|
|
|
|
'cache.pillar',
|
|
|
|
tgt='minion'
|
|
|
|
)
|
|
|
|
|
|
|
|
self.assertIn('minion', ret['return'])
|
|
|
|
|
|
|
|
def test_mine(self):
|
|
|
|
'''
|
|
|
|
Test cache.mine
|
|
|
|
'''
|
|
|
|
# Store the data
|
|
|
|
ret = self.run_run_plus(
|
|
|
|
'cache.mine',
|
|
|
|
tgt='minion'
|
|
|
|
)
|
|
|
|
|
|
|
|
self.assertIn('minion', ret['return'])
|