-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
local smoke tests #1923
Merged
Merged
local smoke tests #1923
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
b1bece0
local smoke tests
sastels 0e7d23c
tweak a bit
sastels c864fec
tweak
sastels 79c9bf5
format
sastels a272bce
Merge branch 'main' into local-smoke-test
sastels f0094da
Merge branch 'main' into local-smoke-test
sastels 03d4ead
Merge branch 'main' into local-smoke-test
sastels e841d6f
add README
sastels File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,14 @@ | ||
# Smoke Tests | ||
|
||
This repository contains a set of smoke tests for our application. Smoke testing, also known as "Build Verification Testing", is a type of software testing that comprises of a non-exhaustive set of tests that aim at ensuring that the most important functions work. The phrase 'smoke testing' comes from the hardware testing, where you plug in a new piece of hardware and turn it on for the first time. If it starts smoking, you know you have a problem. | ||
|
||
## Getting Started | ||
|
||
These smoke tests are designed to run in the api devcontainer. | ||
|
||
in the root of the repo create `.env` files for the environments you with to smoke test, for example `.env_smoke_local`, `.env_smoke_staging`, and `.env_smoke_prod`. For required values see the [.env.example](.env.example) file). | ||
|
||
## Running the tests | ||
|
||
in the devcontainer run the aliases `smoke-local`, `smoke-staging`, or `smoke-prod` to run the tests. | ||
|
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
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
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 |
---|---|---|
@@ -1,19 +1,28 @@ | ||
import argparse | ||
|
||
from smoke.common import Attachment_type, Config, Notification_type # type: ignore | ||
from smoke.test_admin_csv import test_admin_csv # type: ignore | ||
from smoke.test_admin_one_off import test_admin_one_off # type: ignore | ||
from smoke.test_api_bulk import test_api_bulk # type: ignore | ||
from smoke.test_api_one_off import test_api_one_off # type: ignore | ||
|
||
if __name__ == "__main__": | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument("-l", "--local", default=False, action='store_true', help="run locally, do not check for delivery success (default false)") | ||
parser.add_argument("--nofiles", default=False, action='store_true', help="do not send files (default false)") | ||
args = parser.parse_args() | ||
|
||
print("API Smoke test\n") | ||
for key in ["API_HOST_NAME", "SERVICE_ID", "EMAIL_TEMPLATE_ID", "SMS_TEMPLATE_ID", "EMAIL_TO", "SMS_TO"]: | ||
print(f"{key:>17}: {Config.__dict__[key]}") | ||
print("") | ||
|
||
for notification_type in [Notification_type.EMAIL, Notification_type.SMS]: | ||
test_admin_one_off(notification_type) | ||
test_admin_csv(notification_type) | ||
test_api_one_off(notification_type) | ||
test_api_bulk(notification_type) | ||
test_api_one_off(Notification_type.EMAIL, Attachment_type.ATTACHED) | ||
test_api_one_off(Notification_type.EMAIL, Attachment_type.LINK) | ||
test_admin_one_off(notification_type, local=args.local) | ||
test_admin_csv(notification_type, local=args.local) | ||
test_api_one_off(notification_type, local=args.local) | ||
test_api_bulk(notification_type, local=args.local) | ||
|
||
if not args.nofiles: | ||
test_api_one_off(Notification_type.EMAIL, attachment_type=Attachment_type.ATTACHED, local=args.local) | ||
test_api_one_off(Notification_type.EMAIL, attachment_type=Attachment_type.LINK, local=args.local) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is some nice automation here regarding running the smoke tests in the different environments. Should we add some sort of docs so devs are aware they can do this? Maybe a bit about how/where to store the environment-specific env files?
Maybe its obvious, but it might also be nice to let people know they will need to create a service, some templates, and an API key in order to run them locally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes! good idea - I've added a README.