Add warnings to test suite when requisites are not installed

Since we have recently changed the test suite to use new-style
git_pillar, GitPython or Pygit2 is a hard dep for the test suite.

Additionally, when starting up the daemons, if no IPv4 addresses can be
detected (which can happen on docker containers which tend to have
minimal installs) then the suite will time out trying to detect whether
or not the minion/sub-minion has connected, which while it does not
prove fatal for the test suite, it does make the suite take several
minutes to start up and begin running tests. This is because the test
suite invokes the manage.joined runner, which in turn invokes
salt.utils.network.ip_addrs() to get the system's IP addresses to match
against those which are connected. If it can't get the IP addresses,
then the manage.joined runner returns an empty list, and the test suite
believes that no minions have connected, and the function that
periodically runs manage.joined will eventually time out.

This commit adds messages to the console when no suitable gitfs provider
is installed, and when salt.utils.network.ip_addrs() returns an empty
list, to hopefully prompt the user to install the missing requisites.
This commit is contained in:
Erik Johnson 2017-02-25 16:06:52 -06:00
parent 9eb23993d3
commit 503216e5c5

View file

@ -60,6 +60,7 @@ import salt.runner
import salt.output
import salt.version
import salt.utils
import salt.utils.network
import salt.utils.process
import salt.log.setup as salt_log_setup
from salt.ext import six
@ -68,6 +69,12 @@ from salt.utils.immutabletypes import freeze
from salt.utils.nb_popen import NonBlockingPopen
from salt.exceptions import SaltClientError
try:
from salt.utils.gitfs import HAS_GITPYTHON, HAS_PYGIT2
HAS_GITFS = HAS_GITPYTHON or HAS_PYGIT2
except ImportError:
HAS_GITFS = False
try:
from shlex import quote as _quote # pylint: disable=E0611
except ImportError:
@ -695,6 +702,14 @@ class TestDaemon(object):
# Set up PATH to mockbin
self._enter_mockbin()
if not HAS_GITFS:
sys.stdout.write(
' * {LIGHT_RED}No suitable provider for git_pillar is installed. Install\n'
' GitPython or Pygit2.{ENDC}\n'.format(
**self.colors
)
)
if self.parser.options.transport == 'zeromq':
self.start_zeromq_daemons()
elif self.parser.options.transport == 'raet':
@ -761,6 +776,13 @@ class TestDaemon(object):
'''
Fire up the daemons used for zeromq tests
'''
if not salt.utils.network.ip_addrs():
sys.stdout.write(
' * {LIGHT_RED}Unable to list IPv4 addresses. Test suite startup will be\n'
' slower. Install iproute/ifconfig to fix this.{ENDC}\n'.format(
**self.colors
)
)
self.log_server = ThreadedSocketServer(('localhost', SALT_LOG_PORT), SocketServerRequestHandler)
self.log_server_process = threading.Thread(target=self.log_server.serve_forever)
self.log_server_process.daemon = True