mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 18:51:59 +00:00
This just exposes the matched path ranges on our FileMatch GraphQL object. We already had this information, just did not expose it via the API. |
||
|---|---|---|
| .. | ||
| access_token_test.go | ||
| bitbucket_projects_perms_sync_test.go | ||
| BUILD.bazel | ||
| code_insights_test.go | ||
| CODENOTIFY | ||
| compute_test.go | ||
| external_service_test.go | ||
| feature_flag_test.go | ||
| main_test.go | ||
| organization_test.go | ||
| README.md | ||
| repository_test.go | ||
| search_aggregations_test.go | ||
| search_test.go | ||
| site_config_test.go | ||
| sub_repo_permissions_test.go | ||
| symbol_search_test.go | ||
GraphQL integration tests
This directory contains API-based integration tests in the form of standard Go tests. It is called gqltest since most of our API is GraphQL. However, the test suite has been extended to test other endpoints such as streaming search.
To run these tests against a local change, use sg to spin up a job in Buildkite:
sg ci bazel test //testing:backend_integration_test
You can also push a branch to run integration tests, since they're always run by CI on branch pushes.
How to run tests locally
You can also run integration tests locally. Note: this is not a well-trodden path, and it's recommended to use CI instead.
Steps:
- Request "CI Secrets Read Access" in Entitle
- Run
sg test bazel-backend-integration
How to add new tests
Adding new tests to this test suite is as easy as adding a Go test, here are some general rules to follow:
- Use
gqltest-prefix for entity name, and be as specific as possible for easier debugging, e.g.gqltest-org-user-1. - Restore the previous state regardless of failures, including:
- Delete new users created during the test.
- Delete external services created during the test.
- Although, sometimes you would not want to delete an entity so you could login and inspect the failure state.