Commit 391710f2 authored by Kamil Trzciński (OoO till 3th)'s avatar Kamil Trzciński (OoO till 3th)

Merge branch '47040-inconsistent-job-list-in-job-details-view' into 'master'

Resolve "Inconsistent job list in job details view"

Closes #47040

See merge request gitlab-org/gitlab-ce!20243
parents 5714e57b 1d3dbe46
......@@ -44,12 +44,10 @@ class Projects::JobsController < Projects::ApplicationController
end
def show
@builds = @project.pipelines
.find_by_sha(@build.sha)
.builds
@pipeline = @build.pipeline
@builds = @pipeline.builds
.order('id DESC')
.present(current_user: current_user)
@pipeline = @build.pipeline
respond_to do |format|
format.html
......
---
title: Show jobs from same pipeline in sidebar in job details view.
merge_request: 20243
author:
type: fixed
......@@ -102,6 +102,8 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do
describe 'GET show' do
let!(:job) { create(:ci_build, :failed, pipeline: pipeline) }
let!(:second_job) { create(:ci_build, :failed, pipeline: pipeline) }
let!(:third_job) { create(:ci_build, :failed) }
context 'when requesting HTML' do
context 'when job exists' do
......@@ -113,6 +115,13 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do
expect(response).to have_gitlab_http_status(:ok)
expect(assigns(:build).id).to eq(job.id)
end
it 'has the correct build collection' do
builds = assigns(:builds).map(&:id)
expect(builds).to include(job.id, second_job.id)
expect(builds).not_to include(third_job.id)
end
end
context 'when job does not exist' 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