Commit f6522dd3 authored by Alina Mihaila's avatar Alina Mihaila Committed by Mayra Cabrera

Remove extra check for ff in branch_hooks_service [RUN ALL RSPEC] [RUN AS-IF-FOSS]

parent a3614c36
...@@ -96,7 +96,6 @@ module Git ...@@ -96,7 +96,6 @@ module Git
def track_ci_config_change_event def track_ci_config_change_event
return unless Gitlab::CurrentSettings.usage_ping_enabled? return unless Gitlab::CurrentSettings.usage_ping_enabled?
return unless ::Feature.enabled?(:usage_data_unique_users_committing_ciconfigfile, project, default_enabled: :yaml)
return unless default_branch? return unless default_branch?
commits_changing_ci_config.each do |commit| commits_changing_ci_config.each do |commit|
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe Git::BranchHooksService do RSpec.describe Git::BranchHooksService, :clean_gitlab_redis_shared_state do
include RepoHelpers include RepoHelpers
include ProjectForksHelper include ProjectForksHelper
...@@ -116,8 +116,6 @@ RSpec.describe Git::BranchHooksService do ...@@ -116,8 +116,6 @@ RSpec.describe Git::BranchHooksService do
allow_next_instance_of(Gitlab::Git::Diff) do |diff| allow_next_instance_of(Gitlab::Git::Diff) do |diff|
allow(diff).to receive(:new_path).and_return('.gitlab-ci.yml') allow(diff).to receive(:new_path).and_return('.gitlab-ci.yml')
end end
allow(Gitlab::UsageDataCounters::HLLRedisCounter).to receive(:track_event)
end end
let!(:commit_author) { create(:user, email: sample_commit.author_email) } let!(:commit_author) { create(:user, email: sample_commit.author_email) }
...@@ -127,23 +125,11 @@ RSpec.describe Git::BranchHooksService do ...@@ -127,23 +125,11 @@ RSpec.describe Git::BranchHooksService do
end end
it 'tracks the event' do it 'tracks the event' do
execute_service time = Time.zone.now
expect(Gitlab::UsageDataCounters::HLLRedisCounter)
.to have_received(:track_event).with(*tracking_params)
end
context 'when the FF usage_data_unique_users_committing_ciconfigfile is disabled' do
before do
stub_feature_flags(usage_data_unique_users_committing_ciconfigfile: false)
end
it 'does not track the event' do execute_service
execute_service
expect(Gitlab::UsageDataCounters::HLLRedisCounter) expect(Gitlab::UsageDataCounters::HLLRedisCounter.unique_events(event_names: 'o_pipeline_authoring_unique_users_committing_ciconfigfile', start_date: time, end_date: time + 7.days)).to eq(1)
.not_to have_received(:track_event).with(*tracking_params)
end
end end
context 'when usage ping is disabled' do context 'when usage ping is disabled' do
...@@ -155,7 +141,7 @@ RSpec.describe Git::BranchHooksService do ...@@ -155,7 +141,7 @@ RSpec.describe Git::BranchHooksService do
execute_service execute_service
expect(Gitlab::UsageDataCounters::HLLRedisCounter) expect(Gitlab::UsageDataCounters::HLLRedisCounter)
.not_to have_received(:track_event).with(*tracking_params) .not_to receive(:track_event).with(*tracking_params)
end end
end end
...@@ -166,7 +152,7 @@ RSpec.describe Git::BranchHooksService do ...@@ -166,7 +152,7 @@ RSpec.describe Git::BranchHooksService do
execute_service execute_service
expect(Gitlab::UsageDataCounters::HLLRedisCounter) expect(Gitlab::UsageDataCounters::HLLRedisCounter)
.not_to have_received(:track_event).with(*tracking_params) .not_to receive(:track_event).with(*tracking_params)
end end
end end
...@@ -179,7 +165,7 @@ RSpec.describe Git::BranchHooksService do ...@@ -179,7 +165,7 @@ RSpec.describe Git::BranchHooksService do
execute_service execute_service
expect(Gitlab::UsageDataCounters::HLLRedisCounter) expect(Gitlab::UsageDataCounters::HLLRedisCounter)
.not_to have_received(:track_event).with(*tracking_params) .not_to receive(:track_event).with(*tracking_params)
end end
end end
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