Commit 717fdd6d authored by Kamil Trzcinski's avatar Kamil Trzcinski

Rename Ci::Build commit to pipeline

parent b2acebb4
......@@ -165,7 +165,7 @@ class Spinach::Features::ProjectCommits < Spinach::FeatureSteps
step 'commit has ci status' do
@project.enable_ci
ci_commit = create :ci_commit, project: @project, sha: sample_commit.id
create :ci_build, commit: ci_commit
create :ci_build, pipeline: ci_commit
end
step 'repository contains ".gitlab-ci.yml" file' do
......
......@@ -520,7 +520,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
project = merge_request.source_project
project.enable_ci
ci_commit = create :ci_commit, project: project, sha: merge_request.last_commit.id, ref: merge_request.source_branch
create :ci_build, commit: ci_commit
create :ci_build, pipeline: ci_commit
end
step 'I should see merge request "Bug NS-05" with CI status' do
......
......@@ -23,7 +23,7 @@ module SharedBuilds
end
step 'project has another build that is running' do
create(:ci_build, commit: @ci_commit, name: 'second build', status: 'running')
create(:ci_build, pipeline: @ci_commit, name: 'second build', status: 'running')
end
step 'I visit recent build details page' do
......
......@@ -16,7 +16,7 @@ FactoryGirl.define do
}
end
commit factory: :ci_commit
pipeline factory: :ci_commit
trait :success do
status 'success'
......
......@@ -3,7 +3,7 @@ FactoryGirl.define do
name 'default'
status 'success'
description 'commit status'
commit factory: :ci_commit_with_one_job
pipeline factory: :ci_commit_with_one_job
started_at 'Tue, 26 Jan 2016 08:21:42 +0100'
finished_at 'Tue, 26 Jan 2016 08:23:42 +0100'
......
......@@ -11,10 +11,10 @@ describe 'Admin Builds' do
context 'All tab' do
context 'when have builds' do
it 'shows all builds' do
create(:ci_build, commit: commit, status: :pending)
create(:ci_build, commit: commit, status: :running)
create(:ci_build, commit: commit, status: :success)
create(:ci_build, commit: commit, status: :failed)
create(:ci_build, pipeline: commit, status: :pending)
create(:ci_build, pipeline: commit, status: :running)
create(:ci_build, pipeline: commit, status: :success)
create(:ci_build, pipeline: commit, status: :failed)
visit admin_builds_path
......@@ -39,9 +39,9 @@ describe 'Admin Builds' do
context 'Running tab' do
context 'when have running builds' do
it 'shows running builds' do
build1 = create(:ci_build, commit: commit, status: :pending)
build2 = create(:ci_build, commit: commit, status: :success)
build3 = create(:ci_build, commit: commit, status: :failed)
build1 = create(:ci_build, pipeline: commit, status: :pending)
build2 = create(:ci_build, pipeline: commit, status: :success)
build3 = create(:ci_build, pipeline: commit, status: :failed)
visit admin_builds_path(scope: :running)
......@@ -55,7 +55,7 @@ describe 'Admin Builds' do
context 'when have no builds running' do
it 'shows a message' do
create(:ci_build, commit: commit, status: :success)
create(:ci_build, pipeline: commit, status: :success)
visit admin_builds_path(scope: :running)
......@@ -69,9 +69,9 @@ describe 'Admin Builds' do
context 'Finished tab' do
context 'when have finished builds' do
it 'shows finished builds' do
build1 = create(:ci_build, commit: commit, status: :pending)
build2 = create(:ci_build, commit: commit, status: :running)
build3 = create(:ci_build, commit: commit, status: :success)
build1 = create(:ci_build, pipeline: commit, status: :pending)
build2 = create(:ci_build, pipeline: commit, status: :running)
build3 = create(:ci_build, pipeline: commit, status: :success)
visit admin_builds_path(scope: :finished)
......@@ -85,7 +85,7 @@ describe 'Admin Builds' do
context 'when have no builds finished' do
it 'shows a message' do
create(:ci_build, commit: commit, status: :running)
create(:ci_build, pipeline: commit, status: :running)
visit admin_builds_path(scope: :finished)
......
......@@ -9,7 +9,7 @@ describe "Admin Runners" do
before do
runner = FactoryGirl.create(:ci_runner)
commit = FactoryGirl.create(:ci_commit)
FactoryGirl.create(:ci_build, commit: commit, runner_id: runner.id)
FactoryGirl.create(:ci_build, pipeline: commit, runner_id: runner.id)
visit admin_runners_path
end
......
......@@ -6,7 +6,7 @@ describe "Builds" do
before do
login_as(:user)
@commit = FactoryGirl.create :ci_commit
@build = FactoryGirl.create :ci_build, commit: @commit
@build = FactoryGirl.create :ci_build, pipeline: @commit
@project = @commit.project
@project.team << [@user, :developer]
end
......
......@@ -16,7 +16,7 @@ describe 'Commits' do
end
context 'commit status is Generic Commit Status' do
let!(:status) { FactoryGirl.create :generic_commit_status, commit: commit }
let!(:status) { FactoryGirl.create :generic_commit_status, pipeline: commit }
before do
project.team << [@user, :reporter]
......@@ -39,7 +39,7 @@ describe 'Commits' do
end
context 'commit status is Ci Build' do
let!(:build) { FactoryGirl.create :ci_build, commit: commit }
let!(:build) { FactoryGirl.create :ci_build, pipeline: commit }
let(:artifacts_file) { fixture_file_upload(Rails.root + 'spec/fixtures/banana_sample.gif', 'image/gif') }
context 'when logged as developer' do
......
......@@ -13,7 +13,7 @@ feature 'Merge When Build Succeeds', feature: true, js: true do
context "Active build for Merge Request" do
let!(:ci_commit) { create(:ci_commit, project: project, sha: merge_request.last_commit.id, ref: merge_request.source_branch) }
let!(:ci_build) { create(:ci_build, commit: ci_commit) }
let!(:ci_build) { create(:ci_build, pipeline: ci_commit) }
before do
login_as user
......@@ -48,7 +48,7 @@ feature 'Merge When Build Succeeds', feature: true, js: true do
end
let!(:ci_commit) { create(:ci_commit, project: project, sha: merge_request.last_commit.id, ref: merge_request.source_branch) }
let!(:ci_build) { create(:ci_build, commit: ci_commit) }
let!(:ci_build) { create(:ci_build, pipeline: ci_commit) }
before do
login_as user
......
......@@ -31,7 +31,7 @@ describe "Pipelines" do
end
context 'cancelable pipeline' do
let!(:running) { create(:ci_build, :running, commit: pipeline, stage: 'test', commands: 'test') }
let!(:running) { create(:ci_build, :running, pipeline: pipeline, stage: 'test', commands: 'test') }
before { visit namespace_project_pipelines_path(project.namespace, project) }
......@@ -47,7 +47,7 @@ describe "Pipelines" do
end
context 'retryable pipelines' do
let!(:failed) { create(:ci_build, :failed, commit: pipeline, stage: 'test', commands: 'test') }
let!(:failed) { create(:ci_build, :failed, pipeline: pipeline, stage: 'test', commands: 'test') }
before { visit namespace_project_pipelines_path(project.namespace, project) }
......@@ -64,7 +64,7 @@ describe "Pipelines" do
context 'for generic statuses' do
context 'when running' do
let!(:running) { create(:generic_commit_status, status: 'running', commit: pipeline, stage: 'test') }
let!(:running) { create(:generic_commit_status, status: 'running', pipeline: pipeline, stage: 'test') }
before { visit namespace_project_pipelines_path(project.namespace, project) }
......@@ -78,7 +78,7 @@ describe "Pipelines" do
end
context 'when failed' do
let!(:running) { create(:generic_commit_status, status: 'failed', commit: pipeline, stage: 'test') }
let!(:running) { create(:generic_commit_status, status: 'failed', pipeline: pipeline, stage: 'test') }
before { visit namespace_project_pipelines_path(project.namespace, project) }
......@@ -94,7 +94,7 @@ describe "Pipelines" do
context 'downloadable pipelines' do
context 'with artifacts' do
let!(:with_artifacts) { create(:ci_build, :artifacts, :success, commit: pipeline, name: 'rspec tests', stage: 'test') }
let!(:with_artifacts) { create(:ci_build, :artifacts, :success, pipeline: pipeline, name: 'rspec tests', stage: 'test') }
before { visit namespace_project_pipelines_path(project.namespace, project) }
......@@ -103,7 +103,7 @@ describe "Pipelines" do
end
context 'without artifacts' do
let!(:without_artifacts) { create(:ci_build, :success, commit: pipeline, name: 'rspec', stage: 'test') }
let!(:without_artifacts) { create(:ci_build, :success, pipeline: pipeline, name: 'rspec', stage: 'test') }
it { expect(page).not_to have_selector('.build-artifacts') }
end
......@@ -114,10 +114,10 @@ describe "Pipelines" do
let(:pipeline) { create(:ci_commit, project: project, ref: 'master') }
before do
@success = create(:ci_build, :success, commit: pipeline, stage: 'build', name: 'build')
@failed = create(:ci_build, :failed, commit: pipeline, stage: 'test', name: 'test', commands: 'test')
@running = create(:ci_build, :running, commit: pipeline, stage: 'deploy', name: 'deploy')
@external = create(:generic_commit_status, status: 'success', commit: pipeline, name: 'jenkins', stage: 'external')
@success = create(:ci_build, :success, pipeline: pipeline, stage: 'build', name: 'build')
@failed = create(:ci_build, :failed, pipeline: pipeline, stage: 'test', name: 'test', commands: 'test')
@running = create(:ci_build, :running, pipeline: pipeline, stage: 'deploy', name: 'deploy')
@external = create(:generic_commit_status, status: 'success', pipeline: pipeline, name: 'jenkins', stage: 'external')
end
before { visit namespace_project_pipeline_path(project.namespace, project, pipeline) }
......
......@@ -143,7 +143,7 @@ describe "Public Project Access", feature: true do
describe "GET /:project_path/builds/:id" do
let(:commit) { create(:ci_commit, project: project) }
let(:build) { create(:ci_build, commit: commit) }
let(:build) { create(:ci_build, pipeline: commit) }
subject { namespace_project_build_path(project.namespace, project, build.id) }
context "when allowed for public" do
......
......@@ -5,7 +5,7 @@ describe Ci::Charts, lib: true do
context "build_times" do
before do
@commit = FactoryGirl.create(:ci_commit)
FactoryGirl.create(:ci_build, commit: @commit)
FactoryGirl.create(:ci_build, pipeline: @commit)
end
it 'should return build times in minutes' do
......
......@@ -43,7 +43,7 @@ describe Gitlab::Badge::Build do
context 'build exists' do
let(:ci_commit) { create(:ci_commit, project: project, sha: sha, ref: branch) }
let!(:build) { create(:ci_build, commit: ci_commit) }
let!(:build) { create(:ci_build, pipeline: ci_commit) }
context 'build success' do
......
......@@ -3,15 +3,15 @@ require 'spec_helper'
describe Ci::Build, models: true do
let(:project) { create(:project) }
let(:commit) { create(:ci_commit, project: project) }
let(:build) { create(:ci_build, commit: commit) }
let(:build) { create(:ci_build, pipeline: commit) }
it { is_expected.to validate_presence_of :ref }
it { is_expected.to respond_to :trace_html }
describe '#first_pending' do
let!(:first) { create(:ci_build, commit: commit, status: 'pending', created_at: Date.yesterday) }
let!(:second) { create(:ci_build, commit: commit, status: 'pending') }
let!(:first) { create(:ci_build, pipeline: commit, status: 'pending', created_at: Date.yesterday) }
let!(:second) { create(:ci_build, pipeline: commit, status: 'pending') }
subject { Ci::Build.first_pending }
it { is_expected.to be_a(Ci::Build) }
......@@ -219,7 +219,7 @@ describe Ci::Build, models: true do
context 'and trigger variables' do
let(:trigger) { create(:ci_trigger, project: project) }
let(:trigger_request) { create(:ci_trigger_request_with_variables, commit: commit, trigger: trigger) }
let(:trigger_request) { create(:ci_trigger_request_with_variables, pipeline: commit, trigger: trigger) }
let(:trigger_variables) do
[
{ key: :TRIGGER_KEY, value: 'TRIGGER_VALUE', public: false }
......@@ -428,10 +428,10 @@ describe Ci::Build, models: true do
end
describe '#depends_on_builds' do
let!(:build) { create(:ci_build, commit: commit, name: 'build', stage_idx: 0, stage: 'build') }
let!(:rspec_test) { create(:ci_build, commit: commit, name: 'rspec', stage_idx: 1, stage: 'test') }
let!(:rubocop_test) { create(:ci_build, commit: commit, name: 'rubocop', stage_idx: 1, stage: 'test') }
let!(:staging) { create(:ci_build, commit: commit, name: 'staging', stage_idx: 2, stage: 'deploy') }
let!(:build) { create(:ci_build, pipeline: commit, name: 'build', stage_idx: 0, stage: 'build') }
let!(:rspec_test) { create(:ci_build, pipeline: commit, name: 'rspec', stage_idx: 1, stage: 'test') }
let!(:rubocop_test) { create(:ci_build, pipeline: commit, name: 'rubocop', stage_idx: 1, stage: 'test') }
let!(:staging) { create(:ci_build, pipeline: commit, name: 'staging', stage_idx: 2, stage: 'deploy') }
it 'to have no dependents if this is first build' do
expect(build.depends_on_builds).to be_empty
......@@ -500,7 +500,7 @@ describe Ci::Build, models: true do
before do
@merge_request = create_mr(build, commit, factory: :merge_request_with_diffs)
commit2 = create(:ci_commit, project: project)
@build2 = create(:ci_build, commit: commit2)
@build2 = create(:ci_build, pipeline: commit2)
commits = [double(id: commit.sha), double(id: commit2.sha)]
allow(@merge_request).to receive(:commits).and_return(commits)
......
......@@ -42,8 +42,8 @@ describe Ci::Pipeline, models: true do
subject { commit.retried }
before do
@commit1 = FactoryGirl.create :ci_build, commit: commit, name: 'deploy'
@commit2 = FactoryGirl.create :ci_build, commit: commit, name: 'deploy'
@commit1 = FactoryGirl.create :ci_build, pipeline: commit, name: 'deploy'
@commit2 = FactoryGirl.create :ci_build, pipeline: commit, name: 'deploy'
end
it 'returns old builds' do
......@@ -264,14 +264,14 @@ describe Ci::Pipeline, models: true do
let(:commit) { FactoryGirl.create :ci_commit }
it "returns finished_at of latest build" do
build = FactoryGirl.create :ci_build, commit: commit, finished_at: Time.now - 60
FactoryGirl.create :ci_build, commit: commit, finished_at: Time.now - 120
build = FactoryGirl.create :ci_build, pipeline: commit, finished_at: Time.now - 60
FactoryGirl.create :ci_build, pipeline: commit, finished_at: Time.now - 120
expect(commit.finished_at.to_i).to eq(build.finished_at.to_i)
end
it "returns nil if there is no finished build" do
FactoryGirl.create :ci_not_started_build, commit: commit
FactoryGirl.create :ci_not_started_build, pipeline: commit
expect(commit.finished_at).to be_nil
end
......@@ -282,27 +282,27 @@ describe Ci::Pipeline, models: true do
let(:commit) { FactoryGirl.create :ci_commit, project: project }
it "calculates average when there are two builds with coverage" do
FactoryGirl.create :ci_build, name: "rspec", coverage: 30, commit: commit
FactoryGirl.create :ci_build, name: "rubocop", coverage: 40, commit: commit
FactoryGirl.create :ci_build, name: "rspec", coverage: 30, pipeline: commit
FactoryGirl.create :ci_build, name: "rubocop", coverage: 40, pipeline: commit
expect(commit.coverage).to eq("35.00")
end
it "calculates average when there are two builds with coverage and one with nil" do
FactoryGirl.create :ci_build, name: "rspec", coverage: 30, commit: commit
FactoryGirl.create :ci_build, name: "rubocop", coverage: 40, commit: commit
FactoryGirl.create :ci_build, commit: commit
FactoryGirl.create :ci_build, name: "rspec", coverage: 30, pipeline: commit
FactoryGirl.create :ci_build, name: "rubocop", coverage: 40, pipeline: commit
FactoryGirl.create :ci_build, pipeline: commit
expect(commit.coverage).to eq("35.00")
end
it "calculates average when there are two builds with coverage and one is retried" do
FactoryGirl.create :ci_build, name: "rspec", coverage: 30, commit: commit
FactoryGirl.create :ci_build, name: "rubocop", coverage: 30, commit: commit
FactoryGirl.create :ci_build, name: "rubocop", coverage: 40, commit: commit
FactoryGirl.create :ci_build, name: "rspec", coverage: 30, pipeline: commit
FactoryGirl.create :ci_build, name: "rubocop", coverage: 30, pipeline: commit
FactoryGirl.create :ci_build, name: "rubocop", coverage: 40, pipeline: commit
expect(commit.coverage).to eq("35.00")
end
it "calculates average when there is one build without coverage" do
FactoryGirl.create :ci_build, commit: commit
FactoryGirl.create :ci_build, pipeline: commit
expect(commit.coverage).to be_nil
end
end
......@@ -312,7 +312,7 @@ describe Ci::Pipeline, models: true do
context 'no failed builds' do
before do
FactoryGirl.create :ci_build, name: "rspec", commit: commit, status: 'success'
FactoryGirl.create :ci_build, name: "rspec", pipeline: commit, status: 'success'
end
it 'be not retryable' do
......@@ -322,8 +322,8 @@ describe Ci::Pipeline, models: true do
context 'with failed builds' do
before do
FactoryGirl.create :ci_build, name: "rspec", commit: commit, status: 'running'
FactoryGirl.create :ci_build, name: "rubocop", commit: commit, status: 'failed'
FactoryGirl.create :ci_build, name: "rspec", pipeline: commit, status: 'running'
FactoryGirl.create :ci_build, name: "rubocop", pipeline: commit, status: 'failed'
end
it 'be retryable' do
......@@ -337,8 +337,8 @@ describe Ci::Pipeline, models: true do
subject { CommitStatus.where(commit: [commit, commit2]).stages }
before do
FactoryGirl.create :ci_build, commit: commit2, stage: 'test', stage_idx: 1
FactoryGirl.create :ci_build, commit: commit, stage: 'build', stage_idx: 0
FactoryGirl.create :ci_build, pipeline: commit2, stage: 'test', stage_idx: 1
FactoryGirl.create :ci_build, pipeline: commit, stage: 'build', stage_idx: 0
end
it 'return all stages' do
......@@ -353,7 +353,7 @@ describe Ci::Pipeline, models: true do
end
context 'dependent objects' do
let(:commit_status) { build :commit_status, commit: commit }
let(:commit_status) { build :commit_status, pipeline: commit }
it 'execute update_state after saving dependent object' do
expect(commit).to receive(:update_state).and_return(true)
......@@ -363,7 +363,7 @@ describe Ci::Pipeline, models: true do
context 'update state' do
let(:current) { Time.now.change(usec: 0) }
let(:build) { FactoryGirl.create :ci_build, :success, commit: commit, started_at: current - 120, finished_at: current - 60 }
let(:build) { FactoryGirl.create :ci_build, :success, pipeline: commit, started_at: current - 120, finished_at: current - 60 }
before do
build
......
......@@ -2,7 +2,7 @@ require 'spec_helper'
describe CommitStatus, models: true do
let(:commit) { FactoryGirl.create :ci_commit }
let(:commit_status) { FactoryGirl.create :commit_status, commit: commit }
let(:commit_status) { FactoryGirl.create :commit_status, pipeline: commit }
it { is_expected.to belong_to(:commit) }
it { is_expected.to belong_to(:user) }
......@@ -121,11 +121,11 @@ describe CommitStatus, models: true do
subject { CommitStatus.latest.order(:id) }
before do
@commit1 = FactoryGirl.create :commit_status, commit: commit, name: 'aa', ref: 'bb', status: 'running'
@commit2 = FactoryGirl.create :commit_status, commit: commit, name: 'cc', ref: 'cc', status: 'pending'
@commit3 = FactoryGirl.create :commit_status, commit: commit, name: 'aa', ref: 'cc', status: 'success'
@commit4 = FactoryGirl.create :commit_status, commit: commit, name: 'cc', ref: 'bb', status: 'success'
@commit5 = FactoryGirl.create :commit_status, commit: commit, name: 'aa', ref: 'bb', status: 'success'
@commit1 = FactoryGirl.create :commit_status, pipeline: commit, name: 'aa', ref: 'bb', status: 'running'
@commit2 = FactoryGirl.create :commit_status, pipeline: commit, name: 'cc', ref: 'cc', status: 'pending'
@commit3 = FactoryGirl.create :commit_status, pipeline: commit, name: 'aa', ref: 'cc', status: 'success'
@commit4 = FactoryGirl.create :commit_status, pipeline: commit, name: 'cc', ref: 'bb', status: 'success'
@commit5 = FactoryGirl.create :commit_status, pipeline: commit, name: 'aa', ref: 'bb', status: 'success'
end
it 'return unique statuses' do
......@@ -137,11 +137,11 @@ describe CommitStatus, models: true do
subject { CommitStatus.running_or_pending.order(:id) }
before do
@commit1 = FactoryGirl.create :commit_status, commit: commit, name: 'aa', ref: 'bb', status: 'running'
@commit2 = FactoryGirl.create :commit_status, commit: commit, name: 'cc', ref: 'cc', status: 'pending'
@commit3 = FactoryGirl.create :commit_status, commit: commit, name: 'aa', ref: nil, status: 'success'
@commit4 = FactoryGirl.create :commit_status, commit: commit, name: 'dd', ref: nil, status: 'failed'
@commit5 = FactoryGirl.create :commit_status, commit: commit, name: 'ee', ref: nil, status: 'canceled'
@commit1 = FactoryGirl.create :commit_status, pipeline: commit, name: 'aa', ref: 'bb', status: 'running'
@commit2 = FactoryGirl.create :commit_status, pipeline: commit, name: 'cc', ref: 'cc', status: 'pending'
@commit3 = FactoryGirl.create :commit_status, pipeline: commit, name: 'aa', ref: nil, status: 'success'
@commit4 = FactoryGirl.create :commit_status, pipeline: commit, name: 'dd', ref: nil, status: 'failed'
@commit5 = FactoryGirl.create :commit_status, pipeline: commit, name: 'ee', ref: nil, status: 'canceled'
end
it 'return statuses that are running or pending' do
......@@ -172,10 +172,10 @@ describe CommitStatus, models: true do
describe '#stages' do
before do
FactoryGirl.create :commit_status, commit: commit, stage: 'build', stage_idx: 0, status: 'success'
FactoryGirl.create :commit_status, commit: commit, stage: 'build', stage_idx: 0, status: 'failed'
FactoryGirl.create :commit_status, commit: commit, stage: 'deploy', stage_idx: 2, status: 'running'
FactoryGirl.create :commit_status, commit: commit, stage: 'test', stage_idx: 1, status: 'success'
FactoryGirl.create :commit_status, pipeline: commit, stage: 'build', stage_idx: 0, status: 'success'
FactoryGirl.create :commit_status, pipeline: commit, stage: 'build', stage_idx: 0, status: 'failed'
FactoryGirl.create :commit_status, pipeline: commit, stage: 'deploy', stage_idx: 2, status: 'running'
FactoryGirl.create :commit_status, pipeline: commit, stage: 'test', stage_idx: 1, status: 'success'
end
context 'stages list' do
......
......@@ -2,7 +2,7 @@ require 'spec_helper'
describe GenericCommitStatus, models: true do
let(:commit) { FactoryGirl.create :ci_commit }
let(:generic_commit_status) { FactoryGirl.create :generic_commit_status, commit: commit }
let(:generic_commit_status) { FactoryGirl.create :generic_commit_status, pipeline: commit }
describe :context do
subject { generic_commit_status.context }
......
......@@ -10,7 +10,7 @@ describe API::API, api: true do
let!(:developer) { create(:project_member, :developer, user: user, project: project) }
let!(:reporter) { create(:project_member, :reporter, user: user2, project: project) }
let(:commit) { create(:ci_commit, project: project)}
let(:build) { create(:ci_build, commit: commit) }
let(:build) { create(:ci_build, pipeline: commit) }
describe 'GET /projects/:id/builds ' do
let(:query) { '' }
......@@ -102,7 +102,7 @@ describe API::API, api: true do
before { get api("/projects/#{project.id}/builds/#{build.id}/artifacts", api_user) }
context 'build with artifacts' do
let(:build) { create(:ci_build, :artifacts, commit: commit) }
let(:build) { create(:ci_build, :artifacts, pipeline: commit) }
context 'authorized user' do
let(:download_headers) do
......@@ -131,7 +131,7 @@ describe API::API, api: true do
end
describe 'GET /projects/:id/builds/:build_id/trace' do
let(:build) { create(:ci_build, :trace, commit: commit) }
let(:build) { create(:ci_build, :trace, pipeline: commit) }
before { get api("/projects/#{project.id}/builds/#{build.id}/trace", api_user) }
......@@ -181,7 +181,7 @@ describe API::API, api: true do
end
describe 'POST /projects/:id/builds/:build_id/retry' do
let(:build) { create(:ci_build, :canceled, commit: commit) }
let(:build) { create(:ci_build, :canceled, pipeline: commit) }
before { post api("/projects/#{project.id}/builds/#{build.id}/retry", api_user) }
......@@ -218,7 +218,7 @@ describe API::API, api: true do
end
context 'build is erasable' do
let(:build) { create(:ci_build, :trace, :artifacts, :success, project: project, commit: commit) }
let(:build) { create(:ci_build, :trace, :artifacts, :success, project: project, pipeline: commit) }
it 'should erase build content' do
expect(response.status).to eq 201
......@@ -234,7 +234,7 @@ describe API::API, api: true do
end
context 'build is not erasable' do
let(:build) { create(:ci_build, :trace, project: project, commit: commit) }
let(:build) { create(:ci_build, :trace, project: project, pipeline: commit) }
it 'should respond with forbidden' do
expect(response.status).to eq 403
......
......@@ -5,7 +5,7 @@ describe API::CommitStatuses, api: true do
let!(:project) { create(:project) }
let(:commit) { project.repository.commit }
let(:commit_status) { create(:commit_status, commit: ci_commit) }
let(:commit_status) { create(:commit_status, pipeline: ci_commit) }
let(:guest) { create_user(:guest) }
let(:reporter) { create_user(:reporter) }
let(:developer) { create_user(:developer) }
......@@ -27,7 +27,7 @@ describe API::CommitStatuses, api: true do
let(:statuses_id) { json_response.map { |status| status['id'] } }
def create_status(commit, opts = {})
create(:commit_status, { commit: commit, ref: commit.ref }.merge(opts))
create(:commit_status, { pipeline: commit, ref: commit.ref }.merge(opts))
end
let!(:status1) { create_status(master, status: 'running') }
......
......@@ -39,7 +39,7 @@ describe Ci::API::API do
it "should return 404 error if no builds for specific runner" do
commit = FactoryGirl.create(:ci_commit, project: shared_project)
FactoryGirl.create(:ci_build, commit: commit, status: 'pending')
FactoryGirl.create(:ci_build, pipeline: commit, status: 'pending')
post ci_api("/builds/register"), token: runner.token
......@@ -48,7 +48,7 @@ describe Ci::API::API do
it "should return 404 error if no builds for shared runner" do
commit = FactoryGirl.create(:ci_commit, project: project)
FactoryGirl.create(:ci_build, commit: commit, status: 'pending')
FactoryGirl.create(:ci_build, pipeline: commit, status: 'pending')
post ci_api("/builds/register"), token: shared_runner.token
......@@ -85,7 +85,7 @@ describe Ci::API::API do
trigger = FactoryGirl.create(:ci_trigger, project: project)
commit = FactoryGirl.create(:ci_commit, project: project, ref: 'master')
trigger_request = FactoryGirl.create(:ci_trigger_request_with_variables, commit: commit, trigger: trigger)
trigger_request = FactoryGirl.create(:ci_trigger_request_with_variables, pipeline: commit, trigger: trigger)
commit.create_builds(nil, trigger_request)
project.variables << Ci::Variable.new(key: "SECRET_KEY", value: "secret_value")
......@@ -132,7 +132,7 @@ describe Ci::API::API do
context 'when build has no tags' do
before do
commit = create(:ci_commit, project: project)
create(:ci_build, commit: commit, tags: [])
create(:ci_build, pipeline: commit, tags: [])
end
context 'when runner is allowed to pick untagged builds' do
......@@ -164,7 +164,7 @@ describe Ci::API::API do
describe "PUT /builds/:id" do
let(:commit) {create(:ci_commit, project: project)}
let(:build) { create(:ci_build, :trace, commit: commit, runner_id: runner.id) }
let(:build) { create(:ci_build, :trace, pipeline: commit, runner_id: runner.id) }
before do
build.run!
......@@ -238,7 +238,7 @@ describe Ci::API::API do
let(:file_upload) { fixture_file_upload(Rails.root + 'spec/fixtures/banana_sample.gif', 'image/gif') }
let(:file_upload2) { fixture_file_upload(Rails.root + 'spec/fixtures/dk.png', 'image/gif') }
let(:commit) { create(:ci_commit, project: project) }
let(:build) { create(:ci_build, commit: commit, runner_id: runner.id) }
let(:build) { create(:ci_build, pipeline: commit, runner_id: runner.id) }
let(:authorize_url) { ci_api("/builds/#{build.id}/artifacts/authorize") }
let(:post_url) { ci_api("/builds/#{build.id}/artifacts") }
let(:delete_url) { ci_api("/builds/#{build.id}/artifacts") }
......
......@@ -6,7 +6,7 @@ module Ci
let(:project) { FactoryGirl.create(:empty_project) }
let(:commit_sha) { '01234567890123456789' }
let(:commit) { project.ensure_ci_commit(commit_sha, 'master') }
let(:build) { FactoryGirl.create(:ci_build, commit: commit) }
let(:build) { FactoryGirl.create(:ci_build, pipeline: commit) }
describe :execute do
before { build }
......
......@@ -5,7 +5,7 @@ module Ci
let!(:service) { RegisterBuildService.new }
let!(:project) { FactoryGirl.create :empty_project, shared_runners_enabled: false }
let!(:commit) { FactoryGirl.create :ci_commit, project: project }
let!(:pending_build) { FactoryGirl.create :ci_build, commit: commit }
let!(:pending_build) { FactoryGirl.create :ci_build, pipeline: commit }
let!(:shared_runner) { FactoryGirl.create(:ci_runner, is_shared: true) }
let!(:specific_runner) { FactoryGirl.create(:ci_runner, is_shared: false) }
......
......@@ -23,7 +23,7 @@ describe MergeRequests::AddTodoWhenBuildFailsService do
describe '#execute' do
context 'commit status with ref' do
let(:commit_status) { create(:generic_commit_status, ref: merge_request.source_branch, commit: ci_commit) }
let(:commit_status) { create(:generic_commit_status, ref: merge_request.source_branch, pipeline: ci_commit) }
it 'notifies the todo service' do
expect(todo_service).to receive(:merge_request_build_failed).with(merge_request)
......@@ -52,7 +52,7 @@ describe MergeRequests::AddTodoWhenBuildFailsService do
describe '#close' do
context 'commit status with ref' do
let(:commit_status) { create(:generic_commit_status, ref: merge_request.source_branch, commit: ci_commit) }
let(:commit_status) { create(:generic_commit_status, ref: merge_request.source_branch, pipeline: ci_commit) }
it 'notifies the todo service' do
expect(todo_service).to receive(:merge_request_build_retried).with(merge_request)
......
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