diff --git a/ee/app/services/registrations/base_namespace_create_service.rb b/ee/app/services/registrations/base_namespace_create_service.rb index ec16b500898ed5398b3c8a0f61e5a3869d95239f..17d5ce20a2d68df8537f6e2b5b09398a47c577bb 100644 --- a/ee/app/services/registrations/base_namespace_create_service.rb +++ b/ee/app/services/registrations/base_namespace_create_service.rb @@ -19,6 +19,8 @@ def after_successful_group_creation(group_track_action:) Gitlab::Tracking.event(self.class.name, group_track_action, namespace: group, user: user) ::Onboarding::Progress.onboard(group) + experiment(:lightweight_trial_registration_redesign, actor: user).track(:assignment, namespace: group) + apply_trial if onboarding_user_status.apply_trial? end diff --git a/ee/spec/services/registrations/standard_namespace_create_service_spec.rb b/ee/spec/services/registrations/standard_namespace_create_service_spec.rb index e2353d31889353e6d785d3b0e0d8238b67f01041..f42a56655da13d3e5ee3654c4c9ee4875bccaab8 100644 --- a/ee/spec/services/registrations/standard_namespace_create_service_spec.rb +++ b/ee/spec/services/registrations/standard_namespace_create_service_spec.rb @@ -83,6 +83,26 @@ ) end + context 'with experiment lightweight_trial_registration_redesign' do + let(:experiment) { instance_double(ApplicationExperiment) } + + before do + allow_next_instance_of(described_class) do |service| + allow(service).to receive(:experiment).with(:lightweight_trial_registration_redesign, + actor: user).and_return(experiment) + end + end + + it 'tracks experiment assignment' do + allow_next_instance_of(::Projects::CreateService) do |service| + allow(service).to receive(:after_create_actions) + end + + expect(experiment).to receive(:track).with(:assignment, namespace: an_instance_of(Group)) + expect(execute).to be_success + end + end + it 'enqueues a create event worker' do expect(Groups::CreateEventWorker).to receive(:perform_async).with(anything, user.id, 'created')