BigW Consortium Gitlab

Commit 592b8d71 by Kamil Trzciński

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
parents 09beebd7 c94b607a
---
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!
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment