diff --git a/ee/app/assets/javascripts/ci/runner/graphql/performance/runner_failed_jobs.graphql b/ee/app/assets/javascripts/ci/runner/graphql/performance/runner_failed_jobs.graphql index bafb3113e30360a340f5985df095ee767e254ee8..936caf1f24b5cf741f22051a98e384b2bfcf0ab7 100644 --- a/ee/app/assets/javascripts/ci/runner/graphql/performance/runner_failed_jobs.graphql +++ b/ee/app/assets/javascripts/ci/runner/graphql/performance/runner_failed_jobs.graphql @@ -1,5 +1,15 @@ -query getRunnerFailedJobsEE($first: Int = 2) { - jobs(first: $first, statuses: [FAILED]) { +query getRunnerFailedJobsEE( + $runnerTypes: [CiRunnerType!] = [INSTANCE_TYPE] + $failureReason: CiJobFailureReason = RUNNER_SYSTEM_FAILURE + $logLastLineCount: Int = 2 + $first: Int = 2 +) { + jobs( + first: $first + statuses: [FAILED] + runnerTypes: $runnerTypes + failureReason: $failureReason + ) { nodes { id runner { @@ -27,7 +37,7 @@ query getRunnerFailedJobsEE($first: Int = 2) { } } trace { - htmlSummary + htmlSummary(lastLines: $logLastLineCount) } userPermissions { readBuild diff --git a/ee/spec/frontend/fixtures/runner.rb b/ee/spec/frontend/fixtures/runner.rb index 8e1b2ed91a7158e51e82a1097831f0a0966318a2..3c2051cdbc34a096ed76620c049535fe083679ea 100644 --- a/ee/spec/frontend/fixtures/runner.rb +++ b/ee/spec/frontend/fixtures/runner.rb @@ -85,13 +85,28 @@ end let_it_be(:runner) { create(:ci_runner, :instance, description: 'Runner 1') } - let!(:build) { create(:ci_build, :failed, :trace_live, runner: runner) } - let!(:build2) { create(:ci_build, :failed, :trace_live, runner: runner) } + let_it_be(:build) do + create(:ci_build, :failed, :trace_live, runner: runner, failure_reason: :runner_system_failure) + end + + let_it_be(:build2) do + create(:ci_build, :failed, :trace_live, runner: runner, failure_reason: :runner_system_failure) + end + + before do + stub_licensed_features(runner_performance_insights: true) + + Ci::Build.all.each { |build| ::Ci::InstanceRunnerFailedJobs.track(build) } + end - it "#{fixtures_path}#{query_name}.json" do + it "#{fixtures_path}#{query_name}.json", :aggregate_failures do post_graphql(query, current_user: admin) expect_graphql_errors_to_be_empty + expect(graphql_data_at(:jobs, :nodes)).to contain_exactly( + a_graphql_entity_for(build), + a_graphql_entity_for(build2) + ) end end end