Commit dbf235f5 authored by Kamil Trzcinski's avatar Kamil Trzcinski

Fix tests failures

parent 4e38d88d
...@@ -5,7 +5,7 @@ module Ci ...@@ -5,7 +5,7 @@ module Ci
end end
def execute(stage, user, status, trigger_request = nil) def execute(stage, user, status, trigger_request = nil)
builds_attrs = config_processor.builds_for_stage_and_ref(stage, @commit.ref, @commit.tag, trigger_request) builds_attrs = config_processor.builds_for_stage_and_ref(stage, @pipeline.ref, @pipeline.tag, trigger_request)
# check when to create next build # check when to create next build
builds_attrs = builds_attrs.select do |build_attrs| builds_attrs = builds_attrs.select do |build_attrs|
......
...@@ -30,8 +30,8 @@ feature 'Merge request created from fork' do ...@@ -30,8 +30,8 @@ feature 'Merge request created from fork' do
given(:pipeline) do given(:pipeline) do
create(:ci_pipeline_with_two_job, project: fork_project, create(:ci_pipeline_with_two_job, project: fork_project,
sha: merge_request.last_commit.id, sha: merge_request.last_commit.id,
ref: merge_request.source_branch) ref: merge_request.source_branch)
end end
background { pipeline.create_builds(user) } background { pipeline.create_builds(user) }
......
...@@ -12,8 +12,8 @@ feature 'project commit builds' do ...@@ -12,8 +12,8 @@ feature 'project commit builds' do
context 'when no builds triggered yet' do context 'when no builds triggered yet' do
background do background do
create(:ci_pipeline, project: project, create(:ci_pipeline, project: project,
sha: project.commit.sha, sha: project.commit.sha,
ref: 'master') ref: 'master')
end end
scenario 'user views commit builds page' do scenario 'user views commit builds page' do
......
...@@ -110,8 +110,8 @@ describe Gitlab::Badge::Build do ...@@ -110,8 +110,8 @@ describe Gitlab::Badge::Build do
def create_build(project, sha, branch) def create_build(project, sha, branch)
pipeline = create(:ci_pipeline, project: project, pipeline = create(:ci_pipeline, project: project,
sha: sha, sha: sha,
ref: branch) ref: branch)
create(:ci_build, pipeline: pipeline) create(:ci_build, pipeline: pipeline)
end end
......
...@@ -219,7 +219,7 @@ describe Ci::Build, models: true do ...@@ -219,7 +219,7 @@ describe Ci::Build, models: true do
context 'and trigger variables' do context 'and trigger variables' do
let(:trigger) { create(:ci_trigger, project: project) } let(:trigger) { create(:ci_trigger, project: project) }
let(:trigger_request) { create(:ci_trigger_request_with_variables, pipeline: pipeline, trigger: trigger) } let(:trigger_request) { create(:ci_trigger_request_with_variables, commit: pipeline, trigger: trigger) }
let(:trigger_variables) do let(:trigger_variables) do
[ [
{ key: :TRIGGER_KEY, value: 'TRIGGER_VALUE', public: false } { key: :TRIGGER_KEY, value: 'TRIGGER_VALUE', public: false }
......
...@@ -401,7 +401,7 @@ describe Project, models: true do ...@@ -401,7 +401,7 @@ describe Project, models: true do
describe :pipeline do describe :pipeline do
let(:project) { create :project } let(:project) { create :project }
let(:pipeline) { create :pipeline, project: project, ref: 'master' } let(:pipeline) { create :ci_pipeline, project: project, ref: 'master' }
subject { project.pipeline(pipeline.sha, 'master') } subject { project.pipeline(pipeline.sha, 'master') }
......
...@@ -70,11 +70,11 @@ describe CreateCommitBuildsService, services: true do ...@@ -70,11 +70,11 @@ describe CreateCommitBuildsService, services: true do
stub_ci_pipeline_yaml_file('invalid: file: file') stub_ci_pipeline_yaml_file('invalid: file: file')
commits = [{ message: message }] commits = [{ message: message }]
pipeline = service.execute(project, user, pipeline = service.execute(project, user,
ref: 'refs/tags/0_1', ref: 'refs/tags/0_1',
before: '00000000', before: '00000000',
after: '31das312', after: '31das312',
commits: commits commits: commits
) )
expect(pipeline).to be_persisted expect(pipeline).to be_persisted
expect(pipeline.builds.any?).to be false expect(pipeline.builds.any?).to be false
expect(pipeline.status).to eq('failed') expect(pipeline.status).to eq('failed')
...@@ -91,11 +91,11 @@ describe CreateCommitBuildsService, services: true do ...@@ -91,11 +91,11 @@ describe CreateCommitBuildsService, services: true do
it "skips builds creation if there is [ci skip] tag in commit message" do it "skips builds creation if there is [ci skip] tag in commit message" do
commits = [{ message: message }] commits = [{ message: message }]
pipeline = service.execute(project, user, pipeline = service.execute(project, user,
ref: 'refs/tags/0_1', ref: 'refs/tags/0_1',
before: '00000000', before: '00000000',
after: '31das312', after: '31das312',
commits: commits commits: commits
) )
expect(pipeline).to be_persisted expect(pipeline).to be_persisted
expect(pipeline.builds.any?).to be false expect(pipeline.builds.any?).to be false
expect(pipeline.status).to eq("skipped") expect(pipeline.status).to eq("skipped")
...@@ -106,11 +106,11 @@ describe CreateCommitBuildsService, services: true do ...@@ -106,11 +106,11 @@ describe CreateCommitBuildsService, services: true do
commits = [{ message: "some message" }] commits = [{ message: "some message" }]
pipeline = service.execute(project, user, pipeline = service.execute(project, user,
ref: 'refs/tags/0_1', ref: 'refs/tags/0_1',
before: '00000000', before: '00000000',
after: '31das312', after: '31das312',
commits: commits commits: commits
) )
expect(pipeline).to be_persisted expect(pipeline).to be_persisted
expect(pipeline.builds.first.name).to eq("staging") expect(pipeline.builds.first.name).to eq("staging")
...@@ -120,11 +120,11 @@ describe CreateCommitBuildsService, services: true do ...@@ -120,11 +120,11 @@ describe CreateCommitBuildsService, services: true do
stub_ci_pipeline_yaml_file('invalid: file: fiile') stub_ci_pipeline_yaml_file('invalid: file: fiile')
commits = [{ message: message }] commits = [{ message: message }]
pipeline = service.execute(project, user, pipeline = service.execute(project, user,
ref: 'refs/tags/0_1', ref: 'refs/tags/0_1',
before: '00000000', before: '00000000',
after: '31das312', after: '31das312',
commits: commits commits: commits
) )
expect(pipeline).to be_persisted expect(pipeline).to be_persisted
expect(pipeline.builds.any?).to be false expect(pipeline.builds.any?).to be false
expect(pipeline.status).to eq("skipped") expect(pipeline.status).to eq("skipped")
...@@ -137,20 +137,20 @@ describe CreateCommitBuildsService, services: true do ...@@ -137,20 +137,20 @@ describe CreateCommitBuildsService, services: true do
commits = [{ message: "message" }] commits = [{ message: "message" }]
pipeline = service.execute(project, user, pipeline = service.execute(project, user,
ref: 'refs/heads/master', ref: 'refs/heads/master',
before: '00000000', before: '00000000',
after: '31das312', after: '31das312',
commits: commits commits: commits
) )
expect(pipeline).to be_persisted expect(pipeline).to be_persisted
expect(pipeline.builds.count(:all)).to eq(2) expect(pipeline.builds.count(:all)).to eq(2)
pipeline = service.execute(project, user, pipeline = service.execute(project, user,
ref: 'refs/heads/master', ref: 'refs/heads/master',
before: '00000000', before: '00000000',
after: '31das312', after: '31das312',
commits: commits commits: commits
) )
expect(pipeline).to be_persisted expect(pipeline).to be_persisted
expect(pipeline.builds.count(:all)).to eq(2) expect(pipeline.builds.count(:all)).to eq(2)
end end
...@@ -161,11 +161,11 @@ describe CreateCommitBuildsService, services: true do ...@@ -161,11 +161,11 @@ describe CreateCommitBuildsService, services: true do
commits = [{ message: "some message" }] commits = [{ message: "some message" }]
pipeline = service.execute(project, user, pipeline = service.execute(project, user,
ref: 'refs/tags/0_1', ref: 'refs/tags/0_1',
before: '00000000', before: '00000000',
after: '31das312', after: '31das312',
commits: commits commits: commits
) )
expect(pipeline).to be_persisted expect(pipeline).to be_persisted
expect(pipeline.status).to eq("failed") expect(pipeline.status).to eq("failed")
......
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