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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
8f143326
Commit
8f143326
authored
Oct 14, 2015
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove RepositoryArchiveWorker specs
These tasks have shifted to gitlab_git and gitlab-git-http-server.
parent
fc94b3b0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 addition
and
145 deletions
+1
-145
spec/services/archive_repository_service_spec.rb
spec/services/archive_repository_service_spec.rb
+1
-66
spec/workers/repository_archive_worker_spec.rb
spec/workers/repository_archive_worker_spec.rb
+0
-79
No files found.
spec/services/archive_repository_service_spec.rb
View file @
8f143326
...
@@ -13,7 +13,7 @@ describe ArchiveRepositoryService do
...
@@ -13,7 +13,7 @@ describe ArchiveRepositoryService do
context
"when the repository doesn't have an archive file path"
do
context
"when the repository doesn't have an archive file path"
do
before
do
before
do
allow
(
project
.
repository
).
to
receive
(
:archive_
file_path
).
and_return
(
nil
)
allow
(
project
.
repository
).
to
receive
(
:archive_
metadata
).
and_return
(
Hash
.
new
)
end
end
it
"raises an error"
do
it
"raises an error"
do
...
@@ -21,70 +21,5 @@ describe ArchiveRepositoryService do
...
@@ -21,70 +21,5 @@ describe ArchiveRepositoryService do
end
end
end
end
context
"when the repository has an archive file path"
do
let
(
:file_path
)
{
"/archive.zip"
}
let
(
:pid_file_path
)
{
"/archive.zip.pid"
}
before
do
allow
(
project
.
repository
).
to
receive
(
:archive_file_path
).
and_return
(
file_path
)
allow
(
project
.
repository
).
to
receive
(
:archive_pid_file_path
).
and_return
(
pid_file_path
)
end
context
"when the archive file already exists"
do
before
do
allow
(
File
).
to
receive
(
:exist?
).
with
(
file_path
).
and_return
(
true
)
end
it
"returns the file path"
do
expect
(
subject
.
execute
(
timeout:
0.0
)).
to
eq
(
file_path
)
end
end
context
"when the archive file doesn't exist yet"
do
before
do
allow
(
File
).
to
receive
(
:exist?
).
with
(
file_path
).
and_return
(
false
)
allow
(
File
).
to
receive
(
:exist?
).
with
(
pid_file_path
).
and_return
(
true
)
end
context
"when the archive pid file doesn't exist yet"
do
before
do
allow
(
File
).
to
receive
(
:exist?
).
with
(
pid_file_path
).
and_return
(
false
)
end
it
"queues the RepositoryArchiveWorker"
do
expect
(
RepositoryArchiveWorker
).
to
receive
(
:perform_async
)
subject
.
execute
(
timeout:
0.0
)
end
end
context
"when the archive pid file already exists"
do
it
"doesn't queue the RepositoryArchiveWorker"
do
expect
(
RepositoryArchiveWorker
).
not_to
receive
(
:perform_async
)
subject
.
execute
(
timeout:
0.0
)
end
end
context
"when the archive file exists after a little while"
do
before
do
Thread
.
new
do
sleep
0.1
allow
(
File
).
to
receive
(
:exist?
).
with
(
file_path
).
and_return
(
true
)
end
end
it
"returns the file path"
do
expect
(
subject
.
execute
(
timeout:
0.2
)).
to
eq
(
file_path
)
end
end
context
"when the archive file doesn't exist after the timeout"
do
it
"returns nil"
do
expect
(
subject
.
execute
(
timeout:
0.0
)).
to
eq
(
nil
)
end
end
end
end
end
end
end
end
spec/workers/repository_archive_worker_spec.rb
deleted
100644 → 0
View file @
fc94b3b0
require
'spec_helper'
describe
RepositoryArchiveWorker
do
let
(
:project
)
{
create
(
:project
)
}
subject
{
RepositoryArchiveWorker
.
new
}
before
do
allow
(
Project
).
to
receive
(
:find
).
and_return
(
project
)
end
describe
"#perform"
do
it
"cleans old archives"
do
expect
(
project
.
repository
).
to
receive
(
:clean_old_archives
)
subject
.
perform
(
project
.
id
,
"master"
,
"zip"
)
end
context
"when the repository doesn't have an archive file path"
do
before
do
allow
(
project
.
repository
).
to
receive
(
:archive_file_path
).
and_return
(
nil
)
end
it
"doesn't archive the repo"
do
expect
(
project
.
repository
).
not_to
receive
(
:archive_repo
)
subject
.
perform
(
project
.
id
,
"master"
,
"zip"
)
end
end
context
"when the repository has an archive file path"
do
let
(
:file_path
)
{
"/archive.zip"
}
let
(
:pid_file_path
)
{
"/archive.zip.pid"
}
before
do
allow
(
project
.
repository
).
to
receive
(
:archive_file_path
).
and_return
(
file_path
)
allow
(
project
.
repository
).
to
receive
(
:archive_pid_file_path
).
and_return
(
pid_file_path
)
end
context
"when the archive file already exists"
do
before
do
allow
(
File
).
to
receive
(
:exist?
).
with
(
file_path
).
and_return
(
true
)
end
it
"doesn't archive the repo"
do
expect
(
project
.
repository
).
not_to
receive
(
:archive_repo
)
subject
.
perform
(
project
.
id
,
"master"
,
"zip"
)
end
end
context
"when the archive file doesn't exist yet"
do
before
do
allow
(
File
).
to
receive
(
:exist?
).
with
(
file_path
).
and_return
(
false
)
allow
(
File
).
to
receive
(
:exist?
).
with
(
pid_file_path
).
and_return
(
true
)
end
context
"when the archive pid file doesn't exist yet"
do
before
do
allow
(
File
).
to
receive
(
:exist?
).
with
(
pid_file_path
).
and_return
(
false
)
end
it
"archives the repo"
do
expect
(
project
.
repository
).
to
receive
(
:archive_repo
)
subject
.
perform
(
project
.
id
,
"master"
,
"zip"
)
end
end
context
"when the archive pid file already exists"
do
it
"doesn't archive the repo"
do
expect
(
project
.
repository
).
not_to
receive
(
:archive_repo
)
subject
.
perform
(
project
.
id
,
"master"
,
"zip"
)
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