Commit b0f7384f authored by Lin Jen-Shin's avatar Lin Jen-Shin

Create the pipelines/builds in mixed order, feedback:

https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/5347#note_13176921

Also we give undesired builds another artifacts so that we could tell
if returned artifacts was we actual expected.
parent 02f58dbd
......@@ -213,6 +213,10 @@ describe API::API, api: true do
end
context 'find proper build' do
let(:another_artifacts) do
fixture_file_upload(Rails.root + 'spec/fixtures/dk.png', 'image/gif')
end
def verify
download_headers =
{ 'Content-Transfer-Encoding' => 'binary',
......@@ -223,11 +227,6 @@ describe API::API, api: true do
expect(response.headers).to include(download_headers)
end
def create_new_pipeline(status)
new_pipeline = create(:ci_pipeline, status: 'success')
create(:ci_build, status, :artifacts, pipeline: new_pipeline)
end
context 'with regular branch' do
before do
pipeline.update(ref: 'master',
......@@ -256,8 +255,13 @@ describe API::API, api: true do
context 'with latest pipeline' do
before do
3.times do # creating some old pipelines
create_new_pipeline(:success)
pipelines = 3.times.map do # creating some old pipelines
create(:ci_pipeline, status: 'success')
end
pipelines.reverse_each do |pipe|
new_build = create(:ci_build, :success, pipeline: pipe)
new_build.update(artifacts_file: another_artifacts)
end
end
......@@ -271,7 +275,10 @@ describe API::API, api: true do
context 'with success pipeline' do
before do
build # make sure pipeline was old, but still the latest success one
create_new_pipeline(:pending)
new_pipeline = create(:ci_pipeline, status: 'success')
new_build = create(:ci_build, :pending,
pipeline: new_pipeline)
new_build.update(artifacts_file: another_artifacts)
end
before do
......
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