Skip to content
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

test: add lightweight integration tests #102

Merged
merged 1 commit into from
Jan 1, 2024
Merged

test: add lightweight integration tests #102

merged 1 commit into from
Jan 1, 2024

Conversation

kormide
Copy link
Collaborator

@kormide kormide commented Dec 29, 2023

Until now I've been doing manual regression testing before each deployment which is a pain.

In this integration test setup, some services are real, some are faked: the webhook runs locally using Functions Framework, the same runtime used by Cloud Functions. Emails are sent to a real email service for testing called Ethereal. Google Secrets manager is stubbed, and so is the GitHub API itself.

Attempting to use the real GitHub feels too burdensome as it would require the SIG to maintain a set of orgs, repos, and users for testing which need to be kept in a pristine state across test runs. The API is well defined and easy enough to stub. By faking GitHub, the tests can be run locally or on CI and don't conflict with one another. All of the test "repos" are just local fixtures defined in this repo that get set up as fake "remote" repos on disk.

Some of the e2e tests are snapshot tests. Snapshot tests take a snapshot of all the BCR entry files created in a pull request and perform a diff test. This will make it easier to spot any regressions when changes cause a diff to fail.

Closes #84.

@kormide kormide force-pushed the e2e branch 14 times, most recently from 1efaa87 to d117fc0 Compare December 31, 2023 11:02
@kormide kormide changed the title test: add integration tests test: add lightweight integration tests Dec 31, 2023
@kormide kormide force-pushed the e2e branch 3 times, most recently from 279392b to 0861b4f Compare December 31, 2023 20:31
@kormide kormide marked this pull request as ready for review December 31, 2023 20:33
with:
version: ">= 363.0.0"
- run: yarn install --frozen-lockfile
- run: yarn e2e
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you are interested, I have a GitHub action that joins workflow jobs so that the branch protection rule can be configured to track a single check (usage example). Otherwise, you need to update the branch protection rules whenever a job is added/removed from the CI workflow.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neat. I added it.

Copy link
Member

@cgrindel cgrindel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like it was a heavy lift. Thank you.

@kormide kormide merged commit 58e5413 into main Jan 1, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add integration tests
2 participants