-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #519 from open5e/228-consider-designing-a-post-dep…
…loyment-smoke-test 228 consider designing a post deployment smoke test
- Loading branch information
Showing
2 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import argparse | ||
import requests | ||
# This is the smoke test. | ||
|
||
# Inputs: url | ||
|
||
# Outputs: Whether any of the basic pages end up in a 500 error. | ||
|
||
# Pass if not | ||
|
||
def main(): | ||
parser = argparse.ArgumentParser() | ||
|
||
parser.add_argument('-u', '--url', | ||
help='URL of the site to check.') | ||
|
||
args = parser.parse_args() | ||
print("For a given input url, this goes and checks the root, and the /v1 and /v2") | ||
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 | ||
|
||
# Check the /v1 paths | ||
assert requests.get(args.url+'/v1/').status_code == 200 | ||
v1_endpoints = requests.get(args.url+'/v1/?format=json').json() | ||
for value in v1_endpoints.values(): | ||
assert requests.get(value).status_code == 200 | ||
|
||
# Checking the /v2 paths | ||
assert requests.get(args.url+'/v2/').status_code == 200 | ||
v2_endpoints = requests.get(args.url+'/v2/?format=json').json() | ||
for value in v2_endpoints.values(): | ||
assert requests.get(value).status_code == 200 | ||
|
||
if __name__ == '__main__': | ||
main() |