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
ed2922f3
Commit
ed2922f3
authored
Jul 06, 2021
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab master
parents
9dff8a9d
c11a677a
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
44 additions
and
26 deletions
+44
-26
app/controllers/repositories/git_http_controller.rb
app/controllers/repositories/git_http_controller.rb
+1
-5
config/feature_flags/development/project_statistics_sync.yml
config/feature_flags/development/project_statistics_sync.yml
+0
-8
ee/app/services/security/security_orchestration_policies/project_create_service.rb
...security_orchestration_policies/project_create_service.rb
+1
-1
ee/spec/services/security/security_orchestration_policies/project_create_service_spec.rb
...ity_orchestration_policies/project_create_service_spec.rb
+42
-0
spec/controllers/repositories/git_http_controller_spec.rb
spec/controllers/repositories/git_http_controller_spec.rb
+0
-12
No files found.
app/controllers/repositories/git_http_controller.rb
View file @
ed2922f3
...
...
@@ -84,11 +84,7 @@ module Repositories
return
if
Feature
.
enabled?
(
:disable_git_http_fetch_writes
)
if
Feature
.
enabled?
(
:project_statistics_sync
,
project
,
default_enabled:
true
)
Projects
::
FetchStatisticsIncrementService
.
new
(
project
).
execute
else
ProjectDailyStatisticsWorker
.
perform_async
(
project
.
id
)
# rubocop:disable CodeReuse/Worker
end
end
def
access
...
...
config/feature_flags/development/project_statistics_sync.yml
deleted
100644 → 0
View file @
9dff8a9d
---
name
:
project_statistics_sync
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/29636
rollout_issue_url
:
milestone
:
'
12.10'
type
:
development
group
:
group::source code
default_enabled
:
true
ee/app/services/security/security_orchestration_policies/project_create_service.rb
View file @
ed2922f3
...
...
@@ -34,7 +34,7 @@ module Security
}
if
protected_branch
.
present?
ProtectedBranch
::
UpdateService
ProtectedBranch
es
::
UpdateService
.
new
(
policy_project
,
current_user
,
params
)
.
execute
(
protected_branch
)
return
...
...
ee/spec/services/security/security_orchestration_policies/project_create_service_spec.rb
View file @
ed2922f3
...
...
@@ -29,6 +29,48 @@ RSpec.describe Security::SecurityOrchestrationPolicies::ProjectCreateService do
end
end
context
'when protected branch already exists'
do
let_it_be
(
:project
)
{
create
(
:project
)
}
let_it_be
(
:current_user
)
{
project
.
owner
}
let_it_be
(
:maintainer
)
{
create
(
:user
)
}
before
do
project
.
add_maintainer
(
maintainer
)
allow_next_instance_of
(
Project
)
do
|
instance
|
allow
(
instance
).
to
receive_message_chain
(
:protected_branches
,
:find_by_name
).
and_return
([
ProtectedBranch
.
new
])
end
protected_branch_service
=
instance_spy
(
ProtectedBranches
::
UpdateService
)
allow
(
ProtectedBranches
::
UpdateService
).
to
receive
(
:new
).
and_return
(
protected_branch_service
)
end
it
'updates protected branch'
do
service
.
execute
expect
(
ProtectedBranches
::
UpdateService
).
to
have_received
(
:new
)
end
end
context
'when protected branch does not exist'
do
let_it_be
(
:project
)
{
create
(
:project
)
}
let_it_be
(
:current_user
)
{
project
.
owner
}
let_it_be
(
:maintainer
)
{
create
(
:user
)
}
before
do
project
.
add_maintainer
(
maintainer
)
protected_branch_service
=
instance_spy
(
ProtectedBranches
::
CreateService
)
allow
(
ProtectedBranches
::
CreateService
).
to
receive
(
:new
).
and_return
(
protected_branch_service
)
end
it
'creates protected branch'
do
service
.
execute
expect
(
ProtectedBranches
::
CreateService
).
to
have_received
(
:new
)
end
end
context
'when adding users to security policy project fails'
do
let_it_be
(
:project
)
{
create
(
:project
)
}
let_it_be
(
:current_user
)
{
project
.
owner
}
...
...
spec/controllers/repositories/git_http_controller_spec.rb
View file @
ed2922f3
...
...
@@ -34,18 +34,6 @@ RSpec.describe Repositories::GitHttpController do
end
end
context
'when project_statistics_sync feature flag is disabled'
do
before
do
stub_feature_flags
(
project_statistics_sync:
false
,
disable_git_http_fetch_writes:
false
)
end
it
'updates project statistics async for projects'
do
expect
(
ProjectDailyStatisticsWorker
).
to
receive
(
:perform_async
)
send_request
end
end
it
'updates project statistics sync for projects'
do
stub_feature_flags
(
disable_git_http_fetch_writes:
false
)
...
...
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