autopkgtest failure (proxy-related)

Bug #1942491 reported by Sergio Durigan Junior
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
golang-github-go-resty-resty (Ubuntu)
Fix Released
High
Sergio Durigan Junior

Bug Description

The current version of golang-github-go-resty-resty (2.4.0) fails on autopkgtest due to proxy issues.

https://autopkgtest.ubuntu.com/results/autopkgtest-impish/impish/amd64/g/golang-github-go-resty-resty/20210817_204016_3acf4@/log.gz

...
=== RUN TestSRV
    resty_test.go:612: Expected [200], got [503]
--- FAIL: TestSRV (59.30s)
...
=== RUN TestTraceInfoOnTimeout
    resty_test.go:594: [<nil>] was expected to be non-nil
    resty_test.go:612: Expected [true], got [false]
    resty_test.go:612: Expected [true], got [false]
    resty_test.go:612: Expected [true], got [false]
    resty_test.go:612: Expected [true], got [false]
--- FAIL: TestTraceInfoOnTimeout (0.02s)
...
FAIL
FAIL github.com/go-resty/resty 235.226s
FAIL
dh_auto_test: error: cd _build && go test -vet=off -v -p 1 github.com/go-resty/resty returned exit code 1
make: *** [debian/rules:6: build] Error 25
autopkgtest [20:40:01]: test dh-golang-autopkgtest: -----------------------]
autopkgtest [20:40:02]: test dh-golang-autopkgtest: - - - - - - - - - - results - - - - - - - - - -
dh-golang-autopkgtest FAIL non-zero exit status 2
autopkgtest [20:40:02]: @@@@@@@@@@@@@@@@@@@@ summary
dh-golang-autopkgtest FAIL non-zero exit status 2

The two tests mentioned above need internet to work, and misbehave when $http_proxy is set.

Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

So, after investigating this bug a bit, I was able to reproduce it locally (thanks to https://wiki.ubuntu.com/ProposedMigration#I.27m_seeing_a_squid_proxy.3F__My_tests_behave_differently_there.21), and was also able to confirm that when $http_proxy is unset, everything passes.

My first attempt at a real fix for this problem was to edit the two test functions (TestSRV and TestTraceInfoOnTimeout, both from request_test.go), and add the following snippet at the top of each one:

os.Unsetenv("http_proxy")

For some very strange reason, this doesn't work. It should, but it doesn't. I still can't believe it...

Anyway, the next best solution was to override dh_auto_test and unset $http_proxy there (thanks, Lucas), given that dh_golang_autopkgtest will invoke it anyway. This works.

I'm attaching the debdiff that fixes the problem.

There's a PPA with the proposed change here:

https://launchpad.net/~sergiodj/+archive/ubuntu/golang-github-go-resty-resty-autopkgtest-fix

autopkgtest is now passing:

https://autopkgtest.ubuntu.com/results/autopkgtest-impish-sergiodj-golang-github-go-resty-resty-autopkgtest-fix/?format=plain

tags: added: patch
Revision history for this message
Lucas Kanashiro (lucaskanashiro) wrote :

Thanks for the patch Sergio! As we discussed I believe this is a reasonable solution to unblock this package (might not be the ideal). The packaging changes look good, +1.

Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

Thanks for the review, Lucas.

Uploaded:

$ dput golang-github-go-resty-resty_2.4.0-1ubuntu1_source.changes
Trying to upload package to ubuntu
Checking signature on .changes
gpg: /home/sergio/work/golang-github-go-resty-resty/golang-github-go-resty-resty_2.4.0-1ubuntu1_source.changes: Valid signature from 106DA1C8C3CBBF14
Checking signature on .dsc
gpg: /home/sergio/work/golang-github-go-resty-resty/golang-github-go-resty-resty_2.4.0-1ubuntu1.dsc: Valid signature from 106DA1C8C3CBBF14
Uploading to ubuntu (via ftp to upload.ubuntu.com):
  Uploading golang-github-go-resty-resty_2.4.0-1ubuntu1.dsc: done.
  Uploading golang-github-go-resty-resty_2.4.0-1ubuntu1.debian.tar.xz: done.
  Uploading golang-github-go-resty-resty_2.4.0-1ubuntu1_source.buildinfo: done.
  Uploading golang-github-go-resty-resty_2.4.0-1ubuntu1_source.changes: done.
Successfully uploaded packages.

Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

For the sake of completeness, I was able to determine the right place to unset the $http_proxy variable inside the project so that it also works. One should place an os.Unsetenv call as the first instruction of the following function:

func dc() *Client

which can be found inside the resty_test.go file.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package golang-github-go-resty-resty - 2.4.0-1ubuntu1

---------------
golang-github-go-resty-resty (2.4.0-1ubuntu1) impish; urgency=medium

  * d/rules: Override dh_auto_test and unset $http_proxy before invoking
    the target. (LP: #1942491)

 -- Sergio Durigan Junior <email address hidden> Thu, 02 Sep 2021 23:12:27 -0400

Changed in golang-github-go-resty-resty (Ubuntu):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.