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
bbeb274a
Commit
bbeb274a
authored
Feb 05, 2018
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor :trace to :trace_live in spec
parent
bb4ebd0b
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
25 additions
and
25 deletions
+25
-25
spec/controllers/projects/jobs_controller_spec.rb
spec/controllers/projects/jobs_controller_spec.rb
+5
-5
spec/factories/ci/builds.rb
spec/factories/ci/builds.rb
+2
-2
spec/features/projects/jobs_spec.rb
spec/features/projects/jobs_spec.rb
+1
-1
spec/javascripts/fixtures/jobs.rb
spec/javascripts/fixtures/jobs.rb
+1
-1
spec/models/ci/build_spec.rb
spec/models/ci/build_spec.rb
+4
-4
spec/requests/api/jobs_spec.rb
spec/requests/api/jobs_spec.rb
+5
-5
spec/requests/api/runner_spec.rb
spec/requests/api/runner_spec.rb
+3
-3
spec/requests/api/v3/builds_spec.rb
spec/requests/api/v3/builds_spec.rb
+4
-4
No files found.
spec/controllers/projects/jobs_controller_spec.rb
View file @
bbeb274a
...
@@ -171,7 +171,7 @@ describe Projects::JobsController do
...
@@ -171,7 +171,7 @@ describe Projects::JobsController do
end
end
context
'when job has a trace'
do
context
'when job has a trace'
do
let
(
:job
)
{
create
(
:ci_build
,
:trace
,
pipeline:
pipeline
)
}
let
(
:job
)
{
create
(
:ci_build
,
:trace
_live
,
pipeline:
pipeline
)
}
it
'returns a trace'
do
it
'returns a trace'
do
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
...
@@ -193,7 +193,7 @@ describe Projects::JobsController do
...
@@ -193,7 +193,7 @@ describe Projects::JobsController do
end
end
context
'when job has a trace with ANSI sequence and Unicode'
do
context
'when job has a trace with ANSI sequence and Unicode'
do
let
(
:job
)
{
create
(
:ci_build
,
:unicode_trace
,
pipeline:
pipeline
)
}
let
(
:job
)
{
create
(
:ci_build
,
:unicode_trace
_live
,
pipeline:
pipeline
)
}
it
'returns a trace with Unicode'
do
it
'returns a trace with Unicode'
do
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
...
@@ -392,7 +392,7 @@ describe Projects::JobsController do
...
@@ -392,7 +392,7 @@ describe Projects::JobsController do
end
end
context
'when job is erasable'
do
context
'when job is erasable'
do
let
(
:job
)
{
create
(
:ci_build
,
:erasable
,
:trace
,
:trace
_artifact
,
pipeline:
pipeline
)
}
let
(
:job
)
{
create
(
:ci_build
,
:erasable
,
:trace_artifact
,
pipeline:
pipeline
)
}
it
'redirects to the erased job page'
do
it
'redirects to the erased job page'
do
expect
(
response
).
to
have_gitlab_http_status
(
:found
)
expect
(
response
).
to
have_gitlab_http_status
(
:found
)
...
@@ -419,7 +419,7 @@ describe Projects::JobsController do
...
@@ -419,7 +419,7 @@ describe Projects::JobsController do
context
'when user is developer'
do
context
'when user is developer'
do
let
(
:role
)
{
:developer
}
let
(
:role
)
{
:developer
}
let
(
:job
)
{
create
(
:ci_build
,
:erasable
,
:trace
,
pipeline:
pipeline
,
user:
triggered_by
)
}
let
(
:job
)
{
create
(
:ci_build
,
:erasable
,
:trace
_artifact
,
pipeline:
pipeline
,
user:
triggered_by
)
}
context
'when triggered by same user'
do
context
'when triggered by same user'
do
let
(
:triggered_by
)
{
user
}
let
(
:triggered_by
)
{
user
}
...
@@ -461,7 +461,7 @@ describe Projects::JobsController do
...
@@ -461,7 +461,7 @@ describe Projects::JobsController do
end
end
context
'when job has a trace file'
do
context
'when job has a trace file'
do
let
(
:job
)
{
create
(
:ci_build
,
:trace
,
pipeline:
pipeline
)
}
let
(
:job
)
{
create
(
:ci_build
,
:trace
_live
,
pipeline:
pipeline
)
}
it
'send a trace file'
do
it
'send a trace file'
do
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
...
...
spec/factories/ci/builds.rb
View file @
bbeb274a
...
@@ -135,7 +135,7 @@ FactoryBot.define do
...
@@ -135,7 +135,7 @@ FactoryBot.define do
coverage_regex
'/(d+)/'
coverage_regex
'/(d+)/'
end
end
trait
:trace
do
trait
:trace
_live
do
after
(
:create
)
do
|
build
,
evaluator
|
after
(
:create
)
do
|
build
,
evaluator
|
build
.
trace
.
set
(
'BUILD TRACE'
)
build
.
trace
.
set
(
'BUILD TRACE'
)
end
end
...
@@ -147,7 +147,7 @@ FactoryBot.define do
...
@@ -147,7 +147,7 @@ FactoryBot.define do
end
end
end
end
trait
:unicode_trace
do
trait
:unicode_trace
_live
do
after
(
:create
)
do
|
build
,
evaluator
|
after
(
:create
)
do
|
build
,
evaluator
|
trace
=
File
.
binread
(
trace
=
File
.
binread
(
File
.
expand_path
(
File
.
expand_path
(
...
...
spec/features/projects/jobs_spec.rb
View file @
bbeb274a
...
@@ -7,7 +7,7 @@ feature 'Jobs' do
...
@@ -7,7 +7,7 @@ feature 'Jobs' do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:pipeline
)
{
create
(
:ci_pipeline
,
project:
project
)
}
let
(
:pipeline
)
{
create
(
:ci_pipeline
,
project:
project
)
}
let
(
:job
)
{
create
(
:ci_build
,
:trace
,
pipeline:
pipeline
)
}
let
(
:job
)
{
create
(
:ci_build
,
:trace
_live
,
pipeline:
pipeline
)
}
let
(
:job2
)
{
create
(
:ci_build
)
}
let
(
:job2
)
{
create
(
:ci_build
)
}
let
(
:artifacts_file
)
do
let
(
:artifacts_file
)
do
...
...
spec/javascripts/fixtures/jobs.rb
View file @
bbeb274a
...
@@ -7,7 +7,7 @@ describe Projects::JobsController, '(JavaScript fixtures)', type: :controller do
...
@@ -7,7 +7,7 @@ describe Projects::JobsController, '(JavaScript fixtures)', type: :controller do
let
(
:namespace
)
{
create
(
:namespace
,
name:
'frontend-fixtures'
)}
let
(
:namespace
)
{
create
(
:namespace
,
name:
'frontend-fixtures'
)}
let
(
:project
)
{
create
(
:project_empty_repo
,
namespace:
namespace
,
path:
'builds-project'
)
}
let
(
:project
)
{
create
(
:project_empty_repo
,
namespace:
namespace
,
path:
'builds-project'
)
}
let
(
:pipeline
)
{
create
(
:ci_empty_pipeline
,
project:
project
)
}
let
(
:pipeline
)
{
create
(
:ci_empty_pipeline
,
project:
project
)
}
let!
(
:build_with_artifacts
)
{
create
(
:ci_build
,
:success
,
:artifacts
,
:trace
,
pipeline:
pipeline
,
stage:
'test'
,
artifacts_expire_at:
Time
.
now
+
18
.
months
)
}
let!
(
:build_with_artifacts
)
{
create
(
:ci_build
,
:success
,
:artifacts
,
:trace
_artifact
,
pipeline:
pipeline
,
stage:
'test'
,
artifacts_expire_at:
Time
.
now
+
18
.
months
)
}
let!
(
:failed_build
)
{
create
(
:ci_build
,
:failed
,
pipeline:
pipeline
,
stage:
'build'
)
}
let!
(
:failed_build
)
{
create
(
:ci_build
,
:failed
,
pipeline:
pipeline
,
stage:
'build'
)
}
let!
(
:pending_build
)
{
create
(
:ci_build
,
:pending
,
pipeline:
pipeline
,
stage:
'deploy'
)
}
let!
(
:pending_build
)
{
create
(
:ci_build
,
:pending
,
pipeline:
pipeline
,
stage:
'deploy'
)
}
...
...
spec/models/ci/build_spec.rb
View file @
bbeb274a
...
@@ -675,7 +675,7 @@ describe Ci::Build do
...
@@ -675,7 +675,7 @@ describe Ci::Build do
context
'build is erasable'
do
context
'build is erasable'
do
context
'new artifacts'
do
context
'new artifacts'
do
let!
(
:build
)
{
create
(
:ci_build
,
:trace
,
:trace
_artifact
,
:success
,
:artifacts
)
}
let!
(
:build
)
{
create
(
:ci_build
,
:trace_artifact
,
:success
,
:artifacts
)
}
describe
'#erase'
do
describe
'#erase'
do
before
do
before
do
...
@@ -709,7 +709,7 @@ describe Ci::Build do
...
@@ -709,7 +709,7 @@ describe Ci::Build do
end
end
describe
'#erased?'
do
describe
'#erased?'
do
let!
(
:build
)
{
create
(
:ci_build
,
:trace
,
:trace
_artifact
,
:success
,
:artifacts
)
}
let!
(
:build
)
{
create
(
:ci_build
,
:trace_artifact
,
:success
,
:artifacts
)
}
subject
{
build
.
erased?
}
subject
{
build
.
erased?
}
context
'job has not been erased'
do
context
'job has not been erased'
do
...
@@ -744,7 +744,7 @@ describe Ci::Build do
...
@@ -744,7 +744,7 @@ describe Ci::Build do
context
'old artifacts'
do
context
'old artifacts'
do
context
'build is erasable'
do
context
'build is erasable'
do
context
'new artifacts'
do
context
'new artifacts'
do
let!
(
:build
)
{
create
(
:ci_build
,
:trace
,
:success
,
:legacy_artifacts
)
}
let!
(
:build
)
{
create
(
:ci_build
,
:trace
_artifact
,
:success
,
:legacy_artifacts
)
}
describe
'#erase'
do
describe
'#erase'
do
before
do
before
do
...
@@ -778,7 +778,7 @@ describe Ci::Build do
...
@@ -778,7 +778,7 @@ describe Ci::Build do
end
end
describe
'#erased?'
do
describe
'#erased?'
do
let!
(
:build
)
{
create
(
:ci_build
,
:trace
,
:success
,
:legacy_artifacts
)
}
let!
(
:build
)
{
create
(
:ci_build
,
:trace
_artifact
,
:success
,
:legacy_artifacts
)
}
subject
{
build
.
erased?
}
subject
{
build
.
erased?
}
context
'job has not been erased'
do
context
'job has not been erased'
do
...
...
spec/requests/api/jobs_spec.rb
View file @
bbeb274a
...
@@ -461,7 +461,7 @@ describe API::Jobs do
...
@@ -461,7 +461,7 @@ describe API::Jobs do
end
end
context
'when trace is file'
do
context
'when trace is file'
do
let
(
:job
)
{
create
(
:ci_build
,
:trace
,
pipeline:
pipeline
)
}
let
(
:job
)
{
create
(
:ci_build
,
:trace
_live
,
pipeline:
pipeline
)
}
it
'returns specific job trace'
do
it
'returns specific job trace'
do
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
...
@@ -554,7 +554,7 @@ describe API::Jobs do
...
@@ -554,7 +554,7 @@ describe API::Jobs do
end
end
context
'job is erasable'
do
context
'job is erasable'
do
let
(
:job
)
{
create
(
:ci_build
,
:trace
,
:trace
_artifact
,
:artifacts
,
:success
,
project:
project
,
pipeline:
pipeline
)
}
let
(
:job
)
{
create
(
:ci_build
,
:trace_artifact
,
:artifacts
,
:success
,
project:
project
,
pipeline:
pipeline
)
}
it
'erases job content'
do
it
'erases job content'
do
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
response
).
to
have_gitlab_http_status
(
201
)
...
@@ -572,7 +572,7 @@ describe API::Jobs do
...
@@ -572,7 +572,7 @@ describe API::Jobs do
end
end
context
'job is not erasable'
do
context
'job is not erasable'
do
let
(
:job
)
{
create
(
:ci_build
,
:trace
,
project:
project
,
pipeline:
pipeline
)
}
let
(
:job
)
{
create
(
:ci_build
,
:trace
_live
,
project:
project
,
pipeline:
pipeline
)
}
it
'responds with forbidden'
do
it
'responds with forbidden'
do
expect
(
response
).
to
have_gitlab_http_status
(
403
)
expect
(
response
).
to
have_gitlab_http_status
(
403
)
...
@@ -581,7 +581,7 @@ describe API::Jobs do
...
@@ -581,7 +581,7 @@ describe API::Jobs do
context
'when a developer erases a build'
do
context
'when a developer erases a build'
do
let
(
:role
)
{
:developer
}
let
(
:role
)
{
:developer
}
let
(
:job
)
{
create
(
:ci_build
,
:trace
,
:trace
_artifact
,
:artifacts
,
:success
,
project:
project
,
pipeline:
pipeline
,
user:
owner
)
}
let
(
:job
)
{
create
(
:ci_build
,
:trace_artifact
,
:artifacts
,
:success
,
project:
project
,
pipeline:
pipeline
,
user:
owner
)
}
context
'when the build was created by the developer'
do
context
'when the build was created by the developer'
do
let
(
:owner
)
{
user
}
let
(
:owner
)
{
user
}
...
@@ -604,7 +604,7 @@ describe API::Jobs do
...
@@ -604,7 +604,7 @@ describe API::Jobs do
context
'artifacts did not expire'
do
context
'artifacts did not expire'
do
let
(
:job
)
do
let
(
:job
)
do
create
(
:ci_build
,
:trace
,
:artifacts
,
:success
,
create
(
:ci_build
,
:trace
_artifact
,
:artifacts
,
:success
,
project:
project
,
pipeline:
pipeline
,
artifacts_expire_at:
Time
.
now
+
7
.
days
)
project:
project
,
pipeline:
pipeline
,
artifacts_expire_at:
Time
.
now
+
7
.
days
)
end
end
...
...
spec/requests/api/runner_spec.rb
View file @
bbeb274a
...
@@ -638,7 +638,7 @@ describe API::Runner do
...
@@ -638,7 +638,7 @@ describe API::Runner do
end
end
describe
'PUT /api/v4/jobs/:id'
do
describe
'PUT /api/v4/jobs/:id'
do
let
(
:job
)
{
create
(
:ci_build
,
:pending
,
:trace
,
pipeline:
pipeline
,
runner_id:
runner
.
id
)
}
let
(
:job
)
{
create
(
:ci_build
,
:pending
,
:trace
_live
,
pipeline:
pipeline
,
runner_id:
runner
.
id
)
}
before
do
before
do
job
.
run!
job
.
run!
...
@@ -719,7 +719,7 @@ describe API::Runner do
...
@@ -719,7 +719,7 @@ describe API::Runner do
end
end
describe
'PATCH /api/v4/jobs/:id/trace'
do
describe
'PATCH /api/v4/jobs/:id/trace'
do
let
(
:job
)
{
create
(
:ci_build
,
:running
,
:trace
,
runner_id:
runner
.
id
,
pipeline:
pipeline
)
}
let
(
:job
)
{
create
(
:ci_build
,
:running
,
:trace
_live
,
runner_id:
runner
.
id
,
pipeline:
pipeline
)
}
let
(
:headers
)
{
{
API
::
Helpers
::
Runner
::
JOB_TOKEN_HEADER
=>
job
.
token
,
'Content-Type'
=>
'text/plain'
}
}
let
(
:headers
)
{
{
API
::
Helpers
::
Runner
::
JOB_TOKEN_HEADER
=>
job
.
token
,
'Content-Type'
=>
'text/plain'
}
}
let
(
:headers_with_range
)
{
headers
.
merge
({
'Content-Range'
=>
'11-20'
})
}
let
(
:headers_with_range
)
{
headers
.
merge
({
'Content-Range'
=>
'11-20'
})
}
let
(
:update_interval
)
{
10
.
seconds
.
to_i
}
let
(
:update_interval
)
{
10
.
seconds
.
to_i
}
...
@@ -780,7 +780,7 @@ describe API::Runner do
...
@@ -780,7 +780,7 @@ describe API::Runner do
context
'when project for the build has been deleted'
do
context
'when project for the build has been deleted'
do
let
(
:job
)
do
let
(
:job
)
do
create
(
:ci_build
,
:running
,
:trace
,
runner_id:
runner
.
id
,
pipeline:
pipeline
)
do
|
job
|
create
(
:ci_build
,
:running
,
:trace
_live
,
runner_id:
runner
.
id
,
pipeline:
pipeline
)
do
|
job
|
job
.
project
.
update
(
pending_delete:
true
)
job
.
project
.
update
(
pending_delete:
true
)
end
end
end
end
...
...
spec/requests/api/v3/builds_spec.rb
View file @
bbeb274a
...
@@ -352,7 +352,7 @@ describe API::V3::Builds do
...
@@ -352,7 +352,7 @@ describe API::V3::Builds do
end
end
describe
'GET /projects/:id/builds/:build_id/trace'
do
describe
'GET /projects/:id/builds/:build_id/trace'
do
let
(
:build
)
{
create
(
:ci_build
,
:trace
,
pipeline:
pipeline
)
}
let
(
:build
)
{
create
(
:ci_build
,
:trace
_live
,
pipeline:
pipeline
)
}
before
do
before
do
get
v3_api
(
"/projects/
#{
project
.
id
}
/builds/
#{
build
.
id
}
/trace"
,
api_user
)
get
v3_api
(
"/projects/
#{
project
.
id
}
/builds/
#{
build
.
id
}
/trace"
,
api_user
)
...
@@ -447,7 +447,7 @@ describe API::V3::Builds do
...
@@ -447,7 +447,7 @@ describe API::V3::Builds do
end
end
context
'job is erasable'
do
context
'job is erasable'
do
let
(
:build
)
{
create
(
:ci_build
,
:trace
,
:artifacts
,
:success
,
project:
project
,
pipeline:
pipeline
)
}
let
(
:build
)
{
create
(
:ci_build
,
:trace
_artifact
,
:artifacts
,
:success
,
project:
project
,
pipeline:
pipeline
)
}
it
'erases job content'
do
it
'erases job content'
do
expect
(
response
.
status
).
to
eq
201
expect
(
response
.
status
).
to
eq
201
...
@@ -463,7 +463,7 @@ describe API::V3::Builds do
...
@@ -463,7 +463,7 @@ describe API::V3::Builds do
end
end
context
'job is not erasable'
do
context
'job is not erasable'
do
let
(
:build
)
{
create
(
:ci_build
,
:trace
,
project:
project
,
pipeline:
pipeline
)
}
let
(
:build
)
{
create
(
:ci_build
,
:trace
_live
,
project:
project
,
pipeline:
pipeline
)
}
it
'responds with forbidden'
do
it
'responds with forbidden'
do
expect
(
response
.
status
).
to
eq
403
expect
(
response
.
status
).
to
eq
403
...
@@ -478,7 +478,7 @@ describe API::V3::Builds do
...
@@ -478,7 +478,7 @@ describe API::V3::Builds do
context
'artifacts did not expire'
do
context
'artifacts did not expire'
do
let
(
:build
)
do
let
(
:build
)
do
create
(
:ci_build
,
:trace
,
:artifacts
,
:success
,
create
(
:ci_build
,
:trace
_artifact
,
:artifacts
,
:success
,
project:
project
,
pipeline:
pipeline
,
artifacts_expire_at:
Time
.
now
+
7
.
days
)
project:
project
,
pipeline:
pipeline
,
artifacts_expire_at:
Time
.
now
+
7
.
days
)
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