Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Test failures with ruby-openid 2.2.0 #36

graaff opened this Issue · 5 comments

2 participants


I'm getting the following test failures. I guess this happens because my system resolves localhost to ::1 (IPv6) while the fetchers seems to be initialized with

  1) Error:
OpenID::FetchingError: Error fetching http://localhost:40622/success: Connection refused - connect(2)
    ../lib/openid/fetchers.rb:218:in `fetch'
    ./test_fetchers.rb:247:in `test_cases'
    ./test_fetchers.rb:238:in `each'
    ./test_fetchers.rb:238:in `test_cases'

  2) Error:
OpenID::FetchingError: Error fetching http://localhost:51109/require_header: Connection refused - connect(2)
    ../lib/openid/fetchers.rb:218:in `fetch'
    ./test_fetchers.rb:195:in `test_headers'

  3) Error:
OpenID::FetchingError: Error fetching http://localhost:40351/redirect_to_reqheader: Connection refused - connect(2)
    ../lib/openid/fetchers.rb:218:in `fetch'
    ./test_fetchers.rb:206:in `test_headers_after_redirect'

  4) Error:
OpenID::FetchingError: Error fetching http://localhost:56165/post: Connection refused - connect(2)
    ../lib/openid/fetchers.rb:218:in `fetch'
    ./test_fetchers.rb:214:in `test_post'

  5) Failure:
test_redirect_limit(FetcherTestCase) [./test_fetchers.rb:223]:
<OpenID::HTTPRedirectLimitReached> exception expected but was
Class: <OpenID::FetchingError>
Message: <"Error fetching http://localhost:43437/redirect_loop: Connection refused - connect(2)">
../lib/openid/fetchers.rb:218:in `fetch'
./test_fetchers.rb:224:in `test_redirect_limit'
./test_fetchers.rb:223:in `test_redirect_limit'

  6) Error:
OpenID::FetchingError: Error fetching http://localhost:45005/utf8_page: Connection refused - connect(2)
    ../lib/openid/fetchers.rb:218:in `fetch'
    ./test_fetchers.rb:230:in `test_utf8_page'

868 tests, 6583 assertions, 1 failures, 5 errors

It works fine for me, what does your /etc/hosts file look like?

::1     localhost graaff   localhost graaff

hmm, same for me


I've done some more digging and the problem is that the webrick test server (in test_fetchers.rb) does not provide a BindAddress. It looks like my ruby (ruby 1.8.7 (2012-06-29 patchlevel 370) [x86_64-linux]) falls back to as the bind address, and indeed netstat shows that the server is listening on an IPv4 socket. With localhost first returning as an IPv6 name on my system the tests fail to connect.

Adding :BindAddress => 'localhost' to the webrick server in test_fetchers.rb makes the tests pass for me in addition to consistently using localhost everywhere (there are also some mentions of in test_fetchers.rb).

In summary here's what we change in the Gentoo package to make this work now for ruby 1.8, ruby 1.9 and jruby:

sed -i -e 's/' test/test_fetchers.rb || die
sed -i -e '134i :BindAddress => "localhost",' test/test_fetchers.rb || die

Should be fixed now :) See 7ac8e39#L2R186

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.