unit tests fail if https_proxy is set

Bug #1698222 reported by David Britton on 2017-06-15
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-boto (Ubuntu)
David Britton

Bug Description


Python-boto unit tests don't like *_proxy env vars set during execution. They do not reach out to the network, but different codepaths are taken when a proxy is detected, and the mocks get destroyed in that case.

A lot of failures of the form:

FAIL: test_head_bucket_other (tests.unit.s3.test_connection.TestHeadBucket)
Traceback (most recent call last):
  File "/tmp/autopkgtest.JJMfC2/autopkgtest_tmp/tests/unit/s3/test_connection.py", line 331, in test_head_bucket_other
    self.assertEqual(err.status, 405)
AssertionError: 403 != 405
-------------------- >> begin captured logging << --------------------
boto: DEBUG: Using access key provided by client.
boto: DEBUG: Using secret key provided by client.
boto: DEBUG: path=/
boto: DEBUG: auth_path=/you-broke-it/
boto: DEBUG: Method: HEAD
boto: DEBUG: Path: https://you-broke-it.s3.amazonaws.com/
boto: DEBUG: Data:
boto: DEBUG: Headers: {}
boto: DEBUG: Host: you-broke-it.s3.amazonaws.com
boto: DEBUG: Port: 443
boto: DEBUG: Params: {}
boto: DEBUG: establishing HTTPS connection: host=you-broke-it.s3.amazonaws.com, kwargs={'port': 443, 'timeout': 70}
boto: DEBUG: Proxy connection: CONNECT you-broke-it.s3.amazonaws.com:443 HTTP/1.0

boto: DEBUG: Token: None
boto: DEBUG: StringToSign:

Wed, 31 May 2017 16:49:14 GMT
boto: DEBUG: Signature:
AWS aws_access_key_id:Sy9u+sHaYcVAlgRndJo4iOD3mCY=
boto: DEBUG: Final headers: {'Date': 'Wed, 31 May 2017 16:49:14 GMT', 'Content-Length': '0', 'Authorization': u'AWS aws_access_key_id:Sy9u+sHaYcVAlgRndJo4iOD3mCY=', 'User-Agent': 'Boto/2.44.0 Python/2.7.13 Linux/4.10.0-21-generic'}
boto: DEBUG: Response headers: [('x-amz-id-2', 'R8k7qp47lyMqK4+O5bc5vLcFHbwHB64IifV0XEyEdJSNC7q1FGe3o/7LkUGjkR3eYBjDwyE8Oz8='), ('server', 'AmazonS3'), ('transfer-encoding', 'chunked'), ('x-amz-request-id', 'E92141CA21DA2EEC'), ('date', 'Wed, 31 May 2017 16:49:14 GMT'), ('content-type', 'application/xml')]
--------------------- >> end captured logging << ---------------------

Changed in python-boto (Ubuntu):
importance: Undecided → High
assignee: nobody → David Britton (davidpbritton)
status: New → In Progress
summary: - proposed-migration autopkgtest failure for boto 2.44.0
+ unit tests fail if https_proxy is set
Changed in boto:
status: Unknown → New
David Britton (davidpbritton) wrote :

The attachment "1698222.debdiff" seems to be a debdiff. The ubuntu-sponsors team has been subscribed to the bug report so that they can review and hopefully sponsor the debdiff. If the attachment isn't a patch, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are member of the ~ubuntu-sponsors, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issue please contact him.]

tags: added: patch
Brian Murray (brian-murray) wrote :

Thanks for working on this, there is a typo in the changelog entry of the word "running" that might be worth fixing.

David Britton (davidpbritton) wrote :

Brian -- thanks! I'm getting a sponser on the git merge request I put in over here:


Robie Basak (racb) wrote :

David fixed the typo before submitting the MP, and I've sponsored using the git tooling. Thanks!

We're deliberately leaving the bug open as the upload is just a workaround; the real fix would be to stop the boto testsuite breaking when the env vars are set, which should probably be fixed upstream.

Changed in python-boto (Ubuntu):
status: In Progress → Fix Committed
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

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