New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch socket.error exception in testprogram #48869

Merged
merged 1 commit into from Aug 2, 2018

Conversation

Projects
None yet
3 participants
@Ch3LL
Contributor

Ch3LL commented Aug 1, 2018

What does this PR do?

Fixes shell tests on mac. We need to make sure we are also catching socket.error when trying to bind to the port to determine if its already being used.

Here's an example of one of the shell test failures on mac:

ImportError: Failed to import test module: integration.shell.test_call
Traceback (most recent call last):
  File "/opt/salt/lib/python2.7/unittest/loader.py", line 254, in _find_tests
    module = self._get_module_from_name(name)
  File "/opt/salt/lib/python2.7/unittest/loader.py", line 232, in _get_module_from_name
    __import__(name)
  File "/testing/tests/integration/shell/test_call.py", line 29, in <module>
    from tests.integration.utils import testprogram
  File "/testing/tests/integration/utils/testprogram.py", line 584, in <module>
    class TestSaltProgram(six.with_metaclass(TestSaltProgramMeta, TestProgram)):
  File "/testing/tests/integration/utils/testprogram.py", line 600, in TestSaltProgram
    connect = sock.bind(('localhost', port))
  File "/opt/salt/lib/python2.7/socket.py", line 228, in meth
    return getattr(self._sock,name)(*args)
error: [Errno 48] Address already in use

@Ch3LL Ch3LL requested a review from KaiSforza Aug 1, 2018

@rallytime rallytime merged commit a84f515 into saltstack:2017.7 Aug 2, 2018

5 of 8 checks passed

jenkins/pr/py2-centos-7 The py2-centos-7 job has failed
Details
continuous-integration/jenkins/pr-merge This commit is being built
Details
jenkins/pr/py3-centos-7 running py3-centos-7...
Details
WIP ready for review
Details
jenkins/pr/docs The docs job has passed
Details
jenkins/pr/lint The lint job has passed
Details
jenkins/pr/py2-ubuntu-1604 The py2-ubuntu-1604 job has passed
Details
jenkins/pr/py3-ubuntu-1604 The py3-ubuntu-1604 job has passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment