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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
28553dbc
Commit
28553dbc
authored
Jul 04, 2017
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update tests due to permission changes
parent
005870d5
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
51 additions
and
46 deletions
+51
-46
spec/controllers/projects/jobs_controller_spec.rb
spec/controllers/projects/jobs_controller_spec.rb
+5
-5
spec/controllers/projects/pipelines_controller_spec.rb
spec/controllers/projects/pipelines_controller_spec.rb
+4
-4
spec/lib/gitlab/ci/status/build/cancelable_spec.rb
spec/lib/gitlab/ci/status/build/cancelable_spec.rb
+1
-1
spec/lib/gitlab/ci/status/build/factory_spec.rb
spec/lib/gitlab/ci/status/build/factory_spec.rb
+17
-8
spec/lib/gitlab/ci/status/build/retryable_spec.rb
spec/lib/gitlab/ci/status/build/retryable_spec.rb
+1
-1
spec/lib/gitlab/ci/status/build/stop_spec.rb
spec/lib/gitlab/ci/status/build/stop_spec.rb
+1
-1
spec/models/ci/pipeline_spec.rb
spec/models/ci/pipeline_spec.rb
+2
-2
spec/serializers/job_entity_spec.rb
spec/serializers/job_entity_spec.rb
+5
-1
spec/serializers/pipeline_details_entity_spec.rb
spec/serializers/pipeline_details_entity_spec.rb
+3
-3
spec/serializers/pipeline_entity_spec.rb
spec/serializers/pipeline_entity_spec.rb
+2
-2
spec/services/ci/process_pipeline_service_spec.rb
spec/services/ci/process_pipeline_service_spec.rb
+1
-1
spec/services/ci/retry_build_service_spec.rb
spec/services/ci/retry_build_service_spec.rb
+2
-2
spec/services/ci/retry_pipeline_service_spec.rb
spec/services/ci/retry_pipeline_service_spec.rb
+6
-14
spec/services/create_deployment_service_spec.rb
spec/services/create_deployment_service_spec.rb
+1
-1
No files found.
spec/controllers/projects/jobs_controller_spec.rb
View file @
28553dbc
...
...
@@ -218,7 +218,7 @@ describe Projects::JobsController do
describe
'POST retry'
do
before
do
project
.
add_
develop
er
(
user
)
project
.
add_
mast
er
(
user
)
sign_in
(
user
)
post_retry
...
...
@@ -250,7 +250,7 @@ describe Projects::JobsController do
describe
'POST play'
do
before
do
project
.
add_
develop
er
(
user
)
project
.
add_
mast
er
(
user
)
create
(
:protected_branch
,
:developers_can_merge
,
name:
'master'
,
project:
project
)
...
...
@@ -290,7 +290,7 @@ describe Projects::JobsController do
describe
'POST cancel'
do
before
do
project
.
add_
develop
er
(
user
)
project
.
add_
mast
er
(
user
)
sign_in
(
user
)
post_cancel
...
...
@@ -326,7 +326,7 @@ describe Projects::JobsController do
describe
'POST cancel_all'
do
before
do
project
.
add_
develop
er
(
user
)
project
.
add_
mast
er
(
user
)
sign_in
(
user
)
end
...
...
@@ -368,7 +368,7 @@ describe Projects::JobsController do
describe
'POST erase'
do
before
do
project
.
add_
develop
er
(
user
)
project
.
add_
mast
er
(
user
)
sign_in
(
user
)
post_erase
...
...
spec/controllers/projects/pipelines_controller_spec.rb
View file @
28553dbc
...
...
@@ -8,7 +8,7 @@ describe Projects::PipelinesController do
let
(
:feature
)
{
ProjectFeature
::
DISABLED
}
before
do
project
.
add_
develop
er
(
user
)
project
.
add_
mast
er
(
user
)
project
.
project_feature
.
update
(
builds_access_level:
feature
)
...
...
@@ -158,7 +158,7 @@ describe Projects::PipelinesController do
context
'when builds are enabled'
do
let
(
:feature
)
{
ProjectFeature
::
ENABLED
}
it
'retries a pipeline without returning any content'
do
expect
(
response
).
to
have_http_status
(
:no_content
)
expect
(
build
.
reload
).
to
be_retried
...
...
@@ -175,7 +175,7 @@ describe Projects::PipelinesController do
describe
'POST cancel.json'
do
let!
(
:pipeline
)
{
create
(
:ci_pipeline
,
project:
project
)
}
let!
(
:build
)
{
create
(
:ci_build
,
:running
,
pipeline:
pipeline
)
}
before
do
post
:cancel
,
namespace_id:
project
.
namespace
,
project_id:
project
,
...
...
@@ -185,7 +185,7 @@ describe Projects::PipelinesController do
context
'when builds are enabled'
do
let
(
:feature
)
{
ProjectFeature
::
ENABLED
}
it
'cancels a pipeline without returning any content'
do
expect
(
response
).
to
have_http_status
(
:no_content
)
expect
(
pipeline
.
reload
).
to
be_canceled
...
...
spec/lib/gitlab/ci/status/build/cancelable_spec.rb
View file @
28553dbc
...
...
@@ -48,7 +48,7 @@ describe Gitlab::Ci::Status::Build::Cancelable do
describe
'#has_action?'
do
context
'when user is allowed to update build'
do
before
do
build
.
project
.
team
<<
[
user
,
:developer
]
build
.
project
.
add_master
(
user
)
end
it
{
is_expected
.
to
have_action
}
...
...
spec/lib/gitlab/ci/status/build/factory_spec.rb
View file @
28553dbc
...
...
@@ -7,7 +7,7 @@ describe Gitlab::Ci::Status::Build::Factory do
let
(
:factory
)
{
described_class
.
new
(
build
,
user
)
}
before
do
project
.
team
<<
[
user
,
:developer
]
project
.
add_master
(
user
)
end
context
'when build is successful'
do
...
...
@@ -225,19 +225,20 @@ describe Gitlab::Ci::Status::Build::Factory do
end
context
'when user has ability to play action'
do
before
do
project
.
add_developer
(
user
)
create
(
:protected_branch
,
:developers_can_merge
,
name:
build
.
ref
,
project:
project
)
end
it
'fabricates status that has action'
do
expect
(
status
).
to
have_action
end
end
context
'when user does not have ability to play action'
do
before
do
project
.
team
.
truncate
project
.
add_developer
(
user
)
create
(
:protected_branch
,
:no_one_can_push
,
name:
build
.
ref
,
project:
project
)
end
it
'fabricates status that has no action'
do
expect
(
status
).
not_to
have_action
end
...
...
@@ -262,6 +263,14 @@ describe Gitlab::Ci::Status::Build::Factory do
end
context
'when user is not allowed to execute manual action'
do
before
do
project
.
team
.
truncate
project
.
add_developer
(
user
)
create
(
:protected_branch
,
:no_one_can_push
,
name:
build
.
ref
,
project:
project
)
end
it
'fabricates status with correct details'
do
expect
(
status
.
text
).
to
eq
'manual'
expect
(
status
.
group
).
to
eq
'manual'
...
...
spec/lib/gitlab/ci/status/build/retryable_spec.rb
View file @
28553dbc
...
...
@@ -48,7 +48,7 @@ describe Gitlab::Ci::Status::Build::Retryable do
describe
'#has_action?'
do
context
'when user is allowed to update build'
do
before
do
build
.
project
.
team
<<
[
user
,
:developer
]
build
.
project
.
add_master
(
user
)
end
it
{
is_expected
.
to
have_action
}
...
...
spec/lib/gitlab/ci/status/build/stop_spec.rb
View file @
28553dbc
...
...
@@ -20,7 +20,7 @@ describe Gitlab::Ci::Status::Build::Stop do
describe
'#has_action?'
do
context
'when user is allowed to update build'
do
before
do
build
.
project
.
team
<<
[
user
,
:developer
]
build
.
project
.
add_master
(
user
)
end
it
{
is_expected
.
to
have_action
}
...
...
spec/models/ci/pipeline_spec.rb
View file @
28553dbc
...
...
@@ -832,7 +832,7 @@ describe Ci::Pipeline, models: true do
context
'on failure and build retry'
do
before
do
build
.
drop
project
.
add_
develop
er
(
user
)
project
.
add_
mast
er
(
user
)
Ci
::
Build
.
retry
(
build
,
user
)
end
...
...
@@ -1063,7 +1063,7 @@ describe Ci::Pipeline, models: true do
let
(
:latest_status
)
{
pipeline
.
statuses
.
latest
.
pluck
(
:status
)
}
before
do
project
.
add_
develop
er
(
user
)
project
.
add_
mast
er
(
user
)
end
context
'when there is a failed build and failed external status'
do
...
...
spec/serializers/job_entity_spec.rb
View file @
28553dbc
...
...
@@ -8,7 +8,7 @@ describe JobEntity do
before
do
allow
(
request
).
to
receive
(
:current_user
).
and_return
(
user
)
project
.
add_
develop
er
(
user
)
project
.
add_
mast
er
(
user
)
end
let
(
:entity
)
do
...
...
@@ -90,6 +90,10 @@ describe JobEntity do
end
context
'when user is not allowed to trigger action'
do
before
do
project
.
team
.
truncate
end
it
'does not contain path to play action'
do
expect
(
subject
).
not_to
include
(
:play_path
)
end
...
...
spec/serializers/pipeline_details_entity_spec.rb
View file @
28553dbc
...
...
@@ -52,7 +52,7 @@ describe PipelineDetailsEntity do
context
'user has ability to retry pipeline'
do
before
do
project
.
team
<<
[
user
,
:developer
]
project
.
add_master
(
user
)
end
it
'retryable flag is true'
do
...
...
@@ -80,7 +80,7 @@ describe PipelineDetailsEntity do
context
'user has ability to cancel pipeline'
do
before
do
project
.
add_
develop
er
(
user
)
project
.
add_
mast
er
(
user
)
end
it
'cancelable flag is true'
do
...
...
@@ -97,7 +97,7 @@ describe PipelineDetailsEntity do
context
'when pipeline has commit statuses'
do
let
(
:pipeline
)
{
create
(
:ci_empty_pipeline
)
}
before
do
create
(
:generic_commit_status
,
pipeline:
pipeline
)
end
...
...
spec/serializers/pipeline_entity_spec.rb
View file @
28553dbc
...
...
@@ -52,7 +52,7 @@ describe PipelineEntity do
context
'user has ability to retry pipeline'
do
before
do
project
.
team
<<
[
user
,
:developer
]
project
.
add_master
(
user
)
end
it
'contains retry path'
do
...
...
@@ -80,7 +80,7 @@ describe PipelineEntity do
context
'user has ability to cancel pipeline'
do
before
do
project
.
add_
develop
er
(
user
)
project
.
add_
mast
er
(
user
)
end
it
'contains cancel path'
do
...
...
spec/services/ci/process_pipeline_service_spec.rb
View file @
28553dbc
...
...
@@ -9,7 +9,7 @@ describe Ci::ProcessPipelineService, '#execute', :services do
end
before
do
project
.
add_
develop
er
(
user
)
project
.
add_
mast
er
(
user
)
end
context
'when simple pipeline is defined'
do
...
...
spec/services/ci/retry_build_service_spec.rb
View file @
28553dbc
...
...
@@ -85,7 +85,7 @@ describe Ci::RetryBuildService, :services do
context
'when user has ability to execute build'
do
before
do
project
.
add_
develop
er
(
user
)
project
.
add_
mast
er
(
user
)
end
it_behaves_like
'build duplication'
...
...
@@ -131,7 +131,7 @@ describe Ci::RetryBuildService, :services do
context
'when user has ability to execute build'
do
before
do
project
.
add_
develop
er
(
user
)
project
.
add_
mast
er
(
user
)
end
it_behaves_like
'build duplication'
...
...
spec/services/ci/retry_pipeline_service_spec.rb
View file @
28553dbc
...
...
@@ -244,13 +244,9 @@ describe Ci::RetryPipelineService, '#execute', :services do
create_build
(
'verify'
,
:canceled
,
1
)
end
it
'does not reprocess manual action'
do
service
.
execute
(
pipeline
)
expect
(
build
(
'test'
)).
to
be_pending
expect
(
build
(
'deploy'
)).
to
be_failed
expect
(
build
(
'verify'
)).
to
be_created
expect
(
pipeline
.
reload
).
to
be_running
it
'raises an error'
do
expect
{
service
.
execute
(
pipeline
)
}
.
to
raise_error
Gitlab
::
Access
::
AccessDeniedError
end
end
...
...
@@ -261,13 +257,9 @@ describe Ci::RetryPipelineService, '#execute', :services do
create_build
(
'verify'
,
:canceled
,
2
)
end
it
'does not reprocess manual action'
do
service
.
execute
(
pipeline
)
expect
(
build
(
'test'
)).
to
be_pending
expect
(
build
(
'deploy'
)).
to
be_failed
expect
(
build
(
'verify'
)).
to
be_created
expect
(
pipeline
.
reload
).
to
be_running
it
'raises an error'
do
expect
{
service
.
execute
(
pipeline
)
}
.
to
raise_error
Gitlab
::
Access
::
AccessDeniedError
end
end
end
...
...
spec/services/create_deployment_service_spec.rb
View file @
28553dbc
...
...
@@ -244,7 +244,7 @@ describe CreateDeploymentService, services: true do
context
'when job is retried'
do
it_behaves_like
'creates deployment'
do
before
do
project
.
add_
develop
er
(
user
)
project
.
add_
mast
er
(
user
)
end
let
(
:deployable
)
{
Ci
::
Build
.
retry
(
job
,
user
)
}
...
...
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