diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2018-04-05 18:33:32 +0000 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2018-04-05 18:33:32 +0000 |
commit | 160b4827edad1984ddb4339622b93ace17870cb1 (patch) | |
tree | 2ceaf492f689cfa7a1e4fc39c4ff7685d14a3913 /spec/controllers | |
parent | 6b3585d8ea15a7ee1a5cd2f5799caace48ab0c32 (diff) | |
parent | 373f6a9bb20497eebe4cdf41be18eb2399424a59 (diff) | |
download | gitlab-ce-160b4827edad1984ddb4339622b93ace17870cb1.tar.gz |
Merge branch '44665-fix-db-trace-stream-by-raw-access' into 'master'
Fix `JobsController#raw` endpoint can not read traces in database
Closes #44665
See merge request gitlab-org/gitlab-ce!18101
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/projects/jobs_controller_spec.rb | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/spec/controllers/projects/jobs_controller_spec.rb b/spec/controllers/projects/jobs_controller_spec.rb index 31046c202e6..b9a979044fe 100644 --- a/spec/controllers/projects/jobs_controller_spec.rb +++ b/spec/controllers/projects/jobs_controller_spec.rb @@ -513,13 +513,30 @@ describe Projects::JobsController do end end + context 'when job has a trace in database' do + let(:job) { create(:ci_build, pipeline: pipeline) } + + before do + job.update_column(:trace, 'Sample trace') + end + + it 'send a trace file' do + response = subject + + expect(response).to have_gitlab_http_status(:ok) + expect(response.content_type).to eq 'text/plain; charset=utf-8' + expect(response.body).to eq 'Sample trace' + end + end + context 'when job does not have a trace file' do let(:job) { create(:ci_build, pipeline: pipeline) } it 'returns not_found' do response = subject - expect(response).to have_gitlab_http_status(:not_found) + expect(response).to have_gitlab_http_status(:ok) + expect(response.body).to eq '' end end |