Commit e4bd141e authored by Kamil Trzciński's avatar Kamil Trzciński

Merge branch '290724-experiments-using-flipper-will-require-feature-flag-yml-files' into 'master'

Ensure experiment feature flag survival using YML files & persist_used! [RUN ALL RSPEC]

See merge request gitlab-org/gitlab!49244
parents 9af3efab b92b4acf
---
name: ci_notification_dot_experiment_percentage
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/27626
rollout_issue_url: https://gitlab.com/gitlab-org/growth/team-tasks/-/issues/101
milestone: '12.10'
type: experiment
group: group::expansion
default_enabled: false
---
name: contact_sales_btn_in_app_experiment_percentage
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/38508
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/238207
milestone: '13.3'
type: experiment
group: group::conversion
default_enabled: true
---
name: customize_homepage_experiment_percentage
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/39348
rollout_issue_url: https://gitlab.com/gitlab-org/growth/team-tasks/-/issues/187
milestone: '13.4'
type: experiment
group: group::expansion
default_enabled: false
---
name: default_to_issues_board_experiment_percentage
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/43939
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/268298
milestone: '13.5'
type: experiment
group: group::conversion
default_enabled: true
---
name: group_only_trials_experiment_percentage
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/40564
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/258629
milestone: '13.5'
type: experiment
group: group::conversion
default_enabled: false
---
name: invite_members_empty_group_version_a_experiment_percentage
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/45689
rollout_issue_url: https://gitlab.com/gitlab-org/growth/team-tasks/-/issues/280
milestone: '13.6'
type: experiment
group: group::expansion
default_enabled: false
---
name: invite_members_empty_project_version_a_experiment_percentage
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/49588
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/262014
milestone: '13.7'
type: experiment
group: group::expansion
default_enabled: false
---
name: invite_members_version_a_experiment_percentage
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/45689/
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/219239
milestone: '13.6'
type: experiment
group: group::expansion
default_enabled: false
---
name: invite_members_version_b_experiment_percentage
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/43900
rollout_issue_url: https://gitlab.com/gitlab-org/growth/team-tasks/-/issues/214
milestone: '13.5'
type: experiment
group: group::expansion
default_enabled: false
---
name: jobs_empty_state_experiment_percentage
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/48686
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/281054
milestone: '13.7'
type: experiment
group: group::activation
default_enabled: false
---
name: onboarding_issues_experiment_percentage
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/31656/
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/224515
milestone: '13.0'
type: experiment
group: group::conversion
default_enabled: true
---
name: remove_known_trial_form_fields_experiment_percentage
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/45634/
rollout_issue_url: https://gitlab.com/gitlab-org/growth/team-tasks/-/issues/281
milestone: '13.7'
type: experiment
group: group::conversion
default_enabled: false
---
name: trial_registration_with_social_signin_experiment_percentage
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/45633
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/262853
milestone: '13.7'
type: experiment
group: group::conversion
default_enabled: false
---
name: trimmed_skip_trial_copy_experiment_percentage
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/48110
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/284956
milestone: '13.7'
type: experiment
group: group::conversion
default_enabled: false
---
name: upgrade_link_in_user_menu_a_experiment_percentage
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/29428
rollout_issue_url: https://gitlab.com/gitlab-org/growth/team-tasks/-/issues/126
milestone: '13.0'
type: experiment
group: group::expansion
default_enabled: false
......@@ -57,6 +57,8 @@ class Feature
default_enabled: false,
example: <<-EOS
experiment(:my_experiment, project: project, actor: current_user) { ...variant code... }
# or
Gitlab::Experimentation.in_experiment_group?(:my_experiment, subject: current_user)
EOS
}
}.freeze
......
......@@ -3,6 +3,8 @@
module Gitlab
module Experimentation
class Experiment
FEATURE_FLAG_SUFFIX = "_experiment_percentage"
attr_reader :key, :tracking_category, :use_backwards_compatible_subject_index
def initialize(key, **params)
......@@ -10,7 +12,7 @@ module Gitlab
@tracking_category = params[:tracking_category]
@use_backwards_compatible_subject_index = params[:use_backwards_compatible_subject_index]
@experiment_percentage = Feature.get(:"#{key}_experiment_percentage").percentage_of_time_value # rubocop:disable Gitlab/AvoidFeatureGet
@experiment_percentage = Feature.get(:"#{key}#{FEATURE_FLAG_SUFFIX}").percentage_of_time_value # rubocop:disable Gitlab/AvoidFeatureGet
end
def active?
......
# frozen_string_literal: true
module StubExperiments
SUFFIX = Gitlab::Experimentation::Experiment::FEATURE_FLAG_SUFFIX
# Stub Experiment with `key: true/false`
#
# @param [Hash] experiment where key is feature name and value is boolean whether active or not.
......@@ -11,6 +13,7 @@ module StubExperiments
allow(Gitlab::Experimentation).to receive(:active?).and_call_original
experiments.each do |experiment_key, enabled|
Feature.persist_used!("#{experiment_key}#{SUFFIX}")
allow(Gitlab::Experimentation).to receive(:active?).with(experiment_key) { enabled }
end
end
......@@ -25,6 +28,7 @@ module StubExperiments
allow(Gitlab::Experimentation).to receive(:in_experiment_group?).and_call_original
experiments.each do |experiment_key, enabled|
Feature.persist_used!("#{experiment_key}#{SUFFIX}")
allow(Gitlab::Experimentation).to receive(:in_experiment_group?).with(experiment_key, anything) { enabled }
end
end
......
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