[DRE-maint] Bug#921486: ruby-adsf: make test suite compatible with $http_proxy

Steve Langasek steve.langasek at canonical.com
Wed Feb 6 01:33:00 GMT 2019

Package: ruby-adsf
Version: 1.4.1+dfsg1-1
Severity: normal
Tags: patch
User: ubuntu-devel at lists.ubuntu.com
Usertags: origin-ubuntu disco ubuntu-patch

Hi C├ędric,

The ruby-asdf autopkgtests have been failing in Ubuntu despite passing in
Debian, with the following error:

  1) Failure:
Adsf::Test::Server#test_non_local_interfaces [/tmp/autopkgtest.Y5x1aO/build.RK7/
[Errno::ECONNREFUSED] exception expected, not
Class: <Net::ReadTimeout>
Message: <"Net::ReadTimeout">


This error occurs because the Ubuntu autopkgtest runners have an http proxy
configured for Internet access, which cannot be used to access the runner's
own local addresses; so an http_proxy-aware function that tries to connect
to a local port fails as a result.

The attached patch allows the ruby-adsf tests to succeed in Ubuntu.  Would
you consider applying this change in Debian?

Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                   https://www.debian.org/
slangasek at ubuntu.com                                     vorlon at debian.org
-------------- next part --------------
diff -Nru ruby-adsf-1.4.1+dfsg1/debian/patches/proxy-safe-tests.patch ruby-adsf-1.4.1+dfsg1/debian/patches/proxy-safe-tests.patch
--- ruby-adsf-1.4.1+dfsg1/debian/patches/proxy-safe-tests.patch	1969-12-31 16:00:00.000000000 -0800
+++ ruby-adsf-1.4.1+dfsg1/debian/patches/proxy-safe-tests.patch	2019-02-05 17:20:15.000000000 -0800
@@ -0,0 +1,19 @@
+Description: fix test suite to work when a proxy environment is configured
+ If http_proxy is set in the environment, test_non_local_interfaces fails
+ because it tries to connect via the proxy when it should be connecting to
+ a local server instead.  Simply remove this setting from the environment to
+ let the test pass.
+Author: Steve Langasek <steve.langasek at ubuntu.com>
+Index: ruby-adsf-1.4.1+dfsg1/adsf/test/test_server.rb
+--- ruby-adsf-1.4.1+dfsg1.orig/adsf/test/test_server.rb
++++ ruby-adsf-1.4.1+dfsg1/adsf/test/test_server.rb
+@@ -104,6 +104,7 @@
+   end
+   def test_non_local_interfaces
++    ENV.delete('http_proxy')
+     addresses = Socket.getifaddrs.map(&:addr).select(&:ipv4?).map(&:ip_address)
+     non_local_addresses = addresses - ['']
diff -Nru ruby-adsf-1.4.1+dfsg1/debian/patches/series ruby-adsf-1.4.1+dfsg1/debian/patches/series
--- ruby-adsf-1.4.1+dfsg1/debian/patches/series	2019-01-05 15:26:03.000000000 -0800
+++ ruby-adsf-1.4.1+dfsg1/debian/patches/series	2019-02-05 17:18:14.000000000 -0800
@@ -1,3 +1,4 @@

More information about the Pkg-ruby-extras-maintainers mailing list