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
5a30e0b5
Commit
5a30e0b5
authored
Mar 30, 2017
by
Nick Thomas
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'upstream/master' into nt/ce-to-ee-thursday
parents
616a68b2
494d0f3f
Changes
57
Hide whitespace changes
Inline
Side-by-side
Showing
57 changed files
with
178 additions
and
132 deletions
+178
-132
VERSION
VERSION
+1
-1
app/controllers/admin/application_settings_controller.rb
app/controllers/admin/application_settings_controller.rb
+0
-10
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+2
-1
app/models/application_setting.rb
app/models/application_setting.rb
+2
-1
app/services/application_settings/update_service.rb
app/services/application_settings/update_service.rb
+1
-1
app/services/groups/create_service.rb
app/services/groups/create_service.rb
+1
-1
app/services/groups/update_service.rb
app/services/groups/update_service.rb
+1
-1
app/services/projects/create_service.rb
app/services/projects/create_service.rb
+1
-1
app/services/projects/update_service.rb
app/services/projects/update_service.rb
+1
-1
app/views/projects/merge_requests/widget/open/_accept.html.haml
...ews/projects/merge_requests/widget/open/_accept.html.haml
+1
-0
changelogs/unreleased-ee/1811-very-poor-performance-creating-merge-request-regression-in-9-0-often-hits-60-seconds-timeout-on-small-requests.yml
...n-9-0-often-hits-60-seconds-timeout-on-small-requests.yml
+4
-0
doc/gitlab-geo/database_source.md
doc/gitlab-geo/database_source.md
+4
-3
features/support/capybara.rb
features/support/capybara.rb
+1
-1
lib/api/merge_requests.rb
lib/api/merge_requests.rb
+12
-12
lib/gitlab/authority_analyzer.rb
lib/gitlab/authority_analyzer.rb
+6
-7
lib/gitlab/git/repository.rb
lib/gitlab/git/repository.rb
+6
-1
lib/gitlab/utils.rb
lib/gitlab/utils.rb
+6
-0
spec/controllers/admin/application_settings_controller_spec.rb
...controllers/admin/application_settings_controller_spec.rb
+42
-18
spec/lib/gitlab/authority_analyzer_spec.rb
spec/lib/gitlab/authority_analyzer_spec.rb
+2
-2
spec/lib/gitlab/git/repository_spec.rb
spec/lib/gitlab/git/repository_spec.rb
+23
-4
spec/mailers/notify_spec.rb
spec/mailers/notify_spec.rb
+10
-5
spec/migrations/migrate_process_commit_worker_jobs_spec.rb
spec/migrations/migrate_process_commit_worker_jobs_spec.rb
+1
-1
spec/policies/issue_policy_spec.rb
spec/policies/issue_policy_spec.rb
+1
-1
spec/policies/project_policy_spec.rb
spec/policies/project_policy_spec.rb
+1
-1
spec/serializers/analytics_issue_serializer_spec.rb
spec/serializers/analytics_issue_serializer_spec.rb
+1
-1
spec/serializers/analytics_merge_request_serializer_spec.rb
spec/serializers/analytics_merge_request_serializer_spec.rb
+1
-1
spec/serializers/commit_entity_spec.rb
spec/serializers/commit_entity_spec.rb
+1
-1
spec/serializers/environment_serializer_spec.rb
spec/serializers/environment_serializer_spec.rb
+7
-8
spec/support/capybara.rb
spec/support/capybara.rb
+2
-2
spec/support/notify_shared_examples.rb
spec/support/notify_shared_examples.rb
+1
-1
spec/support/test_env.rb
spec/support/test_env.rb
+0
-6
spec/tasks/gitlab/backup_rake_spec.rb
spec/tasks/gitlab/backup_rake_spec.rb
+3
-3
spec/views/projects/builds/_build.html.haml_spec.rb
spec/views/projects/builds/_build.html.haml_spec.rb
+1
-1
spec/views/projects/builds/_generic_commit_status.html.haml_spec.rb
.../projects/builds/_generic_commit_status.html.haml_spec.rb
+1
-1
spec/views/projects/builds/show.html.haml_spec.rb
spec/views/projects/builds/show.html.haml_spec.rb
+1
-1
spec/views/projects/commit/_commit_box.html.haml_spec.rb
spec/views/projects/commit/_commit_box.html.haml_spec.rb
+1
-1
spec/views/projects/issues/_related_branches.html.haml_spec.rb
...views/projects/issues/_related_branches.html.haml_spec.rb
+1
-1
spec/views/projects/merge_requests/_commits.html.haml_spec.rb
.../views/projects/merge_requests/_commits.html.haml_spec.rb
+2
-5
spec/views/projects/merge_requests/edit.html.haml_spec.rb
spec/views/projects/merge_requests/edit.html.haml_spec.rb
+2
-2
spec/views/projects/merge_requests/show.html.haml_spec.rb
spec/views/projects/merge_requests/show.html.haml_spec.rb
+2
-2
spec/views/projects/pipelines/_stage.html.haml_spec.rb
spec/views/projects/pipelines/_stage.html.haml_spec.rb
+1
-1
spec/views/projects/pipelines/show.html.haml_spec.rb
spec/views/projects/pipelines/show.html.haml_spec.rb
+1
-1
spec/views/projects/tree/show.html.haml_spec.rb
spec/views/projects/tree/show.html.haml_spec.rb
+1
-1
spec/workers/delete_merged_branches_worker_spec.rb
spec/workers/delete_merged_branches_worker_spec.rb
+1
-1
spec/workers/emails_on_push_worker_spec.rb
spec/workers/emails_on_push_worker_spec.rb
+1
-1
spec/workers/git_garbage_collect_worker_spec.rb
spec/workers/git_garbage_collect_worker_spec.rb
+1
-1
spec/workers/group_destroy_worker_spec.rb
spec/workers/group_destroy_worker_spec.rb
+1
-1
spec/workers/pipeline_metrics_worker_spec.rb
spec/workers/pipeline_metrics_worker_spec.rb
+1
-1
spec/workers/pipeline_notification_worker_spec.rb
spec/workers/pipeline_notification_worker_spec.rb
+1
-1
spec/workers/post_receive_spec.rb
spec/workers/post_receive_spec.rb
+1
-1
spec/workers/process_commit_worker_spec.rb
spec/workers/process_commit_worker_spec.rb
+1
-1
spec/workers/project_cache_worker_spec.rb
spec/workers/project_cache_worker_spec.rb
+1
-1
spec/workers/project_destroy_worker_spec.rb
spec/workers/project_destroy_worker_spec.rb
+1
-1
spec/workers/repository_check/batch_worker_spec.rb
spec/workers/repository_check/batch_worker_spec.rb
+4
-4
spec/workers/repository_fork_worker_spec.rb
spec/workers/repository_fork_worker_spec.rb
+2
-2
spec/workers/repository_import_worker_spec.rb
spec/workers/repository_import_worker_spec.rb
+1
-1
spec/workers/update_merge_requests_worker_spec.rb
spec/workers/update_merge_requests_worker_spec.rb
+1
-1
No files found.
VERSION
View file @
5a30e0b5
9.1.0-
ee-
pre
9.1.0-pre
app/controllers/admin/application_settings_controller.rb
View file @
5a30e0b5
...
...
@@ -52,16 +52,6 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
end
def
application_setting_params
restricted_levels
=
params
[
:application_setting
][
:restricted_visibility_levels
]
if
restricted_levels
.
nil?
params
[
:application_setting
][
:restricted_visibility_levels
]
=
[]
else
restricted_levels
.
map!
do
|
level
|
level
.
to_i
end
end
import_sources
=
params
[
:application_setting
][
:import_sources
]
if
import_sources
.
nil?
...
...
app/controllers/projects/merge_requests_controller.rb
View file @
5a30e0b5
...
...
@@ -713,7 +713,8 @@ class Projects::MergeRequestsController < Projects::ApplicationController
def
set_suggested_approvers
if
@merge_request
.
requires_approve?
@suggested_approvers
=
Gitlab
::
AuthorityAnalyzer
.
new
(
@merge_request
@merge_request
,
@merge_request
.
author
||
current_user
).
calculate
(
@merge_request
.
approvals_required
)
end
end
...
...
app/models/application_setting.rb
View file @
5a30e0b5
...
...
@@ -262,7 +262,8 @@ class ApplicationSetting < ActiveRecord::Base
elasticsearch_aws:
false
,
elasticsearch_aws_region:
ENV
[
'ELASTIC_REGION'
]
||
'us-east-1'
,
usage_ping_enabled:
true
,
minimum_mirror_sync_time:
Gitlab
::
Mirror
::
FIFTEEN
minimum_mirror_sync_time:
Gitlab
::
Mirror
::
FIFTEEN
,
repository_size_limit:
0
}
end
...
...
app/services/application_settings/update_service.rb
View file @
5a30e0b5
...
...
@@ -3,7 +3,7 @@ module ApplicationSettings
def
execute
# Repository size limit comes as MB from the view
limit
=
@params
.
delete
(
:repository_size_limit
)
@application_setting
.
repository_size_limit
=
(
limit
.
to_i
.
megabytes
if
limit
.
present?
)
@application_setting
.
repository_size_limit
=
Gitlab
::
Utils
.
try_megabytes_to_bytes
(
limit
)
if
limit
@application_setting
.
update
(
@params
)
end
...
...
app/services/groups/create_service.rb
View file @
5a30e0b5
...
...
@@ -15,7 +15,7 @@ module Groups
# Repository size limit comes as MB from the view
limit
=
params
.
delete
(
:repository_size_limit
)
@group
.
repository_size_limit
=
(
limit
.
to_i
.
megabytes
if
limit
.
present?
)
@group
.
repository_size_limit
=
Gitlab
::
Utils
.
try_megabytes_to_bytes
(
limit
)
if
limit
if
@group
.
parent
&&
!
can?
(
current_user
,
:admin_group
,
@group
.
parent
)
@group
.
parent
=
nil
...
...
app/services/groups/update_service.rb
View file @
5a30e0b5
...
...
@@ -16,7 +16,7 @@ module Groups
# Repository size limit comes as MB from the view
limit
=
@params
.
delete
(
:repository_size_limit
)
group
.
repository_size_limit
=
(
limit
.
to_i
.
megabytes
if
limit
.
present?
)
group
.
repository_size_limit
=
Gitlab
::
Utils
.
try_megabytes_to_bytes
(
limit
)
if
limit
group
.
assign_attributes
(
params
)
...
...
app/services/projects/create_service.rb
View file @
5a30e0b5
...
...
@@ -147,7 +147,7 @@ module Projects
def
set_repository_size_limit_as_bytes
limit
=
params
.
delete
(
:repository_size_limit
)
@project
.
repository_size_limit
=
(
limit
.
to_i
.
megabytes
if
limit
.
present?
)
@project
.
repository_size_limit
=
Gitlab
::
Utils
.
try_megabytes_to_bytes
(
limit
)
if
limit
end
def
set_project_name_from_path
...
...
app/services/projects/update_service.rb
View file @
5a30e0b5
...
...
@@ -15,7 +15,7 @@ module Projects
# Repository size limit comes as MB from the view
limit
=
params
.
delete
(
:repository_size_limit
)
project
.
repository_size_limit
=
(
limit
.
to_i
.
megabytes
if
limit
.
present?
)
project
.
repository_size_limit
=
Gitlab
::
Utils
.
try_megabytes_to_bytes
(
limit
)
if
limit
new_branch
=
params
.
delete
(
:default_branch
)
new_repository_storage
=
params
.
delete
(
:repository_storage
)
...
...
app/views/projects/merge_requests/widget/open/_accept.html.haml
View file @
5a30e0b5
...
...
@@ -51,6 +51,7 @@
%button
.modify-merge-commit-link.js-toggle-button
{
type:
"button"
}
=
icon
(
'edit'
)
Modify commit message
-
unless
@project
.
merge_requests_ff_only_enabled
.js-toggle-content.hide.prepend-top-default
=
render
'shared/commit_message_container'
,
params:
params
,
...
...
changelogs/unreleased-ee/1811-very-poor-performance-creating-merge-request-regression-in-9-0-often-hits-60-seconds-timeout-on-small-requests.yml
0 → 100644
View file @
5a30e0b5
---
title
:
Speed up suggested approvers on MR creation
merge_request
:
author
:
doc/gitlab-geo/database_source.md
View file @
5a30e0b5
...
...
@@ -36,7 +36,7 @@ and `secondary` as either `slave` or `standby` server (read-only).
The following guide assumes that:
-
You are using PostgreSQL 9.
2
or later which includes the
-
You are using PostgreSQL 9.
6
or later which includes the
[
`pg_basebackup` tool
][
pgback
]
. If you are using Omnibus it includes the required
PostgreSQL version for Geo.
-
You have a primary server already set up (the GitLab server you are
...
...
@@ -66,7 +66,8 @@ The following guide assumes that:
listen_address = '1.2.3.4'
wal_level = hot_standby
max_wal_senders = 5
checkpoint_segments = 10
min_wal_size = 80MB
max_wal_size = 1GB
wal_keep_segments = 10
hot_standby = on
```
...
...
@@ -229,5 +230,5 @@ We don't support MySQL replication for GitLab Geo.
Read the
[
troubleshooting document
](
troubleshooting.md
)
.
[
pgback
]:
http://www.postgresql.org/docs/9.
2
/static/app-pgbasebackup.html
[
pgback
]:
http://www.postgresql.org/docs/9.
6
/static/app-pgbasebackup.html
[
reconfigure GitLab
]:
../administration/restart_gitlab.md#omnibus-gitlab-reconfigure
features/support/capybara.rb
View file @
5a30e0b5
...
...
@@ -3,7 +3,7 @@ require 'capybara/poltergeist'
require
'capybara-screenshot/spinach'
# Give CI some extra time
timeout
=
(
ENV
[
'CI'
]
||
ENV
[
'CI_SERVER'
])
?
3
0
:
10
timeout
=
(
ENV
[
'CI'
]
||
ENV
[
'CI_SERVER'
])
?
4
0
:
10
Capybara
.
javascript_driver
=
:poltergeist
Capybara
.
register_driver
:poltergeist
do
|
app
|
...
...
lib/api/merge_requests.rb
View file @
5a30e0b5
...
...
@@ -233,18 +233,6 @@ module API
.
cancel
(
merge_request
)
end
desc
'List issues that will be closed on merge'
do
success
Entities
::
MRNote
end
params
do
use
:pagination
end
get
':id/merge_requests/:merge_request_iid/closes_issues'
do
merge_request
=
find_merge_request_with_access
(
params
[
:merge_request_iid
])
issues
=
::
Kaminari
.
paginate_array
(
merge_request
.
closes_issues
(
current_user
))
present
paginate
(
issues
),
with:
issue_entity
(
user_project
),
current_user:
current_user
end
# Get the status of the merge request's approvals
#
# Parameters:
...
...
@@ -290,6 +278,18 @@ module API
present
merge_request
,
with:
Entities
::
MergeRequestApprovals
,
current_user:
current_user
end
desc
'List issues that will be closed on merge'
do
success
Entities
::
MRNote
end
params
do
use
:pagination
end
get
':id/merge_requests/:merge_request_iid/closes_issues'
do
merge_request
=
find_merge_request_with_access
(
params
[
:merge_request_iid
])
issues
=
::
Kaminari
.
paginate_array
(
merge_request
.
closes_issues
(
current_user
))
present
paginate
(
issues
),
with:
issue_entity
(
user_project
),
current_user:
current_user
end
end
end
end
lib/gitlab/authority_analyzer.rb
View file @
5a30e0b5
module
Gitlab
class
AuthorityAnalyzer
COMMITS_TO_CONSIDER
=
5
COMMITS_TO_CONSIDER
=
2
5
def
initialize
(
merge_request
)
def
initialize
(
merge_request
,
skip_user
)
@merge_request
=
merge_request
@skip_user
=
skip_user
@users
=
Hash
.
new
(
0
)
end
...
...
@@ -19,11 +20,9 @@ module Gitlab
def
involved_users
@repo
=
@merge_request
.
target_project
.
repository
list_of_involved_files
.
each
do
|
path
|
@repo
.
commits
(
@merge_request
.
target_branch
,
path:
path
,
limit:
COMMITS_TO_CONSIDER
).
each
do
|
commit
|
if
commit
.
author
&&
commit
.
author
!=
@merge_request
.
author
@users
[
commit
.
author
]
+=
1
end
@repo
.
commits
(
@merge_request
.
target_branch
,
path:
list_of_involved_files
,
limit:
COMMITS_TO_CONSIDER
).
each
do
|
commit
|
if
commit
.
author
&&
commit
.
author
!=
@skip_user
@users
[
commit
.
author
]
+=
1
end
end
end
...
...
lib/gitlab/git/repository.rb
View file @
5a30e0b5
...
...
@@ -346,7 +346,12 @@ module Gitlab
cmd
<<
"--after=
#{
options
[
:after
].
iso8601
}
"
if
options
[
:after
]
cmd
<<
"--before=
#{
options
[
:before
].
iso8601
}
"
if
options
[
:before
]
cmd
<<
sha
cmd
+=
%W[--
#{
options
[
:path
]
}
]
if
options
[
:path
].
present?
# :path can be a string or an array of strings
if
options
[
:path
].
present?
cmd
<<
'--'
cmd
+=
Array
(
options
[
:path
])
end
raw_output
=
IO
.
popen
(
cmd
)
{
|
io
|
io
.
read
}
lines
=
offset_in_ruby
?
raw_output
.
lines
.
drop
(
offset
)
:
raw_output
.
lines
...
...
lib/gitlab/utils.rb
View file @
5a30e0b5
...
...
@@ -21,5 +21,11 @@ module Gitlab
nil
end
def
try_megabytes_to_bytes
(
size
)
Integer
(
size
).
megabytes
rescue
ArgumentError
size
end
end
end
spec/controllers/admin/application_settings_controller_spec.rb
View file @
5a30e0b5
...
...
@@ -3,8 +3,6 @@ require 'spec_helper'
describe
Admin
::
ApplicationSettingsController
do
include
StubENV
let
(
:group
)
{
create
(
:group
)
}
let
(
:project
)
{
create
(
:project
,
namespace:
group
)
}
let
(
:admin
)
{
create
(
:admin
)
}
let
(
:user
)
{
create
(
:user
)}
...
...
@@ -17,28 +15,54 @@ describe Admin::ApplicationSettingsController do
sign_in
(
admin
)
end
context
'with valid params
'
do
subject
{
put
:update
,
application_setting:
{
repository_size_limit:
'100'
}
}
it
'updates the default_project_visibility for string value
'
do
put
:update
,
application_setting:
{
default_project_visibility:
"20"
}
it
'redirect to application settings page'
do
is_expected
.
to
redirect_to
(
admin_application_settings_path
)
end
expect
(
response
).
to
redirect_to
(
admin_application_settings_path
)
expect
(
ApplicationSetting
.
current
.
default_project_visibility
).
to
eq
(
Gitlab
::
VisibilityLevel
::
PUBLIC
)
end
it
'update the restricted levels for string values'
do
put
:update
,
application_setting:
{
restricted_visibility_levels:
%w[10 20]
}
it
'set flash notice'
do
is_expected
.
to
set_flash
[
:notice
].
to
(
'Application settings saved successfully'
)
end
expect
(
response
).
to
redirect_to
(
admin_application_settings_path
)
expect
(
ApplicationSetting
.
current
.
restricted_visibility_levels
).
to
eq
([
10
,
20
])
end
context
'with invalid params'
do
subject!
{
put
:update
,
application_setting:
{
repository_size_limit:
'-100'
}
}
it
'falls back to defaults when settings are omitted'
do
put
:update
,
application_setting:
{}
expect
(
response
).
to
redirect_to
(
admin_application_settings_path
)
expect
(
ApplicationSetting
.
current
.
default_project_visibility
).
to
eq
(
Gitlab
::
VisibilityLevel
::
PRIVATE
)
expect
(
ApplicationSetting
.
current
.
restricted_visibility_levels
).
to
be_empty
end
it
'updates repository_size_limit'
do
put
:update
,
application_setting:
{
repository_size_limit:
'100'
}
expect
(
response
).
to
redirect_to
(
admin_application_settings_path
)
expect
(
response
).
to
set_flash
[
:notice
].
to
(
'Application settings saved successfully'
)
end
it
'does not accept negative repository_size_limit'
do
put
:update
,
application_setting:
{
repository_size_limit:
'-100'
}
expect
(
response
).
to
render_template
(
:show
)
expect
(
assigns
(
:application_setting
).
errors
[
:repository_size_limit
]).
to
be_present
end
it
'does not accept invalid repository_size_limit'
do
put
:update
,
application_setting:
{
repository_size_limit:
'one thousand'
}
expect
(
response
).
to
render_template
(
:show
)
expect
(
assigns
(
:application_setting
).
errors
[
:repository_size_limit
]).
to
be_present
end
it
'render show template'
do
is_expected
.
to
render_template
(
:show
)
end
it
'does not accept empty repository_size_limit'
do
put
:update
,
application_setting:
{
repository_size_limit:
''
}
it
'assigned @application_settings has errors'
do
expect
(
assigns
(
:application_setting
).
errors
[
:repository_size_limit
]).
to
be_present
end
expect
(
response
).
to
render_template
(
:show
)
expect
(
assigns
(
:application_setting
).
errors
[
:repository_size_limit
]).
to
be_present
end
end
...
...
spec/lib/gitlab/authority_analyzer_spec.rb
View file @
5a30e0b5
...
...
@@ -6,7 +6,7 @@ describe Gitlab::AuthorityAnalyzer, lib: true do
let
(
:author
)
{
create
(
:user
)
}
let
(
:user_a
)
{
create
(
:user
)
}
let
(
:user_b
)
{
create
(
:user
)
}
let
(
:merge_request
)
{
create
(
:merge_request
,
target_project:
project
,
source_project:
project
,
author:
author
)
}
let
(
:merge_request
)
{
create
(
:merge_request
,
target_project:
project
,
source_project:
project
)
}
let
(
:files
)
{
[
double
(
:file
,
deleted_file:
true
,
old_path:
'foo'
)]
}
let
(
:commits
)
do
...
...
@@ -19,7 +19,7 @@ describe Gitlab::AuthorityAnalyzer, lib: true do
]
end
let
(
:approvers
)
{
Gitlab
::
AuthorityAnalyzer
.
new
(
merge_request
).
calculate
(
number_of_approvers
)
}
let
(
:approvers
)
{
Gitlab
::
AuthorityAnalyzer
.
new
(
merge_request
,
author
).
calculate
(
number_of_approvers
)
}
before
do
merge_request
.
compare
=
double
(
:compare
,
raw_diffs:
files
)
...
...
spec/lib/gitlab/git/repository_spec.rb
View file @
5a30e0b5
...
...
@@ -771,8 +771,8 @@ describe Gitlab::Git::Repository, seed_helper: true do
commits
=
repository
.
log
(
options
)
expect
(
commits
.
size
).
to
be
>
0
satisfy
do
commits
.
all?
{
|
commit
|
commit
.
created_at
>=
options
[
:after
]
}
expect
(
commits
).
to
satisfy
do
|
commits
|
commits
.
all?
{
|
commit
|
commit
.
time
>=
options
[
:after
]
}
end
end
end
...
...
@@ -784,8 +784,27 @@ describe Gitlab::Git::Repository, seed_helper: true do
commits
=
repository
.
log
(
options
)
expect
(
commits
.
size
).
to
be
>
0
satisfy
do
commits
.
all?
{
|
commit
|
commit
.
created_at
<=
options
[
:before
]
}
expect
(
commits
).
to
satisfy
do
|
commits
|
commits
.
all?
{
|
commit
|
commit
.
time
<=
options
[
:before
]
}
end
end
end
context
'when multiple paths are provided'
do
let
(
:options
)
{
{
ref:
'master'
,
path:
[
'PROCESS.md'
,
'README.md'
]
}
}
def
commit_files
(
commit
)
commit
.
diff
(
commit
.
parent_ids
.
first
).
deltas
.
flat_map
do
|
delta
|
[
delta
.
old_file
[
:path
],
delta
.
new_file
[
:path
]].
uniq
.
compact
end
end
it
'only returns commits matching at least one path'
do
commits
=
repository
.
log
(
options
)
expect
(
commits
.
size
).
to
be
>
0
expect
(
commits
).
to
satisfy
do
|
commits
|
commits
.
none?
{
|
commit
|
(
commit_files
(
commit
)
&
options
[
:path
]).
empty?
}
end
end
end
...
...
spec/mailers/notify_spec.rb
View file @
5a30e0b5
...
...
@@ -184,6 +184,7 @@ describe Notify do
end
context
'for merge requests'
do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:merge_author
)
{
create
(
:user
)
}
let
(
:merge_request
)
{
create
(
:merge_request
,
author:
current_user
,
assignee:
assignee
,
source_project:
project
,
target_project:
project
)
}
let
(
:merge_request_with_description
)
{
create
(
:merge_request
,
author:
current_user
,
assignee:
assignee
,
source_project:
project
,
target_project:
project
,
description:
FFaker
::
Lorem
.
sentence
)
}
...
...
@@ -441,7 +442,7 @@ describe Notify do
end
describe
'project was moved'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:
empty_
project
)
}
let
(
:user
)
{
create
(
:user
)
}
subject
{
Notify
.
project_was_moved_email
(
project
.
id
,
user
.
id
,
"gitlab/gitlab"
)
}
...
...
@@ -567,7 +568,7 @@ describe Notify do
end
describe
'project invitation'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:
empty_
project
)
}
let
(
:master
)
{
create
(
:user
).
tap
{
|
u
|
project
.
team
<<
[
u
,
:master
]
}
}
let
(
:project_member
)
{
invite_to_project
(
project
,
inviter:
master
)
}
...
...
@@ -587,7 +588,7 @@ describe Notify do
end
describe
'project invitation accepted'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:
empty_
project
)
}
let
(
:invited_user
)
{
create
(
:user
,
name:
'invited user'
)
}
let
(
:master
)
{
create
(
:user
).
tap
{
|
u
|
project
.
team
<<
[
u
,
:master
]
}
}
let
(
:project_member
)
do
...
...
@@ -612,7 +613,7 @@ describe Notify do
end
describe
'project invitation declined'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:
empty_
project
)
}
let
(
:master
)
{
create
(
:user
).
tap
{
|
u
|
project
.
team
<<
[
u
,
:master
]
}
}
let
(
:project_member
)
do
invitee
=
invite_to_project
(
project
,
inviter:
master
)
...
...
@@ -676,6 +677,7 @@ describe Notify do
end
describe
'on a commit'
do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:commit
)
{
project
.
commit
}
before
(
:each
)
{
allow
(
note
).
to
receive
(
:noteable
).
and_return
(
commit
)
}
...
...
@@ -743,6 +745,7 @@ describe Notify do
end
context
'items that are noteable, emails for a note on a diff'
do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:note_author
)
{
create
(
:user
,
name:
'author_name'
)
}
before
:each
do
...
...
@@ -1084,6 +1087,7 @@ describe Notify do
end
describe
'email on push with multiple commits'
do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:example_site_path
)
{
root_path
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:raw_compare
)
{
Gitlab
::
Git
::
Compare
.
new
(
project
.
repository
.
raw_repository
,
sample_image_commit
.
id
,
sample_commit
.
id
)
}
...
...
@@ -1177,6 +1181,7 @@ describe Notify do
end
describe
'email on push with a single commit'
do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:example_site_path
)
{
root_path
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:raw_compare
)
{
Gitlab
::
Git
::
Compare
.
new
(
project
.
repository
.
raw_repository
,
sample_commit
.
parent_id
,
sample_commit
.
id
)
}
...
...
@@ -1235,7 +1240,7 @@ describe Notify do
end
describe
'HTML emails setting'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:
empty_
project
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:multipart_mail
)
{
Notify
.
project_was_moved_email
(
project
.
id
,
user
.
id
,
"gitlab/gitlab"
)
}
...
...
spec/migrations/migrate_process_commit_worker_jobs_spec.rb
View file @
5a30e0b5
...
...
@@ -4,7 +4,7 @@ require 'spec_helper'
require
Rails
.
root
.
join
(
'db'
,
'migrate'
,
'20161124141322_migrate_process_commit_worker_jobs.rb'
)
describe
MigrateProcessCommitWorkerJobs
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:commit
)
{
project
.
commit
.
raw
.
raw_commit
}
...
...
spec/policies/issue_policy_spec.rb
View file @
5a30e0b5
...
...
@@ -5,7 +5,7 @@ describe IssuePolicy, models: true do
describe
'#rules'
do
context
'using a regular issue'
do
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:project
)
{
create
(
:
empty_
project
,
:public
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
let
(
:policies
)
{
described_class
.
abilities
(
user
,
issue
).
to_set
}
...
...
spec/policies/project_policy_spec.rb
View file @
5a30e0b5
...
...
@@ -85,7 +85,7 @@ describe ProjectPolicy, models: true do
end
it
'does not include the read_issue permission when the issue author is not a member of the private project'
do
project
=
create
(
:project
,
:private
)
project
=
create
(
:
empty_
project
,
:private
)
issue
=
create
(
:issue
,
project:
project
)
user
=
issue
.
author
...
...
spec/serializers/analytics_issue_serializer_spec.rb
View file @
5a30e0b5
...
...
@@ -8,7 +8,7 @@ describe AnalyticsIssueSerializer do
end
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:
empty_
project
)
}
let
(
:resource
)
do
{
total_time:
"172802.724419"
,
...
...
spec/serializers/analytics_merge_request_serializer_spec.rb
View file @
5a30e0b5
...
...
@@ -8,7 +8,7 @@ describe AnalyticsMergeRequestSerializer do
end
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:
empty_
project
)
}
let
(
:resource
)
do
{
total_time:
"172802.724419"
,
...
...
spec/serializers/commit_entity_spec.rb
View file @
5a30e0b5
...
...
@@ -6,7 +6,7 @@ describe CommitEntity do
end
let
(
:request
)
{
double
(
'request'
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:commit
)
{
project
.
commit
}
subject
{
entity
.
as_json
}
...
...
spec/serializers/environment_serializer_spec.rb
View file @
5a30e0b5
...
...
@@ -2,7 +2,7 @@ require 'spec_helper'
describe
EnvironmentSerializer
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:
empty_
project
)
}
let
(
:json
)
do
described_class
...
...
@@ -11,21 +11,20 @@ describe EnvironmentSerializer do
end
context
'when there is a single object provided'
do
before
do
create
(
:ci_build
,
:manual
,
name:
'manual1'
,
pipeline:
deployable
.
pipeline
)
end
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:deployable
)
{
create
(
:ci_build
)
}
let
(
:deployment
)
do
create
(
:deployment
,
deployable:
deployable
,
user:
user
,
project:
project
,
sha:
project
.
commit
.
id
)
end
let
(
:deployable
)
{
create
(
:ci_build
)
}
let
(
:resource
)
{
deployment
.
environment
}
before
do
create
(
:ci_build
,
:manual
,
name:
'manual1'
,
pipeline:
deployable
.
pipeline
)
end
it
'contains important elements of environment'
do
expect
(
json
)
.
to
include
(
:name
,
:external_url
,
:environment_path
,
:last_deployment
)
...
...
spec/support/capybara.rb
View file @
5a30e0b5
...
...
@@ -4,7 +4,7 @@ require 'capybara/poltergeist'
require
'capybara-screenshot/rspec'
# Give CI some extra time
timeout
=
(
ENV
[
'CI'
]
||
ENV
[
'CI_SERVER'
])
?
3
0
:
10
timeout
=
(
ENV
[
'CI'
]
||
ENV
[
'CI_SERVER'
])
?
4
0
:
10
Capybara
.
javascript_driver
=
:poltergeist
Capybara
.
register_driver
:poltergeist
do
|
app
|
...
...
@@ -27,6 +27,6 @@ Capybara::Screenshot.prune_strategy = :keep_last_run
RSpec
.
configure
do
|
config
|
config
.
before
(
:suite
)
do
TestEnv
.
warm_asset_cache
TestEnv
.
warm_asset_cache
unless
ENV
[
'CI'
]
||
ENV
[
'CI_SERVER'
]
end
end
spec/support/notify_shared_examples.rb
View file @
5a30e0b5
...
...
@@ -3,7 +3,7 @@ shared_context 'gitlab email notification' do
let
(
:gitlab_sender
)
{
Gitlab
.
config
.
gitlab
.
email_from
}
let
(
:gitlab_sender_reply_to
)
{
Gitlab
.
config
.
gitlab
.
email_reply_to
}
let
(
:recipient
)
{
create
(
:user
,
email:
'recipient@example.com'
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:
empty_
project
)
}
let
(
:new_user_address
)
{
'newguy@example.com'
}
before
do
...
...
spec/support/test_env.rb
View file @
5a30e0b5
...
...
@@ -172,17 +172,11 @@ module TestEnv
# Otherwise they'd be created by the first test, often timing out and
# causing a transient test failure
def
warm_asset_cache
return
if
warm_asset_cache?
return
unless
defined?
(
Capybara
)
Capybara
.
current_session
.
driver
.
visit
'/'
end
def
warm_asset_cache?
cache
=
Rails
.
root
.
join
(
*
%w(tmp cache assets test)
)
Dir
.
exist?
(
cache
)
&&
Dir
.
entries
(
cache
).
length
>
2
end
private
def
factory_repo_path
...
...
spec/tasks/gitlab/backup_rake_spec.rb
View file @
5a30e0b5
...
...
@@ -116,7 +116,7 @@ describe 'gitlab:app namespace rake task' do
end
describe
'backup creation and deletion using custom_hooks'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:user_backup_path
)
{
"repositories/
#{
project
.
path_with_namespace
}
"
}
before
(
:each
)
do
...
...
@@ -224,8 +224,8 @@ describe 'gitlab:app namespace rake task' do
end
context
'multiple repository storages'
do
let
(
:project_a
)
{
create
(
:project
,
repository_storage:
'default'
)
}
let
(
:project_b
)
{
create
(
:project
,
repository_storage:
'custom'
)
}
let
(
:project_a
)
{
create
(
:project
,
:repository
,
repository_storage:
'default'
)
}
let
(
:project_b
)
{
create
(
:project
,
:repository
,
repository_storage:
'custom'
)
}
before
do
FileUtils
.
mkdir
(
'tmp/tests/default_storage'
)
...
...
spec/views/projects/builds/_build.html.haml_spec.rb
View file @
5a30e0b5
...
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
'projects/ci/builds/_build'
do
include
Devise
::
Test
::
ControllerHelpers
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:pipeline
)
{
create
(
:ci_empty_pipeline
,
id:
1337
,
project:
project
,
sha:
project
.
commit
.
id
)
}
let
(
:build
)
{
create
(
:ci_build
,
pipeline:
pipeline
,
stage:
'test'
,
stage_idx:
1
,
name:
'rspec 0:2'
,
status: :pending
)
}
...
...
spec/views/projects/builds/_generic_commit_status.html.haml_spec.rb
View file @
5a30e0b5
...
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
'projects/generic_commit_statuses/_generic_commit_status.html.haml'
do
include
Devise
::
Test
::
ControllerHelpers
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:pipeline
)
{
create
(
:ci_empty_pipeline
,
id:
1337
,
project:
project
,
sha:
project
.
commit
.
id
)
}
let
(
:generic_commit_status
)
{
create
(
:generic_commit_status
,
pipeline:
pipeline
,
stage:
'external'
,
name:
'jenkins'
,
stage_idx:
3
)
}
...
...
spec/views/projects/builds/show.html.haml_spec.rb
View file @
5a30e0b5
require
'spec_helper'
describe
'projects/builds/show'
,
:view
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:build
)
{
create
(
:ci_build
,
pipeline:
pipeline
)
}
let
(
:pipeline
)
do
...
...
spec/views/projects/commit/_commit_box.html.haml_spec.rb
View file @
5a30e0b5
...
...
@@ -4,7 +4,7 @@ describe 'projects/commit/_commit_box.html.haml' do
include
Devise
::
Test
::
ControllerHelpers
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
before
do
assign
(
:project
,
project
)
...
...
spec/views/projects/issues/_related_branches.html.haml_spec.rb
View file @
5a30e0b5
...
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
'projects/issues/_related_branches'
do
include
Devise
::
Test
::
ControllerHelpers
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:branch
)
{
project
.
repository
.
find_branch
(
'feature'
)
}
let!
(
:pipeline
)
{
create
(
:ci_pipeline
,
project:
project
,
sha:
branch
.
dereferenced_target
.
id
,
ref:
'feature'
)
}
...
...
spec/views/projects/merge_requests/_commits.html.haml_spec.rb
View file @
5a30e0b5
...
...
@@ -4,11 +4,8 @@ describe 'projects/merge_requests/show/_commits.html.haml' do
include
Devise
::
Test
::
ControllerHelpers
let
(
:user
)
{
create
(
:user
)
}
let
(
:target_project
)
{
create
(
:project
)
}
let
(
:source_project
)
do
create
(
:project
,
forked_from_project:
target_project
)
end
let
(
:target_project
)
{
create
(
:project
,
:repository
)
}
let
(
:source_project
)
{
create
(
:project
,
:repository
,
forked_from_project:
target_project
)
}
let
(
:merge_request
)
do
create
(
:merge_request
,
:simple
,
...
...
spec/views/projects/merge_requests/edit.html.haml_spec.rb
View file @
5a30e0b5
...
...
@@ -4,8 +4,8 @@ describe 'projects/merge_requests/edit.html.haml' do
include
Devise
::
Test
::
ControllerHelpers
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:fork_project
)
{
create
(
:project
,
forked_from_project:
project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:fork_project
)
{
create
(
:project
,
:repository
,
forked_from_project:
project
)
}
let
(
:unlink_project
)
{
Projects
::
UnlinkForkService
.
new
(
fork_project
,
user
)
}
let
(
:milestone
)
{
create
(
:milestone
,
project:
project
)
}
...
...
spec/views/projects/merge_requests/show.html.haml_spec.rb
View file @
5a30e0b5
...
...
@@ -4,8 +4,8 @@ describe 'projects/merge_requests/show.html.haml' do
include
Devise
::
Test
::
ControllerHelpers
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:fork_project
)
{
create
(
:project
,
forked_from_project:
project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:fork_project
)
{
create
(
:project
,
:repository
,
forked_from_project:
project
)
}
let
(
:unlink_project
)
{
Projects
::
UnlinkForkService
.
new
(
fork_project
,
user
)
}
let
(
:note
)
{
create
(
:note_on_merge_request
,
project:
project
,
noteable:
closed_merge_request
)
}
...
...
spec/views/projects/pipelines/_stage.html.haml_spec.rb
View file @
5a30e0b5
require
'spec_helper'
describe
'projects/pipelines/_stage'
,
:view
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:pipeline
)
{
create
(
:ci_pipeline
,
project:
project
)
}
let
(
:stage
)
{
build
(
:ci_stage
,
pipeline:
pipeline
)
}
...
...
spec/views/projects/pipelines/show.html.haml_spec.rb
View file @
5a30e0b5
...
...
@@ -4,7 +4,7 @@ describe 'projects/pipelines/show' do
include
Devise
::
Test
::
ControllerHelpers
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:pipeline
)
{
create
(
:ci_empty_pipeline
,
project:
project
,
sha:
project
.
commit
.
id
,
user:
user
)
}
before
do
...
...
spec/views/projects/tree/show.html.haml_spec.rb
View file @
5a30e0b5
...
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
'projects/tree/show'
do
include
Devise
::
Test
::
ControllerHelpers
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:repository
)
{
project
.
repository
}
before
do
...
...
spec/workers/delete_merged_branches_worker_spec.rb
View file @
5a30e0b5
...
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
DeleteMergedBranchesWorker
do
subject
(
:worker
)
{
described_class
.
new
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
describe
"#perform"
do
it
"calls DeleteMergedBranchesService"
do
...
...
spec/workers/emails_on_push_worker_spec.rb
View file @
5a30e0b5
...
...
@@ -5,7 +5,7 @@ describe EmailsOnPushWorker do
include
EmailHelpers
include
EmailSpec
::
Matchers
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:data
)
{
Gitlab
::
DataBuilder
::
Push
.
build_sample
(
project
,
user
)
}
let
(
:recipients
)
{
user
.
email
}
...
...
spec/workers/git_garbage_collect_worker_spec.rb
View file @
5a30e0b5
...
...
@@ -3,7 +3,7 @@ require 'fileutils'
require
'spec_helper'
describe
GitGarbageCollectWorker
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:shell
)
{
Gitlab
::
Shell
.
new
}
subject
{
GitGarbageCollectWorker
.
new
}
...
...
spec/workers/group_destroy_worker_spec.rb
View file @
5a30e0b5
...
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
GroupDestroyWorker
do
let
(
:group
)
{
create
(
:group
)
}
let
(
:user
)
{
create
(
:admin
)
}
let!
(
:project
)
{
create
(
:project
,
namespace:
group
)
}
let!
(
:project
)
{
create
(
:
empty_
project
,
namespace:
group
)
}
subject
{
GroupDestroyWorker
.
new
}
...
...
spec/workers/pipeline_metrics_worker_spec.rb
View file @
5a30e0b5
require
'spec_helper'
describe
PipelineMetricsWorker
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let!
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
project
,
source_branch:
pipeline
.
ref
)
}
let
(
:pipeline
)
do
...
...
spec/workers/pipeline_notification_worker_spec.rb
View file @
5a30e0b5
...
...
@@ -11,7 +11,7 @@ describe PipelineNotificationWorker do
status:
status
)
end
let
(
:project
)
{
create
(
:project
,
public_builds:
false
)
}
let
(
:project
)
{
create
(
:project
,
:repository
,
public_builds:
false
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:pusher
)
{
user
}
let
(
:watcher
)
{
pusher
}
...
...
spec/workers/post_receive_spec.rb
View file @
5a30e0b5
...
...
@@ -4,7 +4,7 @@ describe PostReceive do
let
(
:changes
)
{
"123456 789012 refs/heads/tést
\n
654321 210987 refs/tags/tag"
}
let
(
:wrongly_encoded_changes
)
{
changes
.
encode
(
"ISO-8859-1"
).
force_encoding
(
"UTF-8"
)
}
let
(
:base64_changes
)
{
Base64
.
encode64
(
wrongly_encoded_changes
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:key
)
{
create
(
:key
,
user:
project
.
owner
)
}
let
(
:key_id
)
{
key
.
shell_id
}
...
...
spec/workers/process_commit_worker_spec.rb
View file @
5a30e0b5
...
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
ProcessCommitWorker
do
let
(
:worker
)
{
described_class
.
new
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
,
author:
user
)
}
let
(
:commit
)
{
project
.
commit
}
...
...
spec/workers/project_cache_worker_spec.rb
View file @
5a30e0b5
...
...
@@ -2,7 +2,7 @@ require 'spec_helper'
describe
ProjectCacheWorker
do
let
(
:worker
)
{
described_class
.
new
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:statistics
)
{
project
.
statistics
}
describe
'#perform'
do
...
...
spec/workers/project_destroy_worker_spec.rb
View file @
5a30e0b5
require
'spec_helper'
describe
ProjectDestroyWorker
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:path
)
{
project
.
repository
.
path_to_repo
}
subject
{
ProjectDestroyWorker
.
new
}
...
...
spec/workers/repository_check/batch_worker_spec.rb
View file @
5a30e0b5
...
...
@@ -4,7 +4,7 @@ describe RepositoryCheck::BatchWorker do
subject
{
described_class
.
new
}
it
'prefers projects that have never been checked'
do
projects
=
create_list
(
:project
,
3
,
created_at:
1
.
week
.
ago
)
projects
=
create_list
(
:
empty_
project
,
3
,
created_at:
1
.
week
.
ago
)
projects
[
0
].
update_column
(
:last_repository_check_at
,
4
.
months
.
ago
)
projects
[
2
].
update_column
(
:last_repository_check_at
,
3
.
months
.
ago
)
...
...
@@ -12,7 +12,7 @@ describe RepositoryCheck::BatchWorker do
end
it
'sorts projects by last_repository_check_at'
do
projects
=
create_list
(
:project
,
3
,
created_at:
1
.
week
.
ago
)
projects
=
create_list
(
:
empty_
project
,
3
,
created_at:
1
.
week
.
ago
)
projects
[
0
].
update_column
(
:last_repository_check_at
,
2
.
months
.
ago
)
projects
[
1
].
update_column
(
:last_repository_check_at
,
4
.
months
.
ago
)
projects
[
2
].
update_column
(
:last_repository_check_at
,
3
.
months
.
ago
)
...
...
@@ -21,7 +21,7 @@ describe RepositoryCheck::BatchWorker do
end
it
'excludes projects that were checked recently'
do
projects
=
create_list
(
:project
,
3
,
created_at:
1
.
week
.
ago
)
projects
=
create_list
(
:
empty_
project
,
3
,
created_at:
1
.
week
.
ago
)
projects
[
0
].
update_column
(
:last_repository_check_at
,
2
.
days
.
ago
)
projects
[
1
].
update_column
(
:last_repository_check_at
,
2
.
months
.
ago
)
projects
[
2
].
update_column
(
:last_repository_check_at
,
3
.
days
.
ago
)
...
...
@@ -40,7 +40,7 @@ describe RepositoryCheck::BatchWorker do
it
'skips projects created less than 24 hours ago'
do
project
=
create
(
:empty_project
)
project
.
update_column
(
:created_at
,
23
.
hours
.
ago
)
expect
(
subject
.
perform
).
to
eq
([])
end
end
spec/workers/repository_fork_worker_spec.rb
View file @
5a30e0b5
require
'spec_helper'
describe
RepositoryForkWorker
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:fork_project
)
{
create
(
:project
,
forked_from_project:
project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:fork_project
)
{
create
(
:project
,
:repository
,
forked_from_project:
project
)
}
let
(
:shell
)
{
Gitlab
::
Shell
.
new
}
subject
{
RepositoryForkWorker
.
new
}
...
...
spec/workers/repository_import_worker_spec.rb
View file @
5a30e0b5
require
'spec_helper'
describe
RepositoryImportWorker
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:
empty_
project
)
}
subject
{
described_class
.
new
}
...
...
spec/workers/update_merge_requests_worker_spec.rb
View file @
5a30e0b5
...
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
UpdateMergeRequestsWorker
do
include
RepoHelpers
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:user
)
{
create
(
:user
)
}
subject
{
described_class
.
new
}
...
...
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