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

[cpp] Attempt to listen on invalid URL will not throw exception

    XMLWordPrintableJSON

Details

    • Test
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • proton-c-0.18.0
    • proton-c-0.31.0
    • cpp-binding
    • None

    Description

      The test container_test.cpp/test_container_bad_address() is not checking that expected exceptions are actually thrown. If I add these checks, the test starts failing.

      diff --git a/proton-c/bindings/cpp/src/container_test.cpp b/proton-c/bindings/cpp/src/container_test.cpp
      index eb05ddbd..d1dc6628 100644
      --- a/proton-c/bindings/cpp/src/container_test.cpp
      +++ b/proton-c/bindings/cpp/src/container_test.cpp
      @@ -176,12 +176,18 @@ int test_container_bad_address() {
       
           proton::container c;
           // Default fixed-option listener. Valgrind for leaks.
      -    try { c.listen("999.666.999.666:0"); } catch (const proton::error&) {}
      +    try {
      +        c.listen("999.666.999.666:0");
      +        FAIL("exception expected");
      +    } catch (const proton::error&) {}
           c.run();
           // Dummy listener.
           test_listen_handler l;
           test_handler h2("999.999.999.666", proton::connection_options());
      -    try { c.listen("999.666.999.666:0", l); } catch (const proton::error&) {}
      +    try {
      +        c.listen("999.666.999.666:0", l);
      +        FAIL("exception expected");
      +    } catch (const proton::error&) {}
           c.run();
           ASSERT(!l.on_open_);
           ASSERT(!l.on_accept_);
      

      No exception is ever thrown: invalid IP, port is already occupied, port is < 1025 and I am not root... never.

      Attachments

        Issue Links

          Activity

            People

              jdanek Jiri Daněk
              jdanek Jiri Daněk
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: