Ganesh Murthy created PROTON-1158:
-------------------------------------

             Summary: [proton-c] Some messenger SSL tests use hardcoded port 
number 12345
                 Key: PROTON-1158
                 URL: https://issues.apache.org/jira/browse/PROTON-1158
             Project: Qpid Proton
          Issue Type: Bug
          Components: python-binding
    Affects Versions: 0.12.0
            Reporter: Ganesh Murthy
            Assignee: Ganesh Murthy
            Priority: Minor


A couple of tests in the MessengerSSLTests (in 
tests/python/proton_tests/ssl.py) hard code the port numbers as 12345
{code}
    def test_server_credentials(self,
                                cert="server-certificate.pem",
                                key="server-private-key.pem",
                                password="server-password",
                                exception=None):
        import sys
        # java doesn't do validation in the same way (yet)
        if exception and "java" in sys.platform:
            raise Skipped()
        self.server.certificate = _testpath(cert)
        self.server.private_key = _testpath(key)
        self.server.password = password
        try:
            self.server.start()
            self.server.subscribe("amqps://~0.0.0.0:12345")
            if exception is not None:
                assert False, "expected failure did not occur"
        except MessengerException:
            e = sys.exc_info()[1]
            if exception:
                assert exception in str(e), str(e)
            else:
                raise e
{code}

Hard coding the port sometimes leads to errors if port 12345 is already bound. 
{code}
    File "./tests/python/proton-test", line 362, in run
      phase()
    File 
"<http://mrg23.lab.bos.redhat.com:8080/job/proton-c-master-rhel-cxx/label=rhel7-64/ws/qpid-proton/tests/python/proton_tests/ssl.py";,>
 line 992, in test_client_credentials
      self.server.subscribe("amqps://~0.0.0.0:12345")
    File 
"<http://mrg23.lab.bos.redhat.com:8080/job/proton-c-master-rhel-cxx/label=rhel7-64/ws/qpid-proton/proton-c/bindings/python/proton/__init__.py";,>
 line 496, in subscribe
      self._check(pn_error_code(pn_messenger_error(self._mng)))
    File 
"<http://mrg23.lab.bos.redhat.com:8080/job/proton-c-master-rhel-cxx/label=rhel7-64/ws/qpid-proton/proton-c/bindings/python/proton/__init__.py";,>
 line 300, in _check
      raise exc("[%s]: %s" % (err, 
pn_error_text(pn_messenger_error(self._mng))))
  MessengerException: [-2]: CONNECTION ERROR (0.0.0.0:12345): bind: errno: 98
proton_tests.ssl.MessengerSSLTests.test_client_credentials_bad_cert ..... fail
{code}
Remove all occurrences of hard coded ports in  MessengerSSLTests



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to