Skip to content
This repository has been archived by the owner on Nov 5, 2019. It is now read-only.

When refreshing credentials with an stream body, rewind the stream be… #174

Merged

Conversation

thobrla
Copy link
Contributor

@thobrla thobrla commented May 12, 2015

…fore re-sending the original request.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.08%) to 65.14% when pulling f79e2d3 on thobrla:body-stream-idem into d93ed1e on google:master.

@@ -554,6 +554,11 @@ def new_request(uri, method='GET', body=None, headers=None,
else:
headers['user-agent'] = self.user_agent

body_stream_position = None
if all(hasattr(body, stream_prop) for stream_prop in ('read',

This comment was marked as spam.

@nathanielmanistaatgoogle
Copy link
Contributor

Please update the commit log message to conform to http://chris.beams.io/posts/git-commit/#seven-rules.

@thobrla thobrla force-pushed the body-stream-idem branch 3 times, most recently from 8cc4dfc to c4104af Compare May 12, 2015 22:51
@thobrla
Copy link
Contributor Author

thobrla commented May 12, 2015

It looks like the most recent round is failing because system tests at https://github.com/google/oauth2client/blob/master/scripts/run_system_tests.py#L99 expect environment variables set here https://github.com/google/oauth2client/blob/master/scripts/run_system_tests.sh#L21 - perhaps if those environment variables aren't set, that script shouldn't run?

I think the failures are unrelated to my commit.

@nathanielmanistaatgoogle
Copy link
Contributor

@dhermes, please take a look at the system test failures in this pull request.

@dhermes
Copy link
Contributor

dhermes commented May 12, 2015

Re-run the build and see if it fails again. (I don't have privileges to re-start on travis-ci.org)


No idea why

  if [[ "${TRAVIS_BRANCH}" == "master" ]] && \
         [[ "${TRAVIS_PULL_REQUEST}" == "false" ]]; then

would have fallen through. Let's hope it's an intermittent failure. (I've never seen this in 1500+ builds in gcloud-python.)

Or maybe it was caused by "${TRAVIS}" == "true" being set (also a strange failure)?

@craigcitro
Copy link
Contributor

i agree with travis that the travis failures are unrelated to travis's code. (sorry, couldn't resist.)

i tried re-running the tests, to no avail. let's merge this and move the "integration tests are failing" to a new issue?

@thobrla
Copy link
Contributor Author

thobrla commented May 13, 2015

Tests pass with int or strings; regardless, I'll push the string-conversion change.

When refreshing credentials, the original request is re-sent
after the credentials are refreshed.

If the body of that request is a stream, the stream contents
are read in the initial request, and the stream must be rewound
before the request is re-sent. Otherwise, the original message
body will be different (because stream data was skipped).
@dhermes
Copy link
Contributor

dhermes commented May 13, 2015

@craigcitro Can you check which environment variables are set in the Travis settings:
https://travis-ci.org/google/oauth2client/settings/env_vars

I can't see because I am not an admin. This still doesn't explain why

  if [[ "${TRAVIS_BRANCH}" == "master" ]] && \
         [[ "${TRAVIS_PULL_REQUEST}" == "false" ]]; then

falls through.

@craigcitro
Copy link
Contributor

@dhermes those vars seem to be set (at least, there are a handful of relevant-looking names set on that page).

let's maybe throw a handful of debugging info into the script (just print some travis-related env vars?) and start a new issue on that one?

@craigcitro
Copy link
Contributor

@thobrla can you also file an issue to follow up on whether tests should use string or int for status codes? (it'd be fantastic if we could just clean it all up to use the symbolic names in httplib.)

@dhermes
Copy link
Contributor

dhermes commented May 13, 2015

UPDATE: Our builds have also started failing (after 1500+ builds never failing): https://travis-ci.org/GoogleCloudPlatform/gcloud-python/builds/62434732

It seems the Travis-CI people have changed something (either on purpose or not).

I'm going to debug in gcloud-python (where I am an admin) and report back. Do you guys want to create a tracking bug for this?

@nathanielmanistaatgoogle
Copy link
Contributor

@dhermes yes please let's move the why-are-tests-failing discussion out of this unrelated pull request thread. :-)

@craigcitro
Copy link
Contributor

@nathanielmanistaatgoogle can you merge if you're good with this PR?

@nathanielmanistaatgoogle
Copy link
Contributor

Oh right, this whole discussion was actually about making a change... :-P

nathanielmanistaatgoogle added a commit that referenced this pull request May 13, 2015
Rewind original stream body when refreshing.
@nathanielmanistaatgoogle nathanielmanistaatgoogle merged commit 219cf26 into googleapis:master May 13, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants