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
a8594886
Commit
a8594886
authored
Mar 06, 2018
by
Micaël Bergeron
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix some broken specs
parent
b03b3165
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
31 additions
and
43 deletions
+31
-43
app/workers/object_storage/background_move_worker.rb
app/workers/object_storage/background_move_worker.rb
+0
-1
app/workers/object_storage_upload_worker.rb
app/workers/object_storage_upload_worker.rb
+0
-1
lib/gitlab/workhorse.rb
lib/gitlab/workhorse.rb
+4
-1
spec/controllers/projects/artifacts_controller_spec.rb
spec/controllers/projects/artifacts_controller_spec.rb
+1
-0
spec/models/ci/build_spec.rb
spec/models/ci/build_spec.rb
+7
-21
spec/models/ci/job_artifact_spec.rb
spec/models/ci/job_artifact_spec.rb
+5
-19
spec/requests/api/jobs_spec.rb
spec/requests/api/jobs_spec.rb
+13
-0
spec/serializers/pipeline_serializer_spec.rb
spec/serializers/pipeline_serializer_spec.rb
+1
-0
No files found.
app/workers/object_storage/background_move_worker.rb
View file @
a8594886
...
@@ -11,7 +11,6 @@ module ObjectStorage
...
@@ -11,7 +11,6 @@ module ObjectStorage
return
unless
uploader_class
<
ObjectStorage
::
Concern
return
unless
uploader_class
<
ObjectStorage
::
Concern
return
unless
uploader_class
.
object_store_enabled?
return
unless
uploader_class
.
object_store_enabled?
return
unless
uploader_class
.
licensed?
return
unless
uploader_class
.
background_upload_enabled?
return
unless
uploader_class
.
background_upload_enabled?
subject
=
subject_class
.
find
(
subject_id
)
subject
=
subject_class
.
find
(
subject_id
)
...
...
app/workers/object_storage_upload_worker.rb
View file @
a8594886
...
@@ -12,7 +12,6 @@ class ObjectStorageUploadWorker
...
@@ -12,7 +12,6 @@ class ObjectStorageUploadWorker
return
unless
uploader_class
<
ObjectStorage
::
Concern
return
unless
uploader_class
<
ObjectStorage
::
Concern
return
unless
uploader_class
.
object_store_enabled?
return
unless
uploader_class
.
object_store_enabled?
return
unless
uploader_class
.
licensed?
return
unless
uploader_class
.
background_upload_enabled?
return
unless
uploader_class
.
background_upload_enabled?
subject
=
subject_class
.
find
(
subject_id
)
subject
=
subject_class
.
find
(
subject_id
)
...
...
lib/gitlab/workhorse.rb
View file @
a8594886
...
@@ -147,8 +147,11 @@ module Gitlab
...
@@ -147,8 +147,11 @@ module Gitlab
end
end
def
send_artifacts_entry
(
build
,
entry
)
def
send_artifacts_entry
(
build
,
entry
)
file
=
build
.
artifacts_file
archive
=
file
.
file_storage?
?
file
.
path
:
file
.
url
params
=
{
params
=
{
'Archive'
=>
build
.
artifacts_file
.
path
,
'Archive'
=>
archive
,
'Entry'
=>
Base64
.
encode64
(
entry
.
to_s
)
'Entry'
=>
Base64
.
encode64
(
entry
.
to_s
)
}
}
...
...
spec/controllers/projects/artifacts_controller_spec.rb
View file @
a8594886
...
@@ -118,6 +118,7 @@ describe Projects::ArtifactsController do
...
@@ -118,6 +118,7 @@ describe Projects::ArtifactsController do
shared_examples
'a valid file'
do
shared_examples
'a valid file'
do
it
'serves the file using workhorse'
do
it
'serves the file using workhorse'
do
binding
.
pry
subject
subject
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
...
...
spec/models/ci/build_spec.rb
View file @
a8594886
...
@@ -161,21 +161,17 @@ describe Ci::Build do
...
@@ -161,21 +161,17 @@ describe Ci::Build do
end
end
end
end
context
'when legacy artifacts are used'
do
context
'artifacts archive does not exist'
do
let
(
:build
)
{
create
(
:ci_build
)
}
context
'is not expired'
do
it
{
is_expected
.
to
be_truthy
}
end
end
end
context
'when legacy artifacts are used'
do
context
'when legacy artifacts are used'
do
let
(
:build
)
{
create
(
:ci_build
,
:legacy_artifacts
)
}
let
(
:build
)
{
create
(
:ci_build
,
:legacy_artifacts
)
}
subject
{
build
.
artifacts?
}
subject
{
build
.
artifacts?
}
context
'is expired'
do
let
(
:build
)
{
create
(
:ci_build
,
:legacy_artifacts
,
:expired
)
}
it
{
is_expected
.
to
be_falsy
}
end
context
'artifacts archive does not exist'
do
context
'artifacts archive does not exist'
do
let
(
:build
)
{
create
(
:ci_build
)
}
let
(
:build
)
{
create
(
:ci_build
)
}
...
@@ -186,12 +182,6 @@ describe Ci::Build do
...
@@ -186,12 +182,6 @@ describe Ci::Build do
let
(
:build
)
{
create
(
:ci_build
,
:legacy_artifacts
)
}
let
(
:build
)
{
create
(
:ci_build
,
:legacy_artifacts
)
}
it
{
is_expected
.
to
be_truthy
}
it
{
is_expected
.
to
be_truthy
}
context
'is expired'
do
let
(
:build
)
{
create
(
:ci_build
,
:legacy_artifacts
,
:expired
)
}
it
{
is_expected
.
to
be_falsy
}
end
end
end
end
end
end
end
...
@@ -219,10 +209,6 @@ describe Ci::Build do
...
@@ -219,10 +209,6 @@ describe Ci::Build do
subject
{
build
.
downloadable_single_artifacts_file?
}
subject
{
build
.
downloadable_single_artifacts_file?
}
before
do
expect_any_instance_of
(
Ci
::
Build
).
to
receive
(
:artifacts_metadata?
).
and_call_original
end
context
'artifacts are stored locally'
do
context
'artifacts are stored locally'
do
let
(
:store
)
{
ObjectStoreUploader
::
LOCAL_STORE
}
let
(
:store
)
{
ObjectStoreUploader
::
LOCAL_STORE
}
...
...
spec/models/ci/job_artifact_spec.rb
View file @
a8594886
...
@@ -33,7 +33,6 @@ describe Ci::JobArtifact do
...
@@ -33,7 +33,6 @@ describe Ci::JobArtifact do
context
'when object storage is enabled'
do
context
'when object storage is enabled'
do
context
'when background upload is enabled'
do
context
'when background upload is enabled'
do
context
'when is licensed'
do
before
do
before
do
stub_artifacts_object_storage
(
background_upload:
true
)
stub_artifacts_object_storage
(
background_upload:
true
)
end
end
...
@@ -45,19 +44,6 @@ describe Ci::JobArtifact do
...
@@ -45,19 +44,6 @@ describe Ci::JobArtifact do
end
end
end
end
context
'when is unlicensed'
do
before
do
stub_artifacts_object_storage
(
background_upload:
true
,
licensed:
false
)
end
it
'does not schedule the migration'
do
expect
(
ObjectStorageUploadWorker
).
not_to
receive
(
:perform_async
)
subject
end
end
end
context
'when background upload is disabled'
do
context
'when background upload is disabled'
do
before
do
before
do
stub_artifacts_object_storage
(
background_upload:
false
)
stub_artifacts_object_storage
(
background_upload:
false
)
...
...
spec/requests/api/jobs_spec.rb
View file @
a8594886
...
@@ -307,6 +307,19 @@ describe API::Jobs do
...
@@ -307,6 +307,19 @@ describe API::Jobs do
end
end
describe
'GET /projects/:id/jobs/:job_id/artifacts'
do
describe
'GET /projects/:id/jobs/:job_id/artifacts'
do
shared_examples
'downloads artifact'
do
let
(
:download_headers
)
do
{
'Content-Transfer-Encoding'
=>
'binary'
,
'Content-Disposition'
=>
'attachment; filename=ci_build_artifacts.zip'
}
end
it
'returns specific job artifacts'
do
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
.
headers
).
to
include
(
download_headers
)
expect
(
response
.
body
).
to
match_file
(
job
.
artifacts_file
.
file
.
file
)
end
end
before
do
before
do
stub_artifacts_object_storage
stub_artifacts_object_storage
get
api
(
"/projects/
#{
project
.
id
}
/jobs/
#{
job
.
id
}
/artifacts"
,
api_user
)
get
api
(
"/projects/
#{
project
.
id
}
/jobs/
#{
job
.
id
}
/artifacts"
,
api_user
)
...
...
spec/serializers/pipeline_serializer_spec.rb
View file @
a8594886
...
@@ -116,6 +116,7 @@ describe PipelineSerializer do
...
@@ -116,6 +116,7 @@ describe PipelineSerializer do
shared_examples
'no N+1 queries'
do
shared_examples
'no N+1 queries'
do
it
'verifies number of queries'
,
:request_store
do
it
'verifies number of queries'
,
:request_store
do
binding
.
pry
recorded
=
ActiveRecord
::
QueryRecorder
.
new
{
subject
}
recorded
=
ActiveRecord
::
QueryRecorder
.
new
{
subject
}
expect
(
recorded
.
count
).
to
be_within
(
1
).
of
(
40
)
expect
(
recorded
.
count
).
to
be_within
(
1
).
of
(
40
)
...
...
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