Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[RHELDST-2414] integration tests should log response headers
Browse files Browse the repository at this point in the history
In exodus-lambda tests/integration, when a test fails because some attribute of
a response doesn't match an expected value, the test output contains all headers
on the response.
lebouillon committed Aug 11, 2020

Verified

This commit was signed with the committer’s verified signature.
oddgrd Oddbjørn Grødem
1 parent 33406c7 commit b776cf6
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/integration/test_exodus.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import json
import pytest
import requests

@@ -9,6 +10,7 @@ def test_exodus_basic(cdn_test_url):
)

r = requests.get(url)
print(json.dumps(dict(r.headers), indent=2))
assert r.status_code == 200
assert "cache-control" not in r.headers

@@ -19,6 +21,7 @@ def test_header_not_exist_file(cdn_test_url):
+ "/content/aus/rhel/server/6/6.5/x86_64/os/Packages/c/cpio-2.10-12.el6_5.x86_64.rpm_not_exist"
)
r = requests.get(url)
print(json.dumps(dict(r.headers), indent=2))
assert r.status_code == 404
assert "cache-control" not in r.headers

@@ -36,6 +39,7 @@ def test_header_not_exist_file(cdn_test_url):
def test_header_cache_control(cdn_test_url, testdata_path):
url = cdn_test_url + testdata_path
r = requests.get(url)
print(json.dumps(dict(r.headers), indent=2))
assert r.status_code == 200
assert r.headers["cache-control"] == "max-age=600"

@@ -44,6 +48,7 @@ def test_header_want_digest_GET(cdn_test_url):
headers = {"want-digest": "id-sha-256"}
url = cdn_test_url + "/content/dist/rhel/server/5/5.7/listing"
r = requests.get(url, headers=headers)
print(json.dumps(dict(r.headers), indent=2))
assert r.status_code == 200
assert (
r.headers["digest"]
@@ -55,6 +60,7 @@ def test_header_want_digest_HEAD(cdn_test_url):
headers = {"want-digest": "id-sha-256"}
url = cdn_test_url + "/content/dist/rhel/server/5/5.7/listing"
r = requests.head(url, headers=headers)
print(json.dumps(dict(r.headers), indent=2))
assert r.status_code == 200
assert (
r.headers["digest"]
@@ -86,6 +92,7 @@ def assert_content_type(url, content_type):
def test_content_type_header_GET(cdn_test_url, testdata_path):
url = cdn_test_url + testdata_path
r = requests.get(url)
print(json.dumps(dict(r.headers), indent=2))
assert r.status_code == 200
assert_content_type(url, r.headers["Content-Type"])

@@ -94,6 +101,7 @@ def test_content_type_header_GET(cdn_test_url, testdata_path):
def test_content_type_header_HEAD(cdn_test_url, testdata_path):
url = cdn_test_url + testdata_path
r = requests.head(url)
print(json.dumps(dict(r.headers), indent=2))
assert r.status_code == 200
assert_content_type(url, r.headers["Content-Type"])

@@ -112,6 +120,7 @@ def test_origin_path_alias(cdn_test_url, testdata_path):
headers = {"want-digest": "id-sha-256"}
url = cdn_test_url + testdata_path
r = requests.head(url, headers=headers)
print(json.dumps(dict(r.headers), indent=2))
assert r.status_code == 200
assert (
r.headers["digest"]
@@ -130,6 +139,7 @@ def test_rhui_path_alias_aus(cdn_test_url, testdata_path):
headers = {"want-digest": "id-sha-256"}
url = cdn_test_url + testdata_path
r = requests.head(url, headers=headers)
print(json.dumps(dict(r.headers), indent=2))
assert r.status_code == 200
assert (
r.headers["digest"]
@@ -148,6 +158,7 @@ def test_rhui_path_alias_rhel8(cdn_test_url, testdata_path):
headers = {"want-digest": "id-sha-256"}
url = cdn_test_url + testdata_path
r = requests.head(url, headers=headers)
print(json.dumps(dict(r.headers), indent=2))
assert r.status_code == 200
assert (
r.headers["digest"]

0 comments on commit b776cf6

Please sign in to comment.