Commit c6c58538 authored by lauraMon's avatar lauraMon

Updates specs that use all_graphql_fields

* Added max_depth or excluded pipeline when appropriate
* Updates the docs
parent 7423a9dd
......@@ -12,7 +12,7 @@ module Resolvers
argument :sha, GraphQL::STRING_TYPE,
required: false,
description: 'Sha of the Pipeline, e.g., ""dyd0f15ay83993f5ab66k927w28673882x99100b".'
description: 'SHA of the Pipeline, e.g., "dyd0f15ay83993f5ab66k927w28673882x99100b".'
def ready?(iid: nil, sha: nil)
unless iid.present? ^ sha.present?
......
......@@ -96,7 +96,7 @@ module Types
description: "Relative path to the pipeline's page."
field :commit_path, GraphQL::STRING_TYPE, null: true,
description: 'Relative path to the'
description: 'Path to the commit that triggered the pipeline.'
field :project, Types::ProjectType, null: true,
description: 'Project the pipeline belongs to.'
......
......@@ -3172,7 +3172,7 @@ Information about pagination in a connection.
| `active` | Boolean! | Indicates if the pipeline is active. |
| `beforeSha` | String | Base SHA of the source branch. |
| `cancelable` | Boolean! | Specifies if a pipeline can be canceled. |
| `commitPath` | String | Relative path to the |
| `commitPath` | String | Path to the commit that triggered the pipeline. |
| `committedAt` | Time | Timestamp of the pipeline's commit. |
| `configSource` | PipelineConfigSourceEnum | Configuration source of the pipeline (UNKNOWN_SOURCE, REPOSITORY_SOURCE, AUTO_DEVOPS_SOURCE, WEBIDE_SOURCE, REMOTE_SOURCE, EXTERNAL_PROJECT_SOURCE, BRIDGE_SOURCE, PARAMETER_SOURCE, COMPLIANCE_SOURCE) |
| `coverage` | Float | Coverage percentage. |
......
......@@ -14,7 +14,7 @@ RSpec.describe 'getting a requirement list for a project' do
<<~QUERY
edges {
node {
#{all_graphql_fields_for('requirements'.classify)}
#{all_graphql_fields_for('requirements'.classify, max_depth: 1)}
}
}
QUERY
......
......@@ -54,7 +54,7 @@ RSpec.describe Resolvers::ProjectPipelineResolver do
end
it 'keeps the queries under the threshold for sha' do
create(:ci_pipeline, project: project, sha: 'sha')
create(:ci_pipeline, project: project, sha: 'sha2')
control = ActiveRecord::QueryRecorder.new do
batch_sync { resolve_pipeline(project, { sha: 'sha' }) }
......@@ -81,6 +81,11 @@ RSpec.describe Resolvers::ProjectPipelineResolver do
.to raise_error(Gitlab::Graphql::Errors::ArgumentError)
end
it 'errors when both iid and sha are passed' do
expect { resolve_pipeline(project, { iid: '1234', sha: 'sha' }) }
.to raise_error(Gitlab::Graphql::Errors::ArgumentError)
end
context 'when the pipeline is a dangling pipeline' do
let(:pipeline) do
dangling_source = ::Enums::Ci::Pipeline.dangling_sources.each_value.first
......
......@@ -13,7 +13,7 @@ RSpec.describe 'container repository details' do
graphql_query_for(
'containerRepository',
{ id: container_repository_global_id },
all_graphql_fields_for('ContainerRepositoryDetails')
all_graphql_fields_for('ContainerRepositoryDetails', excluded: ['pipeline'])
)
end
......
......@@ -18,7 +18,7 @@ RSpec.describe 'getting container repositories in a group' do
<<~GQL
edges {
node {
#{all_graphql_fields_for('container_repositories'.classify)}
#{all_graphql_fields_for('container_repositories'.classify, max_depth: 1)}
}
}
GQL
......
......@@ -23,7 +23,7 @@ RSpec.describe 'getting projects' do
projects(includeSubgroups: #{include_subgroups}) {
edges {
node {
#{all_graphql_fields_for('Project')}
#{all_graphql_fields_for('Project', max_depth: 1)}
}
}
}
......
......@@ -15,7 +15,7 @@ RSpec.describe 'package details' do
end
let(:depth) { 3 }
let(:excluded) { %w[metadata apiFuzzingCiConfiguration] }
let(:excluded) { %w[metadata apiFuzzingCiConfiguration pipeline] }
let(:query) do
graphql_query_for(:package, { id: package_global_id }, <<~FIELDS)
......
......@@ -16,7 +16,7 @@ RSpec.describe 'getting container repositories in a project' do
<<~GQL
edges {
node {
#{all_graphql_fields_for('container_repositories'.classify)}
#{all_graphql_fields_for('container_repositories'.classify, excluded: ['pipeline'])}
}
}
GQL
......
......@@ -34,7 +34,7 @@ RSpec.describe 'getting notes for a merge request' do
notes {
edges {
node {
#{all_graphql_fields_for('Note')}
#{all_graphql_fields_for('Note', excluded: ['pipeline'])}
}
}
}
......
......@@ -9,7 +9,7 @@ RSpec.describe 'getting merge request information nested in a project' do
let(:current_user) { create(:user) }
let(:merge_request_graphql_data) { graphql_data['project']['mergeRequest'] }
let!(:merge_request) { create(:merge_request, source_project: project) }
let(:mr_fields) { all_graphql_fields_for('MergeRequest') }
let(:mr_fields) { all_graphql_fields_for('MergeRequest', excluded: ['pipeline']) }
let(:query) do
graphql_query_for(
......
......@@ -11,10 +11,14 @@ RSpec.describe 'getting pipeline information nested in a project' do
let(:pipeline_graphql_data) { graphql_data['project']['pipeline'] }
let!(:query) do
graphql_query_for(
'project',
{ 'fullPath' => project.full_path },
query_graphql_field('pipeline', iid: pipeline.iid.to_s)
%(
query {
project(fullPath: "#{project.full_path}") {
pipeline(iid: "#{pipeline.iid}") {
configSource
}
}
}
)
end
......
......@@ -17,7 +17,7 @@ RSpec.shared_context 'exposing regular notes on a noteable in GraphQL' do
notes {
edges {
node {
#{all_graphql_fields_for('Note')}
#{all_graphql_fields_for('Note', max_depth: 1)}
}
}
}
......
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