Refactor specific ProvisionCodeSuggestionsService to general ProvisionAddOnService
What does this MR do and why?
In preparation for being able to provision the Duo Enterprise add-on, we refactor the GitlabSubscription::AddOnPurchases::SelfManaged::ProvisionCodeSuggestionsService to GitlabSubscription::AddOnPurchases::SelfManaged::ProvisionAddOnService which will then be able to provision the code_suggestion and the new duo_enterprise add-on. An example of future usage could be:
license.duo_add_ons_included.each do |add_on|
GitlabSubscription::AddOnPurchases::SelfManaged::ProvisionAddOnService.for_add_on(add_on).execute
end
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
How to set up and validate locally
Requirements
- Local GitLab and CDot instance
- Experience purchasing licenses at CDot
Testing
This refactoring shouldn't change any behavior. To test that the provision service for the code suggestion add-on is still working, there are three codes paths to test:
- Start your GitLab instance with
export GITLAB_SIMULATE_SAAS=0 - Purchase a self-managed ultimate license at your local CDot installation and add it to your GitLab instance.
- First path to test:
- Go to http://localhost:3000/admin/code_suggestions and check the amount of GitLab Duo Pro seats you purchased
- Go to http://localhost:5000/ and purchase another GitLab Duo Pro seat for the currently activated subscription/license.
- Go to http://localhost:3000/admin/subscription and click on the refresh button next to
Last sync - Check on http://localhost:3000/admin/code_suggestions that a CTA for purchasing Duo Pro seats gets displayed or that a 404 gets raised
- Second path to test:
- Go to http://localhost:3000/admin/code_suggestions and check the amount of GitLab Duo Pro seats you purchased
- Go to http://localhost:3000/admin/subscription and click on
Remove license - Check on http://localhost:3000/admin/code_suggestions that the number of GitLab Duo Pro has gone to zero
- Third path to test:
- Add Duo Pro seats to your subscription at CDot.
- Remove all existing licenses at your GitLab instances.
- Go to http://localhost:3000/admin/subscription and paste your purchased license activation code and click
Activate - Check on http://localhost:3000/admin/code_suggestions that the Duo Pro seats got synchronized and the site is not raising a 404
Related to #470073
Edited by Lukas Wanko