Commit 42ece464 authored by Alper Akgun's avatar Alper Akgun

Merge branch 'disable-experiment-for-self-managed' into 'master'

Skip experimentation on self-managed

See merge request gitlab-org/gitlab!59362
parents 03637c50 ca1e4fb3
......@@ -41,9 +41,11 @@ module Namespaces
attr_reader :track, :interval, :in_product_marketing_email_records
def send_email_for_group(group)
if Gitlab.com?
experiment_enabled_for_group = experiment_enabled_for_group?(group)
experiment_add_group(group, experiment_enabled_for_group)
return unless experiment_enabled_for_group
end
users_for_group(group).each do |user|
if can_perform_action?(user, group)
......
......@@ -85,6 +85,11 @@ RSpec.describe Namespaces::InProductMarketingEmailsService, '#execute' do
end
describe 'experimentation' do
context 'when on dotcom' do
before do
allow(::Gitlab).to receive(:com?).and_return(true)
end
context 'when the experiment is enabled' do
it 'adds the group as an experiment subject in the experimental group' do
expect(Experiment).to receive(:add_group)
......@@ -106,6 +111,21 @@ RSpec.describe Namespaces::InProductMarketingEmailsService, '#execute' do
it { is_expected.not_to send_in_product_marketing_email }
end
context 'when not on dotcom' do
before do
allow(::Gitlab).to receive(:com?).and_return(false)
end
it 'does not add the group as an experiment subject' do
expect(Experiment).not_to receive(:add_group)
execute_service
end
it { is_expected.to send_in_product_marketing_email(user.id, group.id, :create, 0) }
end
end
end
context 'when the previous track action is not yet completed' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment