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
954249ae
Commit
954249ae
authored
Nov 23, 2017
by
ayufanpl
Committed by
Kamil Trzcinski
Dec 03, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix tests
parent
01fe6506
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
19 deletions
+22
-19
spec/controllers/projects/artifacts_controller_spec.rb
spec/controllers/projects/artifacts_controller_spec.rb
+2
-1
spec/tasks/gitlab/artifacts_rake_spec.rb
spec/tasks/gitlab/artifacts_rake_spec.rb
+19
-17
spec/workers/object_storage_upload_worker_spec.rb
spec/workers/object_storage_upload_worker_spec.rb
+1
-1
No files found.
spec/controllers/projects/artifacts_controller_spec.rb
View file @
954249ae
...
...
@@ -118,9 +118,10 @@ describe Projects::ArtifactsController do
context
'when the file exists'
do
let
(
:path
)
{
'ci_artifacts.txt'
}
let
(
:job
)
{
create
(
:ci_build
,
:success
,
pipeline:
pipeline
)
}
let!
(
:artifact
)
{
create
(
:ci_job_artifact
,
job:
job
,
file_store:
store
)
}
shared_examples
'a valid file'
do
let!
(
:artifact
)
{
create
(
:ci_job_artifact
,
job:
job
,
file_store:
store
)
}
it
'serves the file using workhorse'
do
subject
...
...
spec/tasks/gitlab/artifacts_rake_spec.rb
View file @
954249ae
...
...
@@ -5,6 +5,12 @@ describe 'gitlab:artifacts namespace rake task' do
Rake
.
application
.
rake_require
'tasks/gitlab/artifacts'
end
let
(
:object_storage_enabled
)
{
false
}
before
do
stub_artifacts_object_storage
(
enabled:
object_storage_enabled
)
end
subject
{
run_rake_task
(
'gitlab:artifacts:migrate'
)
}
context
'legacy artifacts'
do
...
...
@@ -13,7 +19,7 @@ describe 'gitlab:artifacts namespace rake task' do
before
do
# Mock the legacy way of artifacts
path
=
Rails
.
root
.
join
(
'shared/artifacts'
,
path
=
Rails
.
root
.
join
(
ArtifactUploader
.
local_store_path
,
build
.
created_at
.
utc
.
strftime
(
'%Y_%m'
),
build
.
project_id
.
to_s
,
build
.
id
.
to_s
)
...
...
@@ -36,13 +42,13 @@ describe 'gitlab:artifacts namespace rake task' do
let
(
:store
)
{
ObjectStoreUploader
::
LOCAL_STORE
}
context
'and job does not have file store defined'
do
let
(
:object_storage_enabled
)
{
true
}
before
do
build
.
update
(
artifacts_file_store:
nil
)
end
it
"migrates file to remote storage"
do
stub_artifacts_object_storage
subject
expect
(
build
.
reload
.
artifacts_file_store
).
to
eq
(
ObjectStoreUploader
::
REMOTE_STORE
)
...
...
@@ -51,9 +57,9 @@ describe 'gitlab:artifacts namespace rake task' do
end
context
'and remote storage is defined'
do
it
"migrates file to remote storage"
do
stub_artifacts_object_storage
let
(
:object_storage_enabled
)
{
true
}
it
"migrates file to remote storage"
do
subject
expect
(
build
.
reload
.
artifacts_file_store
).
to
eq
(
ObjectStoreUploader
::
REMOTE_STORE
)
...
...
@@ -72,11 +78,11 @@ describe 'gitlab:artifacts namespace rake task' do
end
context
'when remote storage is used'
do
let
(
:object_storage_enabled
)
{
true
}
let
(
:store
)
{
ObjectStoreUploader
::
REMOTE_STORE
}
it
"file stays on remote storage"
do
stub_artifacts_object_storage
subject
expect
(
build
.
reload
.
artifacts_file_store
).
to
eq
(
ObjectStoreUploader
::
REMOTE_STORE
)
...
...
@@ -87,19 +93,16 @@ describe 'gitlab:artifacts namespace rake task' do
end
context
'job artifacts'
do
let
(
:artifact
)
{
create
(
:ci_job_artifact
,
file_store:
store
)
}
let
!
(
:artifact
)
{
create
(
:ci_job_artifact
,
file_store:
store
)
}
context
'when local storage is used'
do
let
(
:store
)
{
ObjectStoreUploader
::
LOCAL_STORE
}
context
'and job does not have file store defined'
do
before
do
artifact
.
update
(
file_store:
nil
)
end
let
(
:object_storage_enabled
)
{
true
}
let
(
:store
)
{
nil
}
it
"migrates file to remote storage"
do
stub_artifacts_object_storage
subject
expect
(
artifact
.
reload
.
file_store
).
to
eq
(
ObjectStoreUploader
::
REMOTE_STORE
)
...
...
@@ -107,9 +110,9 @@ describe 'gitlab:artifacts namespace rake task' do
end
context
'and remote storage is defined'
do
it
"migrates file to remote storage"
do
stub_artifacts_object_storage
let
(
:object_storage_enabled
)
{
true
}
it
"migrates file to remote storage"
do
subject
expect
(
artifact
.
reload
.
file_store
).
to
eq
(
ObjectStoreUploader
::
REMOTE_STORE
)
...
...
@@ -126,11 +129,10 @@ describe 'gitlab:artifacts namespace rake task' do
end
context
'when remote storage is used'
do
let
(
:object_storage_enabled
)
{
true
}
let
(
:store
)
{
ObjectStoreUploader
::
REMOTE_STORE
}
it
"file stays on remote storage"
do
stub_artifacts_object_storage
subject
expect
(
artifact
.
reload
.
file_store
).
to
eq
(
ObjectStoreUploader
::
REMOTE_STORE
)
...
...
spec/workers/object_storage_upload_worker_spec.rb
View file @
954249ae
...
...
@@ -57,7 +57,7 @@ describe ObjectStorageUploadWorker do
before
do
# Mock the legacy way of artifacts
path
=
Rails
.
root
.
join
(
'shared/artifacts'
,
path
=
Rails
.
root
.
join
(
uploader_class
.
local_store_path
,
build
.
created_at
.
utc
.
strftime
(
'%Y_%m'
),
build
.
project_id
.
to_s
,
build
.
id
.
to_s
)
...
...
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