Uploaded image for project: 'Qpid Proton'
  1. Qpid Proton
  2. PROTON-1158

[proton-c] Some messenger SSL tests use hardcoded port number 12345

    XMLWordPrintableJSON

Details

    Description

      A couple of tests in the MessengerSSLTests (in tests/python/proton_tests/ssl.py) hard code the port numbers as 12345

          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
      

      Hard coding the port sometimes leads to errors if port 12345 is already bound.

          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
      

      Remove all occurrences of hard coded ports in MessengerSSLTests

      Attachments

        Issue Links

          Activity

            People

              gmurthy Ganesh Murthy
              gmurthy Ganesh Murthy
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: