mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 08:58:59 +00:00
Add test case for the status beacon. Refs #38121
Tests proper handling of both the old configuration format and the new one
This commit is contained in:
parent
0cb46f0eb8
commit
8f5fc49fcc
55
tests/unit/beacons/test_status.py
Normal file
55
tests/unit/beacons/test_status.py
Normal file
@ -0,0 +1,55 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
'''
|
||||
:codeauthor: :email:`Pedro Algarvio (pedro@algarvio.me)`
|
||||
:copyright: © 2017 by the SaltStack Team, see AUTHORS for more details.
|
||||
|
||||
|
||||
tests.unit.beacons.test_status
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Status beacon test cases
|
||||
'''
|
||||
|
||||
# Python libs
|
||||
from __future__ import absolute_import
|
||||
|
||||
# Salt libs
|
||||
import salt.config
|
||||
import salt.loader
|
||||
from salt.beacons import status
|
||||
from salt.modules import status as status_module
|
||||
|
||||
# Salt testing libs
|
||||
from tests.support.unit import TestCase
|
||||
from tests.support.mixins import LoaderModuleMockMixin
|
||||
|
||||
|
||||
class StatusBeaconTestCase(TestCase, LoaderModuleMockMixin):
|
||||
'''
|
||||
Test case for salt.beacons.status
|
||||
'''
|
||||
loader_module = (status, status_module)
|
||||
|
||||
def loader_module_globals(self):
|
||||
opts = salt.config.DEFAULT_MINION_OPTS
|
||||
return {
|
||||
'__opts__': opts,
|
||||
'__salt__': 'autoload',
|
||||
'__context__': {},
|
||||
'__grains__': {'kernel': 'Linux'}
|
||||
}
|
||||
|
||||
def test_empty_config(self, *args, **kwargs):
|
||||
config = {}
|
||||
ret = status.beacon(config)
|
||||
self.assertEqual(ret[0]['data'].keys(), ['loadavg', 'meminfo', 'cpustats', 'vmstats', 'time'])
|
||||
|
||||
def test_deprecated_dict_config(self):
|
||||
config = {'time': ['all']}
|
||||
ret = status.beacon(config)
|
||||
self.assertEqual(ret[0]['data'].keys(), ['time'])
|
||||
|
||||
def test_list_config(self):
|
||||
config = [{'time': ['all']}]
|
||||
ret = status.beacon(config)
|
||||
self.assertEqual(ret[0]['data'].keys(), ['time'])
|
Loading…
Reference in New Issue
Block a user