Merge branch 'create-live-trace-only-if-job-is-complete' into 'master'
Append trace chunk only if job is running Closes #46383 See merge request gitlab-org/gitlab-ce!18969
This commit is contained in:
commit
592b8d716f
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Forbid to patch traces for finished jobs
|
||||
merge_request: 18969
|
||||
author:
|
||||
type: fixed
|
|
@ -149,6 +149,7 @@ module API
|
|||
end
|
||||
patch '/:id/trace' do
|
||||
job = authenticate_job!
|
||||
forbidden!('Job is not running') unless job.running?
|
||||
|
||||
error!('400 Missing header Content-Range', 400) unless request.headers.key?('Content-Range')
|
||||
content_range = request.headers['Content-Range']
|
||||
|
|
|
@ -918,6 +918,22 @@ describe API::Runner, :clean_gitlab_redis_shared_state do
|
|||
expect(job.reload.trace.raw).to eq 'BUILD TRACE appended appended'
|
||||
end
|
||||
|
||||
context 'when job is cancelled' do
|
||||
before do
|
||||
job.cancel
|
||||
end
|
||||
|
||||
context 'when trace is patched' do
|
||||
before do
|
||||
patch_the_trace
|
||||
end
|
||||
|
||||
it 'returns Forbidden ' do
|
||||
expect(response.status).to eq(403)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when redis data are flushed' do
|
||||
before do
|
||||
redis_shared_state_cleanup!
|
||||
|
|
Loading…
Reference in New Issue