Created
August 8, 2016 21:50
-
-
Save harlowja/363ac5a228a79abca0c7c90ab7a3dff3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/tests/unittests/test_datasource/test_gce.py b/tests/unittests/test_datasource/test_gce.py | |
index 6e62a4d..9bf98a9 100644 | |
--- a/tests/unittests/test_datasource/test_gce.py | |
+++ b/tests/unittests/test_datasource/test_gce.py | |
@@ -50,9 +50,9 @@ GCE_META_ENCODING = { | |
'instance/attributes/user-data-encoding': 'base64', | |
} | |
+BASE_URI = "http://metadata.google.internal/" | |
HEADERS = {'X-Google-Metadata-Request': 'True'} | |
-MD_URL_RE = re.compile( | |
- r'http://metadata.google.internal/computeMetadata/v1/.*') | |
+MD_URL_RE = re.compile(r'.*') | |
def _set_mock_metadata(gce_meta=None): | |
@@ -60,6 +60,9 @@ def _set_mock_metadata(gce_meta=None): | |
gce_meta = GCE_META | |
def _request_callback(method, uri, headers): | |
+ print("Got call for %s" % uri) | |
+ if not uri.startswith(BASE_URI): | |
+ return (404, headers, '') | |
url_path = urlparse(uri).path | |
if url_path.startswith('/computeMetadata/v1/'): | |
path = url_path.split('/computeMetadata/v1/')[1:][0] | |
(.venv) LMDV-JHARLOW:cloud-init jxharlow$ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment