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
aaff5e45
Commit
aaff5e45
authored
Apr 06, 2018
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add spec that proves trace can be recovered even if it had redis outage
parent
eaf29cce
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
0 deletions
+30
-0
lib/api/helpers/runner.rb
lib/api/helpers/runner.rb
+1
-0
spec/requests/api/runner_spec.rb
spec/requests/api/runner_spec.rb
+24
-0
spec/support/chunked_io/chunked_io_helpers.rb
spec/support/chunked_io/chunked_io_helpers.rb
+5
-0
No files found.
lib/api/helpers/runner.rb
View file @
aaff5e45
...
...
@@ -52,6 +52,7 @@ module API
end
def
job_token_valid?
(
job
)
# binding.pry
token
=
(
params
[
JOB_TOKEN_PARAM
]
||
env
[
JOB_TOKEN_HEADER
]).
to_s
token
&&
job
.
valid_token?
(
token
)
end
...
...
spec/requests/api/runner_spec.rb
View file @
aaff5e45
...
...
@@ -2,6 +2,7 @@ require 'spec_helper'
describe
API
::
Runner
,
:clean_gitlab_redis_shared_state
do
include
StubGitlabCalls
include
ChunkedIOHelpers
let
(
:registration_token
)
{
'abcdefg123456'
}
...
...
@@ -865,6 +866,29 @@ describe API::Runner, :clean_gitlab_redis_shared_state do
expect
(
response
.
status
).
to
eq
(
403
)
end
end
context
'when redis had an outage'
do
it
"recovers"
do
# GitLab-Runner patchs
patch_the_trace
expect
(
job
.
reload
.
trace
.
raw
).
to
eq
'BUILD TRACE appended appended'
# GitLab-Rails enxounters an outage on Redis
redis_shared_state_outage!
expect
(
job
.
reload
.
trace
.
raw
).
to
eq
''
# GitLab-Runner patchs
patch_the_trace
(
'hello'
,
headers
.
merge
({
'Content-Range'
=>
"28-32"
}))
expect
(
response
.
status
).
to
eq
202
expect
(
response
.
header
).
to
have_key
'Range'
expect
(
response
.
header
[
'Range'
]).
to
eq
'0-0'
expect
(
job
.
reload
.
trace
.
raw
).
to
eq
''
# GitLab-Runner re-patchs
patch_the_trace
(
'BUILD TRACE appended appended hello'
)
expect
(
job
.
reload
.
trace
.
raw
).
to
eq
'BUILD TRACE appended appended hello'
end
end
end
context
'when Runner makes a force-patch'
do
...
...
spec/support/chunked_io/chunked_io_helpers.rb
View file @
aaff5e45
...
...
@@ -8,4 +8,9 @@ module ChunkedIOHelpers
stub_const
(
'Ci::JobTraceChunk::CHUNK_SIZE'
,
size
)
stub_const
(
'Gitlab::Ci::Trace::ChunkedIO::CHUNK_SIZE'
,
size
)
end
def
redis_shared_state_outage!
Gitlab
::
Redis
::
SharedState
.
with
(
&
:flushall
)
Sidekiq
.
redis
(
&
:flushall
)
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