Commit dbf235f5 authored by Kamil Trzcinski's avatar Kamil Trzcinski

Fix tests failures

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