petergoldstein/dalli

Test Dalli::options parsing#test_0007_opens a SSL TCP connection failing with Errno::ECONNREFUSED: Connection refused

dleidert opened this issue · 5 comments

While building and packaging version 3.0.3 for Debian, we see this test failing on both Ruby 2.7 and 3.0. Do you have any idea what could be the issue?

Found memcached 1.6.12 in PATH
This server is not built with TLS support.
This server is not built with TLS support.
Dalli::options parsing#test_0007_opens a SSL TCP connection = 0.40 s = E


Error:
Dalli::options parsing#test_0007_opens a SSL TCP connection:
Errno::ECONNREFUSED: Connection refused - connect(2) for "localhost" port 21397
    /build/ruby-dalli-pvSEGY/ruby-dalli-3.0.3/debian/ruby-dalli/usr/share/rubygems-integration/all/gems/dalli-3.0.3/lib/dalli/socket.rb:63:in `initialize'
    /build/ruby-dalli-pvSEGY/ruby-dalli-3.0.3/debian/ruby-dalli/usr/share/rubygems-integration/all/gems/dalli-3.0.3/lib/dalli/socket.rb:63:in `new'
    /build/ruby-dalli-pvSEGY/ruby-dalli-3.0.3/debian/ruby-dalli/usr/share/rubygems-integration/all/gems/dalli-3.0.3/lib/dalli/socket.rb:63:in `block in open'
    /usr/lib/ruby/2.7.0/timeout.rb:95:in `block in timeout'
    /usr/lib/ruby/2.7.0/timeout.rb:33:in `block in catch'
    /usr/lib/ruby/2.7.0/timeout.rb:33:in `catch'
    /usr/lib/ruby/2.7.0/timeout.rb:33:in `catch'
    /usr/lib/ruby/2.7.0/timeout.rb:110:in `timeout'
    /build/ruby-dalli-pvSEGY/ruby-dalli-3.0.3/debian/ruby-dalli/usr/share/rubygems-integration/all/gems/dalli-3.0.3/lib/dalli/socket.rb:62:in `open'
    /build/ruby-dalli-pvSEGY/ruby-dalli-3.0.3/test/test_dalli.rb:60:in `block (4 levels) in <top (required)>'
    /build/ruby-dalli-pvSEGY/ruby-dalli-3.0.3/test/memcached_mock.rb:115:in `memcached_ssl_persistent'
    /build/ruby-dalli-pvSEGY/ruby-dalli-3.0.3/test/test_dalli.rb:58:in `block (3 levels) in <top (required)>'
    /usr/lib/ruby/vendor_ruby/minitest/test.rb:98:in `block (3 levels) in run'
    /usr/lib/ruby/vendor_ruby/minitest/test.rb:195:in `capture_exceptions'
    /usr/lib/ruby/vendor_ruby/minitest/test.rb:95:in `block (2 levels) in run'
    /usr/lib/ruby/vendor_ruby/minitest.rb:270:in `time_it'
    /usr/lib/ruby/vendor_ruby/minitest/test.rb:94:in `block in run'
    /usr/lib/ruby/vendor_ruby/minitest.rb:365:in `on_signal'
    /usr/lib/ruby/vendor_ruby/minitest/test.rb:211:in `with_info_handler'
    /usr/lib/ruby/vendor_ruby/minitest/test.rb:93:in `run'
    /usr/lib/ruby/vendor_ruby/minitest.rb:1029:in `run_one_method'
    /usr/lib/ruby/vendor_ruby/minitest.rb:339:in `run_one_method'
    /usr/lib/ruby/vendor_ruby/minitest.rb:326:in `block (2 levels) in run'
    /usr/lib/ruby/vendor_ruby/minitest.rb:325:in `each'
    /usr/lib/ruby/vendor_ruby/minitest.rb:325:in `block in run'
    /usr/lib/ruby/vendor_ruby/minitest.rb:365:in `on_signal'
    /usr/lib/ruby/vendor_ruby/minitest.rb:352:in `with_info_handler'
    /usr/lib/ruby/vendor_ruby/minitest.rb:324:in `run'
    /usr/lib/ruby/vendor_ruby/minitest.rb:164:in `block in __run'
    /usr/lib/ruby/vendor_ruby/minitest.rb:164:in `map'
    /usr/lib/ruby/vendor_ruby/minitest.rb:164:in `__run'
    /usr/lib/ruby/vendor_ruby/minitest.rb:141:in `run'
    /usr/lib/ruby/vendor_ruby/minitest.rb:68:in `block in autorun'


rails test build/ruby-dalli-pvSEGY/ruby-dalli-3.0.3/test/test_dalli.rb:57

@dleidert How are you building the memcached on the box for testing? It looks like that memcached has not been compiled with SSL/TLS enabled. That requires a flag during the build process for memcached

@dleidert you can see the relevant configuration options (and dependencies) in the script we use to install memcached as part of CI - https://github.com/petergoldstein/dalli/blob/master/scripts/install_memcached.sh

Thanks for the pointer. I'm part of the Debian Ruby team, and we use of course the memcached version shipped in Debian. And this one did remove TLS support just recently:

https://salsa.debian.org/dleidert/pkg-memcached/-/commit/4eac2d424e7a88ddcb7192de25be3ffe7afdc454

I'll talk to the memcached Debian maintainer about the reasoning. Maybe we can re-enable support for a subset of architectures. Thanks for your time.

However, maybe it might be a good idea to add a rescue to this test to not fail just because memcached doesn't support TLS.

@dleidert I'm not sure why this wouldn't be a failure condition. It's a documented requirement that memcached be configured to support TLS to run the test suite. If you don't run memcached in TLS mode, you haven't run the test suite. So it should fail.

Right now the test prints an informative error message - "This server is not built with TLS support." - which indicates the issue. I'm happy to take suggestions for making this case (and the remediation condition) clearer, but the test should fail in this case.