Skip to content

Commit

Permalink
Record HTTP requests/response communication in integration tests (#521)
Browse files Browse the repository at this point in the history
  • Loading branch information
jirikuncar authored Feb 4, 2020
1 parent 059fcb2 commit 331a79c
Show file tree
Hide file tree
Showing 96 changed files with 22,019 additions and 438 deletions.
4 changes: 2 additions & 2 deletions .azure-pipelines/integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ jobs:
versionSpec: "3.7"
- script: pip install tox
displayName: Install tox
- script: tox -e integration
- script: tox -e integration -- --vcr-record=all
displayName: Run integration tests
env:
DD_TEST_CLIENT_API_KEY: $(datadogAPIKey)
DD_TEST_CLIENT_APP_KEY: $(datadogAPPKey)
DD_TEST_CLIENT_USER: $(datadogTestUser)
- script: tox -e integration-admin
- script: tox -e integration-admin -- --vcr-record=all
displayName: Run admin integration tests
env:
DD_TEST_CLIENT_API_KEY: $(datadogAPIKey)
Expand Down
4 changes: 4 additions & 0 deletions .azure-pipelines/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,7 @@ jobs:
displayName: Install tox
- script: tox
displayName: Run unit tests
- script: tox -e integration -- --vcr-record=none
displayName: Run integration tests on cassettes
- script: tox -e integration-admin -- --vcr-record=none
displayName: Run admin integration tests on cassettes
3 changes: 2 additions & 1 deletion datadog/api/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class APIClient(object):
_max_timeouts = _max_timeouts
_backoff_timestamp = None
_timeout_counter = 0
_sort_keys = False

# Plugged HTTP client
_http_client = None
Expand Down Expand Up @@ -145,7 +146,7 @@ def submit(cls, method, path, api_version=None, body=None, attach_host_name=Fals

# Process the body, if necessary
if isinstance(body, dict):
body = json.dumps(body)
body = json.dumps(body, sort_keys=cls._sort_keys)
headers['Content-Type'] = 'application/json'

if compress_payload:
Expand Down
1 change: 1 addition & 0 deletions datadog/dogshell/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def print_err(msg):
print(msg + '\n', file=sys.stderr)
else:
sys.stderr.write(msg + '\n')
sys.stderr.flush()


def report_errors(res):
Expand Down
Loading

0 comments on commit 331a79c

Please sign in to comment.