Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
f6522dd3
Commit
f6522dd3
authored
May 06, 2021
by
Alina Mihaila
Committed by
Mayra Cabrera
May 06, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove extra check for ff in branch_hooks_service [RUN ALL RSPEC] [RUN AS-IF-FOSS]
parent
a3614c36
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
22 deletions
+7
-22
app/services/git/branch_hooks_service.rb
app/services/git/branch_hooks_service.rb
+0
-1
spec/services/git/branch_hooks_service_spec.rb
spec/services/git/branch_hooks_service_spec.rb
+7
-21
No files found.
app/services/git/branch_hooks_service.rb
View file @
f6522dd3
...
...
@@ -96,7 +96,6 @@ module Git
def
track_ci_config_change_event
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?
commits_changing_ci_config
.
each
do
|
commit
|
...
...
spec/services/git/branch_hooks_service_spec.rb
View file @
f6522dd3
...
...
@@ -2,7 +2,7 @@
require
'spec_helper'
RSpec
.
describe
Git
::
BranchHooksService
do
RSpec
.
describe
Git
::
BranchHooksService
,
:clean_gitlab_redis_shared_state
do
include
RepoHelpers
include
ProjectForksHelper
...
...
@@ -116,8 +116,6 @@ RSpec.describe Git::BranchHooksService do
allow_next_instance_of
(
Gitlab
::
Git
::
Diff
)
do
|
diff
|
allow
(
diff
).
to
receive
(
:new_path
).
and_return
(
'.gitlab-ci.yml'
)
end
allow
(
Gitlab
::
UsageDataCounters
::
HLLRedisCounter
).
to
receive
(
:track_event
)
end
let!
(
:commit_author
)
{
create
(
:user
,
email:
sample_commit
.
author_email
)
}
...
...
@@ -127,23 +125,11 @@ RSpec.describe Git::BranchHooksService do
end
it
'tracks the event'
do
execute_service
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
time
=
Time
.
zone
.
now
it
'does not track the event'
do
execute_service
execute_service
expect
(
Gitlab
::
UsageDataCounters
::
HLLRedisCounter
)
.
not_to
have_received
(
:track_event
).
with
(
*
tracking_params
)
end
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
)
end
context
'when usage ping is disabled'
do
...
...
@@ -155,7 +141,7 @@ RSpec.describe Git::BranchHooksService do
execute_service
expect
(
Gitlab
::
UsageDataCounters
::
HLLRedisCounter
)
.
not_to
have_received
(
:track_event
).
with
(
*
tracking_params
)
.
not_to
receive
(
:track_event
).
with
(
*
tracking_params
)
end
end
...
...
@@ -166,7 +152,7 @@ RSpec.describe Git::BranchHooksService do
execute_service
expect
(
Gitlab
::
UsageDataCounters
::
HLLRedisCounter
)
.
not_to
have_received
(
:track_event
).
with
(
*
tracking_params
)
.
not_to
receive
(
:track_event
).
with
(
*
tracking_params
)
end
end
...
...
@@ -179,7 +165,7 @@ RSpec.describe Git::BranchHooksService do
execute_service
expect
(
Gitlab
::
UsageDataCounters
::
HLLRedisCounter
)
.
not_to
have_received
(
:track_event
).
with
(
*
tracking_params
)
.
not_to
receive
(
:track_event
).
with
(
*
tracking_params
)
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment