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
Léo-Paul Géneau
gitlab-ce
Commits
2bf29a0c
Commit
2bf29a0c
authored
Mar 07, 2018
by
Micaël Bergeron
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix yet other specs
parent
a8594886
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
22 deletions
+30
-22
spec/models/ci/build_spec.rb
spec/models/ci/build_spec.rb
+2
-2
spec/models/ci/job_artifact_spec.rb
spec/models/ci/job_artifact_spec.rb
+2
-2
spec/requests/api/jobs_spec.rb
spec/requests/api/jobs_spec.rb
+26
-18
No files found.
spec/models/ci/build_spec.rb
View file @
2bf29a0c
...
@@ -210,13 +210,13 @@ describe Ci::Build do
...
@@ -210,13 +210,13 @@ describe Ci::Build do
subject
{
build
.
downloadable_single_artifacts_file?
}
subject
{
build
.
downloadable_single_artifacts_file?
}
context
'artifacts are stored locally'
do
context
'artifacts are stored locally'
do
let
(
:store
)
{
ObjectStor
eUploader
::
LOCAL_STORE
}
let
(
:store
)
{
ObjectStor
age
::
Store
::
LOCAL
}
it
{
is_expected
.
to
be_truthy
}
it
{
is_expected
.
to
be_truthy
}
end
end
context
'artifacts are stored remotely'
do
context
'artifacts are stored remotely'
do
let
(
:store
)
{
ObjectStor
eUploader
::
REMOTE_STOR
E
}
let
(
:store
)
{
ObjectStor
age
::
Store
::
REMOT
E
}
before
do
before
do
stub_artifacts_object_storage
stub_artifacts_object_storage
...
...
spec/models/ci/job_artifact_spec.rb
View file @
2bf29a0c
...
@@ -38,7 +38,7 @@ describe Ci::JobArtifact do
...
@@ -38,7 +38,7 @@ describe Ci::JobArtifact do
end
end
it
'schedules the model for migration'
do
it
'schedules the model for migration'
do
expect
(
ObjectStorage
Upload
Worker
).
to
receive
(
:perform_async
).
with
(
'JobArtifactUploader'
,
described_class
.
name
,
:file
,
kind_of
(
Numeric
))
expect
(
ObjectStorage
::
BackgroundMove
Worker
).
to
receive
(
:perform_async
).
with
(
'JobArtifactUploader'
,
described_class
.
name
,
:file
,
kind_of
(
Numeric
))
subject
subject
end
end
...
@@ -50,7 +50,7 @@ describe Ci::JobArtifact do
...
@@ -50,7 +50,7 @@ describe Ci::JobArtifact do
end
end
it
'schedules the model for migration'
do
it
'schedules the model for migration'
do
expect
(
ObjectStorage
Upload
Worker
).
not_to
receive
(
:perform_async
)
expect
(
ObjectStorage
::
BackgroundMove
Worker
).
not_to
receive
(
:perform_async
)
subject
subject
end
end
...
...
spec/requests/api/jobs_spec.rb
View file @
2bf29a0c
...
@@ -19,12 +19,8 @@ describe API::Jobs do
...
@@ -19,12 +19,8 @@ describe API::Jobs do
let
(
:api_user
)
{
user
}
let
(
:api_user
)
{
user
}
let
(
:reporter
)
{
create
(
:project_member
,
:reporter
,
project:
project
).
user
}
let
(
:reporter
)
{
create
(
:project_member
,
:reporter
,
project:
project
).
user
}
let
(
:guest
)
{
create
(
:project_member
,
:guest
,
project:
project
).
user
}
let
(
:guest
)
{
create
(
:project_member
,
:guest
,
project:
project
).
user
}
let
(
:cross_project_pipeline_enabled
)
{
true
}
let
(
:object_storage_enabled
)
{
true
}
before
do
before
do
stub_licensed_features
(
cross_project_pipelines:
cross_project_pipeline_enabled
,
object_storage:
object_storage_enabled
)
project
.
add_developer
(
user
)
project
.
add_developer
(
user
)
end
end
...
@@ -326,10 +322,6 @@ describe API::Jobs do
...
@@ -326,10 +322,6 @@ describe API::Jobs do
end
end
context
'normal authentication'
do
context
'normal authentication'
do
before
do
stub_artifacts_object_storage
end
context
'job with artifacts'
do
context
'job with artifacts'
do
context
'when artifacts are stored locally'
do
context
'when artifacts are stored locally'
do
let
(
:job
)
{
create
(
:ci_build
,
:artifacts
,
pipeline:
pipeline
)
}
let
(
:job
)
{
create
(
:ci_build
,
:artifacts
,
pipeline:
pipeline
)
}
...
@@ -342,14 +334,20 @@ describe API::Jobs do
...
@@ -342,14 +334,20 @@ describe API::Jobs do
it_behaves_like
'downloads artifact'
it_behaves_like
'downloads artifact'
end
end
it
'returns specific job artifacts'
do
context
'unauthorized user'
do
expect
(
response
).
to
have_http_status
(
200
)
let
(
:api_user
)
{
nil
}
expect
(
response
.
headers
).
to
include
(
download_headers
)
expect
(
response
.
body
).
to
match_file
(
job
.
artifacts_file
.
file
.
file
)
it
'does not return specific job artifacts'
do
expect
(
response
).
to
have_gitlab_http_status
(
404
)
end
end
end
end
end
context
'when artifacts are stored remotely'
do
context
'when artifacts are stored remotely'
do
before
do
stub_artifacts_object_storage
end
let
(
:job
)
{
create
(
:ci_build
,
pipeline:
pipeline
)
}
let
(
:job
)
{
create
(
:ci_build
,
pipeline:
pipeline
)
}
let!
(
:artifact
)
{
create
(
:ci_job_artifact
,
:archive
,
:remote_store
,
job:
job
)
}
let!
(
:artifact
)
{
create
(
:ci_job_artifact
,
:archive
,
:remote_store
,
job:
job
)
}
...
@@ -359,15 +357,25 @@ describe API::Jobs do
...
@@ -359,15 +357,25 @@ describe API::Jobs do
get
api
(
"/projects/
#{
project
.
id
}
/jobs/
#{
job
.
id
}
/artifacts"
,
api_user
)
get
api
(
"/projects/
#{
project
.
id
}
/jobs/
#{
job
.
id
}
/artifacts"
,
api_user
)
end
end
context
'authorized user'
do
it
'returns the file remote URL'
do
expect
(
response
).
to
redirect_to
(
artifact
.
file
.
url
)
end
end
context
'unauthorized user'
do
let
(
:api_user
)
{
nil
}
it
'does not return specific job artifacts'
do
it
'does not return specific job artifacts'
do
expect
(
response
).
to
have_http_status
(
401
)
expect
(
response
).
to
have_gitlab_http_status
(
404
)
end
end
end
end
end
it
'does not return job artifacts if not uploaded'
do
it
'does not return job artifacts if not uploaded'
do
get
api
(
"/projects/
#{
project
.
id
}
/jobs/
#{
job
.
id
}
/artifacts"
,
api_user
)
get
api
(
"/projects/
#{
project
.
id
}
/jobs/
#{
job
.
id
}
/artifacts"
,
api_user
)
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
end
end
end
...
@@ -378,7 +386,7 @@ describe API::Jobs do
...
@@ -378,7 +386,7 @@ describe API::Jobs do
let
(
:job
)
{
create
(
:ci_build
,
:artifacts
,
pipeline:
pipeline
,
user:
api_user
)
}
let
(
:job
)
{
create
(
:ci_build
,
:artifacts
,
pipeline:
pipeline
,
user:
api_user
)
}
before
do
before
do
stub_artifacts_object_storage
(
licensed: :skip
)
stub_artifacts_object_storage
job
.
success
job
.
success
end
end
...
@@ -442,7 +450,7 @@ describe API::Jobs do
...
@@ -442,7 +450,7 @@ describe API::Jobs do
"attachment; filename=
#{
job
.
artifacts_file
.
filename
}
"
}
"attachment; filename=
#{
job
.
artifacts_file
.
filename
}
"
}
end
end
it
{
expect
(
response
).
to
have_http_status
(
200
)
}
it
{
expect
(
response
).
to
have_http_status
(
:ok
)
}
it
{
expect
(
response
.
headers
).
to
include
(
download_headers
)
}
it
{
expect
(
response
.
headers
).
to
include
(
download_headers
)
}
end
end
...
@@ -457,7 +465,7 @@ describe API::Jobs do
...
@@ -457,7 +465,7 @@ describe API::Jobs do
end
end
it
'returns location redirect'
do
it
'returns location redirect'
do
expect
(
response
).
to
have_http_status
(
302
)
expect
(
response
).
to
have_http_status
(
:found
)
end
end
end
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