Protect group overview usage ping w/ feature flag

user_preferences key is includes into system usage
data only if group_overview_security_dashboard
feature flag is enabled; see
https://gitlab.com/gitlab-org/gitlab-ee/issues/7048
This commit is contained in:
Victor Zagorodny 2019-02-08 13:22:11 +02:00
parent 60bd0a24f5
commit fa518963ec
2 changed files with 10 additions and 2 deletions

View file

@ -93,8 +93,11 @@ module Gitlab
}
.merge(services_usage)
.merge(approximate_counts)
.merge(user_preferences: user_preferences_usage)
}
}.tap do |data|
if Feature.enabled?(:group_overview_security_dashboard)
data[:counts][:user_preferences] = user_preferences_usage
end
end
end
# rubocop: enable CodeReuse/ActiveRecord

View file

@ -128,6 +128,11 @@ describe Gitlab::UsageData do
))
end
it 'does not gather user preferences usage data when the feature is disabled' do
stub_feature_flags(group_overview_security_dashboard: false)
expect(subject[:counts].keys).not_to include(:user_preferences)
end
it 'gathers projects data correctly' do
count_data = subject[:counts]