salt/tests/unit/minion_test.py
Mike Place f2f7e9f537 Handle invalid master address in minion config
Gracefully exit the minion while informing the user of the cause of the error if the IP address of the master is malformed such that it can not even be dealt with by Python's socket module.

Unit testing for the above condition.

Closes #9440.

Remove suprious debugging statement.

Remove more spurious debugging.
2013-12-26 09:48:01 -07:00

23 lines
616 B
Python

# -*- coding: utf-8 -*-
'''
:codauthor: :email:`Mike Place <mp@saltstack.com>`
'''
# Import Salt Testing libs
from salttesting import TestCase
from salttesting.helpers import ensure_in_syspath
from salttesting.mock import patch
from salt import minion
from salt.exceptions import SaltSystemExit
ensure_in_syspath('../')
__opts__ = {}
class MinionTestCase(TestCase):
def test_invalid_master_address(self):
with patch.dict(__opts__, {'ipv6': False, 'master': float('127.0'), 'master_port': '4555', 'retry_dns': False}):
self.assertRaises(SaltSystemExit, minion.resolve_dns, __opts__)