2012-10-19 15:07:31 +00:00
|
|
|
'''
|
|
|
|
Tests for the rabbitmq state
|
|
|
|
'''
|
|
|
|
import os
|
2013-06-25 08:24:45 +00:00
|
|
|
|
|
|
|
# Import salt libs
|
|
|
|
try:
|
|
|
|
import integration
|
|
|
|
except ImportError:
|
|
|
|
if __name__ == '__main__':
|
|
|
|
import sys
|
|
|
|
sys.path.insert(
|
|
|
|
0, os.path.abspath(
|
|
|
|
os.path.join(
|
|
|
|
os.path.dirname(__file__), '../../'
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
import integration
|
2012-10-19 15:07:31 +00:00
|
|
|
|
|
|
|
|
2012-12-07 17:13:58 +00:00
|
|
|
class RabbitVHostTestCase(integration.ModuleCase,
|
|
|
|
integration.SaltReturnAssertsMixIn):
|
2012-10-19 15:07:31 +00:00
|
|
|
'''
|
|
|
|
Validate the rabbitmq virtual host states.
|
|
|
|
'''
|
|
|
|
def setUp(self):
|
|
|
|
super(RabbitVHostTestCase, self).setUp()
|
|
|
|
rabbit_installed = self.run_function('cmd.has_exec', ['rabbitmqctl'])
|
|
|
|
|
|
|
|
if not rabbit_installed:
|
|
|
|
self.skipTest('rabbitmq-server not installed')
|
|
|
|
if os.geteuid() != 0:
|
|
|
|
self.skipTest('You must be root to run this test')
|
|
|
|
|
|
|
|
def test_present(self):
|
|
|
|
'''
|
|
|
|
rabbitmq_vhost.present null_host
|
|
|
|
'''
|
2012-10-19 15:28:38 +00:00
|
|
|
ret = self.run_state(
|
2012-12-07 17:01:31 +00:00
|
|
|
'rabbitmq_vhost.present', name='null_host', test=True
|
|
|
|
)
|
|
|
|
self.assertSaltFalseReturn(ret)
|
2012-10-19 15:07:31 +00:00
|
|
|
|
|
|
|
def absent(self):
|
|
|
|
'''
|
|
|
|
rabbitmq_vhost.absent null_host
|
|
|
|
'''
|
2012-10-19 15:28:38 +00:00
|
|
|
ret = self.run_state(
|
2012-12-07 17:01:31 +00:00
|
|
|
'rabbitmq_vhost.absent', name='null_host', test=True
|
|
|
|
)
|
|
|
|
self.assertSaltFalseReturn(ret)
|
2013-06-25 08:24:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
from integration import run_tests
|
|
|
|
run_tests(RabbitVHostTestCase)
|