-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add lightweight integration tests
- Loading branch information
Showing
70 changed files
with
3,480 additions
and
402 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,30 @@ | ||
# e2e tests | ||
|
||
Run with | ||
|
||
```bash | ||
yarn e2e | ||
``` | ||
|
||
Requires `gcloud` application default credentials. The e2e tests stub google cloud APIs and | ||
don't actually use the credentials, however the file `~/.config/gcloud/application_default_credentials.json` | ||
must still exist and be valid for the `@google-cloud` node clients to work properly. | ||
|
||
```bash | ||
gcloud auth application-default login | ||
``` | ||
|
||
## Test strategy | ||
|
||
The end-to-end tests use a combination of fake and real services. | ||
|
||
The full webhook is run locally using [Functions Framework](https://cloud.google.com/functions/docs/functions-framework), which is the same runtime that Google Cloud Functions uses. | ||
|
||
Email notifications are sent to an email test service called [Ethereal](https://ethereal.email/), which our email client `nodemailer` natively supports. | ||
|
||
GitHub and Google Secrets Manager are stubbed. It may seem counterintuitive to stub GitHub when testing a GitHub app, however, using the real service presents several challenges: | ||
|
||
- The Bazel SIG would need to maintain a fleet of other GitHub organizations, repositories, and users for testing, creating additional maintenance burden. | ||
- Test repositories need to be kept in a pristine state across test runs. Simultaneous test runs could cause conflicts in test results and require that only one individual runs tests at a time. | ||
|
||
In the current state, tests can be run locally, simultaneously with other developers with no resource contention. The GitHub API is well-defined and easy enough to stub with test data. |
Oops, something went wrong.