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

Commit

Permalink
Fiddle with GCE timeouts (again).
Browse files Browse the repository at this point in the history
  • Loading branch information
craigcitro committed Jan 7, 2015
1 parent 3b3d897 commit bf9d46e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion oauth2client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -938,7 +938,7 @@ def _detect_gce_environment(urlopen=None):
# the metadata resolution was particularly slow. The latter case is
# "unlikely".
try:
response = urlopen('http://metadata.google.internal/', timeout=1)
response = urlopen('http://169.254.169.254/', timeout=0.1)
return any('Metadata-Flavor: Google' in header
for header in response.info().headers)
except socket.timeout:
Expand Down
4 changes: 2 additions & 2 deletions tests/test_oauth2client.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ def test_get_environment_gce_production(self):
autospec=True) as urlopen:
self.assertEqual('GCE_PRODUCTION', _get_environment())
urlopen.assert_called_once_with(
'http://metadata.google.internal/', timeout=1)
'http://169.254.169.254/', timeout=0.1)

def test_get_environment_unknown(self):
os.environ['SERVER_SOFTWARE'] = ''
Expand All @@ -221,7 +221,7 @@ def test_get_environment_unknown(self):
autospec=True) as urlopen:
self.assertEqual(DEFAULT_ENV_NAME, _get_environment())
urlopen.assert_called_once_with(
'http://metadata.google.internal/', timeout=1)
'http://169.254.169.254/', timeout=0.1)

def test_get_environment_variable_file(self):
environment_variable_file = datafile(
Expand Down

0 comments on commit bf9d46e

Please sign in to comment.