Skip to content

Commit

Permalink
More descriptive smoke test.
Browse files Browse the repository at this point in the history
  • Loading branch information
augustjohnson committed Oct 21, 2024
1 parent beac15b commit 8a9e38c
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions scripts/smoke_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,30 @@ def main():
print("paths for 200 response codes. It is intended to be run post-deploy.")

# Check the root url.
assert requests.get(args.url).status_code == 200

results = []
results.append(check_for_OK(args.url))
# Check the /v1 paths
assert requests.get(args.url+'/v1/').status_code == 200
results.append(check_for_OK(args.url+'/v1/'))
v1_endpoints = requests.get(args.url+'/v1/?format=json').json()
for value in v1_endpoints.values():
assert requests.get(value).status_code == 200
results.append(check_for_OK(value))

# Checking the /v2 paths
assert requests.get(args.url+'/v2/').status_code == 200
results.append(check_for_OK(args.url+'/v2/'))
v2_endpoints = requests.get(args.url+'/v2/?format=json').json()
for value in v2_endpoints.values():
assert requests.get(value).status_code == 200
results.append(check_for_OK(value))

for result in results:
assert(result,"Path was not OK.")

def check_for_OK(url):
r = requests.get(url)
if r.status_code != 200:
print("Got status {} on {}".format(r.status_code,url))
return False
return True


if __name__ == '__main__':
main()

0 comments on commit 8a9e38c

Please sign in to comment.