Refactor :trace to :trace_live in spec
This commit is contained in:
parent
bb4ebd0b70
commit
bbeb274a25
8 changed files with 25 additions and 25 deletions
|
@ -171,7 +171,7 @@ describe Projects::JobsController do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when job has a trace' do
|
context 'when job has a trace' do
|
||||||
let(:job) { create(:ci_build, :trace, pipeline: pipeline) }
|
let(:job) { create(:ci_build, :trace_live, pipeline: pipeline) }
|
||||||
|
|
||||||
it 'returns a trace' do
|
it 'returns a trace' do
|
||||||
expect(response).to have_gitlab_http_status(:ok)
|
expect(response).to have_gitlab_http_status(:ok)
|
||||||
|
@ -193,7 +193,7 @@ describe Projects::JobsController do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when job has a trace with ANSI sequence and Unicode' do
|
context 'when job has a trace with ANSI sequence and Unicode' do
|
||||||
let(:job) { create(:ci_build, :unicode_trace, pipeline: pipeline) }
|
let(:job) { create(:ci_build, :unicode_trace_live, pipeline: pipeline) }
|
||||||
|
|
||||||
it 'returns a trace with Unicode' do
|
it 'returns a trace with Unicode' do
|
||||||
expect(response).to have_gitlab_http_status(:ok)
|
expect(response).to have_gitlab_http_status(:ok)
|
||||||
|
@ -392,7 +392,7 @@ describe Projects::JobsController do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when job is erasable' do
|
context 'when job is erasable' do
|
||||||
let(:job) { create(:ci_build, :erasable, :trace, :trace_artifact, pipeline: pipeline) }
|
let(:job) { create(:ci_build, :erasable, :trace_artifact, pipeline: pipeline) }
|
||||||
|
|
||||||
it 'redirects to the erased job page' do
|
it 'redirects to the erased job page' do
|
||||||
expect(response).to have_gitlab_http_status(:found)
|
expect(response).to have_gitlab_http_status(:found)
|
||||||
|
@ -419,7 +419,7 @@ describe Projects::JobsController do
|
||||||
|
|
||||||
context 'when user is developer' do
|
context 'when user is developer' do
|
||||||
let(:role) { :developer }
|
let(:role) { :developer }
|
||||||
let(:job) { create(:ci_build, :erasable, :trace, pipeline: pipeline, user: triggered_by) }
|
let(:job) { create(:ci_build, :erasable, :trace_artifact, pipeline: pipeline, user: triggered_by) }
|
||||||
|
|
||||||
context 'when triggered by same user' do
|
context 'when triggered by same user' do
|
||||||
let(:triggered_by) { user }
|
let(:triggered_by) { user }
|
||||||
|
@ -461,7 +461,7 @@ describe Projects::JobsController do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when job has a trace file' do
|
context 'when job has a trace file' do
|
||||||
let(:job) { create(:ci_build, :trace, pipeline: pipeline) }
|
let(:job) { create(:ci_build, :trace_live, pipeline: pipeline) }
|
||||||
|
|
||||||
it 'send a trace file' do
|
it 'send a trace file' do
|
||||||
expect(response).to have_gitlab_http_status(:ok)
|
expect(response).to have_gitlab_http_status(:ok)
|
||||||
|
|
|
@ -135,7 +135,7 @@ FactoryBot.define do
|
||||||
coverage_regex '/(d+)/'
|
coverage_regex '/(d+)/'
|
||||||
end
|
end
|
||||||
|
|
||||||
trait :trace do
|
trait :trace_live do
|
||||||
after(:create) do |build, evaluator|
|
after(:create) do |build, evaluator|
|
||||||
build.trace.set('BUILD TRACE')
|
build.trace.set('BUILD TRACE')
|
||||||
end
|
end
|
||||||
|
@ -147,7 +147,7 @@ FactoryBot.define do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
trait :unicode_trace do
|
trait :unicode_trace_live do
|
||||||
after(:create) do |build, evaluator|
|
after(:create) do |build, evaluator|
|
||||||
trace = File.binread(
|
trace = File.binread(
|
||||||
File.expand_path(
|
File.expand_path(
|
||||||
|
|
|
@ -7,7 +7,7 @@ feature 'Jobs' do
|
||||||
let(:project) { create(:project, :repository) }
|
let(:project) { create(:project, :repository) }
|
||||||
let(:pipeline) { create(:ci_pipeline, project: project) }
|
let(:pipeline) { create(:ci_pipeline, project: project) }
|
||||||
|
|
||||||
let(:job) { create(:ci_build, :trace, pipeline: pipeline) }
|
let(:job) { create(:ci_build, :trace_live, pipeline: pipeline) }
|
||||||
let(:job2) { create(:ci_build) }
|
let(:job2) { create(:ci_build) }
|
||||||
|
|
||||||
let(:artifacts_file) do
|
let(:artifacts_file) do
|
||||||
|
|
|
@ -7,7 +7,7 @@ describe Projects::JobsController, '(JavaScript fixtures)', type: :controller do
|
||||||
let(:namespace) { create(:namespace, name: 'frontend-fixtures' )}
|
let(:namespace) { create(:namespace, name: 'frontend-fixtures' )}
|
||||||
let(:project) { create(:project_empty_repo, namespace: namespace, path: 'builds-project') }
|
let(:project) { create(:project_empty_repo, namespace: namespace, path: 'builds-project') }
|
||||||
let(:pipeline) { create(:ci_empty_pipeline, project: project) }
|
let(:pipeline) { create(:ci_empty_pipeline, project: project) }
|
||||||
let!(:build_with_artifacts) { create(:ci_build, :success, :artifacts, :trace, pipeline: pipeline, stage: 'test', artifacts_expire_at: Time.now + 18.months) }
|
let!(:build_with_artifacts) { create(:ci_build, :success, :artifacts, :trace_artifact, pipeline: pipeline, stage: 'test', artifacts_expire_at: Time.now + 18.months) }
|
||||||
let!(:failed_build) { create(:ci_build, :failed, pipeline: pipeline, stage: 'build') }
|
let!(:failed_build) { create(:ci_build, :failed, pipeline: pipeline, stage: 'build') }
|
||||||
let!(:pending_build) { create(:ci_build, :pending, pipeline: pipeline, stage: 'deploy') }
|
let!(:pending_build) { create(:ci_build, :pending, pipeline: pipeline, stage: 'deploy') }
|
||||||
|
|
||||||
|
|
|
@ -675,7 +675,7 @@ describe Ci::Build do
|
||||||
|
|
||||||
context 'build is erasable' do
|
context 'build is erasable' do
|
||||||
context 'new artifacts' do
|
context 'new artifacts' do
|
||||||
let!(:build) { create(:ci_build, :trace, :trace_artifact, :success, :artifacts) }
|
let!(:build) { create(:ci_build, :trace_artifact, :success, :artifacts) }
|
||||||
|
|
||||||
describe '#erase' do
|
describe '#erase' do
|
||||||
before do
|
before do
|
||||||
|
@ -709,7 +709,7 @@ describe Ci::Build do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#erased?' do
|
describe '#erased?' do
|
||||||
let!(:build) { create(:ci_build, :trace, :trace_artifact, :success, :artifacts) }
|
let!(:build) { create(:ci_build, :trace_artifact, :success, :artifacts) }
|
||||||
subject { build.erased? }
|
subject { build.erased? }
|
||||||
|
|
||||||
context 'job has not been erased' do
|
context 'job has not been erased' do
|
||||||
|
@ -744,7 +744,7 @@ describe Ci::Build do
|
||||||
context 'old artifacts' do
|
context 'old artifacts' do
|
||||||
context 'build is erasable' do
|
context 'build is erasable' do
|
||||||
context 'new artifacts' do
|
context 'new artifacts' do
|
||||||
let!(:build) { create(:ci_build, :trace, :success, :legacy_artifacts) }
|
let!(:build) { create(:ci_build, :trace_artifact, :success, :legacy_artifacts) }
|
||||||
|
|
||||||
describe '#erase' do
|
describe '#erase' do
|
||||||
before do
|
before do
|
||||||
|
@ -778,7 +778,7 @@ describe Ci::Build do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#erased?' do
|
describe '#erased?' do
|
||||||
let!(:build) { create(:ci_build, :trace, :success, :legacy_artifacts) }
|
let!(:build) { create(:ci_build, :trace_artifact, :success, :legacy_artifacts) }
|
||||||
subject { build.erased? }
|
subject { build.erased? }
|
||||||
|
|
||||||
context 'job has not been erased' do
|
context 'job has not been erased' do
|
||||||
|
|
|
@ -461,7 +461,7 @@ describe API::Jobs do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when trace is file' do
|
context 'when trace is file' do
|
||||||
let(:job) { create(:ci_build, :trace, pipeline: pipeline) }
|
let(:job) { create(:ci_build, :trace_live, pipeline: pipeline) }
|
||||||
|
|
||||||
it 'returns specific job trace' do
|
it 'returns specific job trace' do
|
||||||
expect(response).to have_gitlab_http_status(200)
|
expect(response).to have_gitlab_http_status(200)
|
||||||
|
@ -554,7 +554,7 @@ describe API::Jobs do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'job is erasable' do
|
context 'job is erasable' do
|
||||||
let(:job) { create(:ci_build, :trace, :trace_artifact, :artifacts, :success, project: project, pipeline: pipeline) }
|
let(:job) { create(:ci_build, :trace_artifact, :artifacts, :success, project: project, pipeline: pipeline) }
|
||||||
|
|
||||||
it 'erases job content' do
|
it 'erases job content' do
|
||||||
expect(response).to have_gitlab_http_status(201)
|
expect(response).to have_gitlab_http_status(201)
|
||||||
|
@ -572,7 +572,7 @@ describe API::Jobs do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'job is not erasable' do
|
context 'job is not erasable' do
|
||||||
let(:job) { create(:ci_build, :trace, project: project, pipeline: pipeline) }
|
let(:job) { create(:ci_build, :trace_live, project: project, pipeline: pipeline) }
|
||||||
|
|
||||||
it 'responds with forbidden' do
|
it 'responds with forbidden' do
|
||||||
expect(response).to have_gitlab_http_status(403)
|
expect(response).to have_gitlab_http_status(403)
|
||||||
|
@ -581,7 +581,7 @@ describe API::Jobs do
|
||||||
|
|
||||||
context 'when a developer erases a build' do
|
context 'when a developer erases a build' do
|
||||||
let(:role) { :developer }
|
let(:role) { :developer }
|
||||||
let(:job) { create(:ci_build, :trace, :trace_artifact, :artifacts, :success, project: project, pipeline: pipeline, user: owner) }
|
let(:job) { create(:ci_build, :trace_artifact, :artifacts, :success, project: project, pipeline: pipeline, user: owner) }
|
||||||
|
|
||||||
context 'when the build was created by the developer' do
|
context 'when the build was created by the developer' do
|
||||||
let(:owner) { user }
|
let(:owner) { user }
|
||||||
|
@ -604,7 +604,7 @@ describe API::Jobs do
|
||||||
|
|
||||||
context 'artifacts did not expire' do
|
context 'artifacts did not expire' do
|
||||||
let(:job) do
|
let(:job) do
|
||||||
create(:ci_build, :trace, :artifacts, :success,
|
create(:ci_build, :trace_artifact, :artifacts, :success,
|
||||||
project: project, pipeline: pipeline, artifacts_expire_at: Time.now + 7.days)
|
project: project, pipeline: pipeline, artifacts_expire_at: Time.now + 7.days)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -638,7 +638,7 @@ describe API::Runner do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'PUT /api/v4/jobs/:id' do
|
describe 'PUT /api/v4/jobs/:id' do
|
||||||
let(:job) { create(:ci_build, :pending, :trace, pipeline: pipeline, runner_id: runner.id) }
|
let(:job) { create(:ci_build, :pending, :trace_live, pipeline: pipeline, runner_id: runner.id) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
job.run!
|
job.run!
|
||||||
|
@ -719,7 +719,7 @@ describe API::Runner do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'PATCH /api/v4/jobs/:id/trace' do
|
describe 'PATCH /api/v4/jobs/:id/trace' do
|
||||||
let(:job) { create(:ci_build, :running, :trace, runner_id: runner.id, pipeline: pipeline) }
|
let(:job) { create(:ci_build, :running, :trace_live, runner_id: runner.id, pipeline: pipeline) }
|
||||||
let(:headers) { { API::Helpers::Runner::JOB_TOKEN_HEADER => job.token, 'Content-Type' => 'text/plain' } }
|
let(:headers) { { API::Helpers::Runner::JOB_TOKEN_HEADER => job.token, 'Content-Type' => 'text/plain' } }
|
||||||
let(:headers_with_range) { headers.merge({ 'Content-Range' => '11-20' }) }
|
let(:headers_with_range) { headers.merge({ 'Content-Range' => '11-20' }) }
|
||||||
let(:update_interval) { 10.seconds.to_i }
|
let(:update_interval) { 10.seconds.to_i }
|
||||||
|
@ -780,7 +780,7 @@ describe API::Runner do
|
||||||
|
|
||||||
context 'when project for the build has been deleted' do
|
context 'when project for the build has been deleted' do
|
||||||
let(:job) do
|
let(:job) do
|
||||||
create(:ci_build, :running, :trace, runner_id: runner.id, pipeline: pipeline) do |job|
|
create(:ci_build, :running, :trace_live, runner_id: runner.id, pipeline: pipeline) do |job|
|
||||||
job.project.update(pending_delete: true)
|
job.project.update(pending_delete: true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -352,7 +352,7 @@ describe API::V3::Builds do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'GET /projects/:id/builds/:build_id/trace' do
|
describe 'GET /projects/:id/builds/:build_id/trace' do
|
||||||
let(:build) { create(:ci_build, :trace, pipeline: pipeline) }
|
let(:build) { create(:ci_build, :trace_live, pipeline: pipeline) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
get v3_api("/projects/#{project.id}/builds/#{build.id}/trace", api_user)
|
get v3_api("/projects/#{project.id}/builds/#{build.id}/trace", api_user)
|
||||||
|
@ -447,7 +447,7 @@ describe API::V3::Builds do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'job is erasable' do
|
context 'job is erasable' do
|
||||||
let(:build) { create(:ci_build, :trace, :artifacts, :success, project: project, pipeline: pipeline) }
|
let(:build) { create(:ci_build, :trace_artifact, :artifacts, :success, project: project, pipeline: pipeline) }
|
||||||
|
|
||||||
it 'erases job content' do
|
it 'erases job content' do
|
||||||
expect(response.status).to eq 201
|
expect(response.status).to eq 201
|
||||||
|
@ -463,7 +463,7 @@ describe API::V3::Builds do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'job is not erasable' do
|
context 'job is not erasable' do
|
||||||
let(:build) { create(:ci_build, :trace, project: project, pipeline: pipeline) }
|
let(:build) { create(:ci_build, :trace_live, project: project, pipeline: pipeline) }
|
||||||
|
|
||||||
it 'responds with forbidden' do
|
it 'responds with forbidden' do
|
||||||
expect(response.status).to eq 403
|
expect(response.status).to eq 403
|
||||||
|
@ -478,7 +478,7 @@ describe API::V3::Builds do
|
||||||
|
|
||||||
context 'artifacts did not expire' do
|
context 'artifacts did not expire' do
|
||||||
let(:build) do
|
let(:build) do
|
||||||
create(:ci_build, :trace, :artifacts, :success,
|
create(:ci_build, :trace_artifact, :artifacts, :success,
|
||||||
project: project, pipeline: pipeline, artifacts_expire_at: Time.now + 7.days)
|
project: project, pipeline: pipeline, artifacts_expire_at: Time.now + 7.days)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue