Reduce example count in integrations
What does this MR do and why?
spec/requests/api/integrations_spec.rb no longer runs its per-integration with_them table (the set up an integration, disable an integration, and get an integration settings shared examples) against both the /projects/:id/services and /projects/:id/integrations path prefixes. It now runs only against /projects/:id/integrations, cutting the file from 2,054 examples to 1,364.
The two prefixes are not independent behaviour. lib/api/integrations.rb (lines 49-63) loops over [':id/services', ':id/integrations'] and calls mount IntegratableOperations, with: { path: path } for both, behind the same authenticate! and authorize_admin_project_integrations before hooks. Inside lib/api/integrations/integratable_operations.rb, configuration[:path] is used only as the route prefix (lines 53, 86, 132, 177), so both prefixes execute identical handler bodies. Running the shared examples under both prefixes asserted the same behaviour twice.
Group-level integrations were never looped over services (groups only expose the integrations prefix), so that part of the spec is unchanged.
No coverage was removed: every integration's PUT, DELETE, and GET behaviour is still exercised once, under /projects/:id/integrations. The services prefix is still exercised for the list endpoint, slash command triggers, PUT for Mattermost, Microsoft Teams, Hangouts Chat, and Jira, GET for Jira and Pipelines Email, PUT/GET/DELETE for the GitLab for Slack app and GitLab for Jira Cloud app, and the granular token authorization examples for GET, PUT, and DELETE.
Spec Run Time Optimization Results
Before optimization:
- 2,054 examples
- Run time: 5m 32s
After optimization:
- 1,364 examples
- Run time: 3m 36s
Improvement:
- Example count reduced by: 33.6% (2,054 to 1,364)
- Run time reduced by: 1m 56s (116.3s)
Verified with:
bundle exec rspec spec/requests/api/integrations_spec.rb --dry-run # example count
bundle exec rspec spec/requests/api/integrations_spec.rb # full runBoth runs measured in the same local checkout for a fair comparison (same warm Rails boot, same DB/Gitaly state), swapping only this file's content between the pre- and post-optimization version.
bundle exec rubocop spec/requests/api/integrations_spec.rb reports no offenses.
Estimated CI Cost Savings
Using the same methodology as https://gitlab.com/gitlab-org/gitlab/-/merge_requests/248403:
116.3s saved per pipeline × $0.03/minute (large runners: 3x cost factor on $10/1,000 base minutes).
| Scenario | Pipelines/month | Time saved/month | Savings/year |
|---|---|---|---|
| Pessimistic | 15,000 | 484.6h | $10,467.00 |
| Moderate | 30,000 | 969.2h | $20,934.00 |
| Optimistic | 50,000 | 1,615.3h | $34,890.00 |
How to set up and validate locally
- Checkout this branch.
- Run
bundle exec rspec spec/requests/api/integrations_spec.rb. - Confirm 1,364 examples, 0 failures.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist.