Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-03-13 03:09:16 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-03-13 03:09:16 +0300
commitaa64fed495bb15fd838be8ef17128988f78e240c (patch)
treeaae87ffa3fa19ffc1abffc518b5bd694b2cab8b4 /app/experiments/application_experiment.rb
parent963c6277b29b205c38c24fa907dda933097fbd25 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/experiments/application_experiment.rb')
-rw-r--r--app/experiments/application_experiment.rb31
1 files changed, 2 insertions, 29 deletions
diff --git a/app/experiments/application_experiment.rb b/app/experiments/application_experiment.rb
index 019e74bcd48..8a3ced88c5a 100644
--- a/app/experiments/application_experiment.rb
+++ b/app/experiments/application_experiment.rb
@@ -35,40 +35,13 @@ class ApplicationExperiment < Gitlab::Experiment # rubocop:disable Gitlab/Namesp
@excluded = true
end
- def rollout_strategy
- # no-op override in inherited class as desired
- end
-
- def variants
- # override as desired in inherited class with all variants + control
- # %i[variant1 variant2 control]
- #
- # this will make sure we supply variants as these go together - rollout_strategy of :round_robin must have variants
- raise NotImplementedError, "Inheriting class must supply variants as an array if :round_robin strategy is used" if rollout_strategy == :round_robin
- end
-
private
def feature_flag_name
name.tr('/', '_')
end
- def resolve_variant_name
- case rollout_strategy
- when :round_robin
- round_robin_rollout
- else
- percentage_rollout
- end
- end
-
- def round_robin_rollout
- Strategy::RoundRobin.new(feature_flag_name, variants).execute
- end
-
- def percentage_rollout
- return variant_names.first if Feature.enabled?(feature_flag_name, self, type: :experiment, default_enabled: :yaml)
-
- nil # Returning nil vs. :control is important for not caching and rollouts.
+ def experiment_group?
+ Feature.enabled?(feature_flag_name, self, type: :experiment, default_enabled: :yaml)
end
end