summaryrefslogtreecommitdiff
path: root/spec/graphql/types
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-07-20 09:55:51 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-07-20 09:55:51 +0000
commite8d2c2579383897a1dd7f9debd359abe8ae8373d (patch)
treec42be41678c2586d49a75cabce89322082698334 /spec/graphql/types
parentfc845b37ec3a90aaa719975f607740c22ba6a113 (diff)
downloadgitlab-ce-e8d2c2579383897a1dd7f9debd359abe8ae8373d.tar.gz
Add latest changes from gitlab-org/gitlab@14-1-stable-eev14.1.0-rc42
Diffstat (limited to 'spec/graphql/types')
-rw-r--r--spec/graphql/types/alert_management/prometheus_integration_type_spec.rb4
-rw-r--r--spec/graphql/types/base_field_spec.rb67
-rw-r--r--spec/graphql/types/ci/detailed_status_type_spec.rb16
-rw-r--r--spec/graphql/types/ci/group_type_spec.rb1
-rw-r--r--spec/graphql/types/ci/job_token_scope_type_spec.rb75
-rw-r--r--spec/graphql/types/ci/pipeline_type_spec.rb2
-rw-r--r--spec/graphql/types/ci/runner_type_spec.rb1
-rw-r--r--spec/graphql/types/ci/stage_type_spec.rb2
-rw-r--r--spec/graphql/types/ci/status_action_type_spec.rb20
-rw-r--r--spec/graphql/types/deployment_tier_enum_spec.rb15
-rw-r--r--spec/graphql/types/global_id_type_spec.rb3
-rw-r--r--spec/graphql/types/issuable_searchable_field_enum_spec.rb13
-rw-r--r--spec/graphql/types/issue_type_spec.rb4
-rw-r--r--spec/graphql/types/merge_request_type_spec.rb2
-rw-r--r--spec/graphql/types/milestone_type_spec.rb2
-rw-r--r--spec/graphql/types/notes/discussion_type_spec.rb1
-rw-r--r--spec/graphql/types/notes/noteable_interface_spec.rb (renamed from spec/graphql/types/notes/noteable_type_spec.rb)2
-rw-r--r--spec/graphql/types/project_type_spec.rb80
-rw-r--r--spec/graphql/types/projects/service_type_spec.rb2
-rw-r--r--spec/graphql/types/projects/services_enum_spec.rb2
-rw-r--r--spec/graphql/types/query_complexity_type_spec.rb35
-rw-r--r--spec/graphql/types/release_asset_link_type_spec.rb2
-rw-r--r--spec/graphql/types/snippets/blob_type_spec.rb3
23 files changed, 314 insertions, 40 deletions
diff --git a/spec/graphql/types/alert_management/prometheus_integration_type_spec.rb b/spec/graphql/types/alert_management/prometheus_integration_type_spec.rb
index d057afb331c..31cf94aef44 100644
--- a/spec/graphql/types/alert_management/prometheus_integration_type_spec.rb
+++ b/spec/graphql/types/alert_management/prometheus_integration_type_spec.rb
@@ -17,7 +17,7 @@ RSpec.describe GitlabSchema.types['AlertManagementPrometheusIntegration'] do
end
end
- let_it_be_with_reload(:integration) { create(:prometheus_service) }
+ let_it_be_with_reload(:integration) { create(:prometheus_integration) }
let_it_be(:user) { create(:user, maintainer_projects: [integration.project]) }
it_behaves_like 'has field with value', 'name' do
@@ -50,7 +50,7 @@ RSpec.describe GitlabSchema.types['AlertManagementPrometheusIntegration'] do
describe 'a group integration' do
let_it_be(:group) { create(:group) }
- let_it_be(:integration) { create(:prometheus_service, project: nil, group: group) }
+ let_it_be(:integration) { create(:prometheus_integration, project: nil, group: group) }
# Since it is impossible to authorize the parent here, given that the
# project is nil, all fields should be redacted:
diff --git a/spec/graphql/types/base_field_spec.rb b/spec/graphql/types/base_field_spec.rb
index 54b59317b55..c34fbf42dd8 100644
--- a/spec/graphql/types/base_field_spec.rb
+++ b/spec/graphql/types/base_field_spec.rb
@@ -130,14 +130,25 @@ RSpec.describe Types::BaseField do
skip_feature_flags_yaml_validation
end
- it 'returns false if the feature is not enabled' do
- stub_feature_flags(flag => false)
-
- expect(field.visible?(context)).to eq(false)
+ it 'checks YAML definition for default_enabled' do
+ # Exception is indicative of a check for YAML definition
+ expect { field.visible?(context) }.to raise_error(Feature::InvalidFeatureFlagError, /The feature flag YAML definition for '#{flag}' does not exist/)
end
- it 'returns true if the feature is enabled' do
- expect(field.visible?(context)).to eq(true)
+ context 'skipping YAML check' do
+ before do
+ skip_default_enabled_yaml_check
+ end
+
+ it 'returns false if the feature is not enabled' do
+ stub_feature_flags(flag => false)
+
+ expect(field.visible?(context)).to eq(false)
+ end
+
+ it 'returns true if the feature is enabled' do
+ expect(field.visible?(context)).to eq(true)
+ end
end
end
end
@@ -149,17 +160,17 @@ RSpec.describe Types::BaseField do
let(:flag) { :test_flag }
it 'prepends the description' do
- expect(field.description). to eq 'Test description. Available only when feature flag `test_flag` is enabled.'
+ expect(field.description).to start_with 'Test description. Available only when feature flag `test_flag` is enabled.'
end
context 'falsey feature_flag values' do
using RSpec::Parameterized::TableSyntax
- where(:flag, :feature_value) do
- '' | false
- '' | true
- nil | false
- nil | true
+ where(:flag, :feature_value, :default_enabled) do
+ '' | false | false
+ '' | true | false
+ nil | false | true
+ nil | true | false
end
with_them do
@@ -168,6 +179,33 @@ RSpec.describe Types::BaseField do
end
end
end
+
+ context 'with different default_enabled values' do
+ using RSpec::Parameterized::TableSyntax
+
+ where(:feature_value, :default_enabled, :expected_description) do
+ disabled_ff_description = "Test description. Available only when feature flag `test_flag` is enabled. This flag is disabled by default, because the feature is experimental and is subject to change without notice."
+ enabled_ff_description = "Test description. Available only when feature flag `test_flag` is enabled. This flag is enabled by default."
+
+ false | false | disabled_ff_description
+ true | false | disabled_ff_description
+ false | true | enabled_ff_description
+ true | true | enabled_ff_description
+ end
+
+ with_them do
+ before do
+ stub_feature_flags("#{flag}": feature_value)
+
+ allow(Feature::Definition).to receive(:has_definition?).with(flag).and_return(true)
+ allow(Feature::Definition).to receive(:default_enabled?).and_return(default_enabled)
+ end
+
+ it 'returns the correct availability in the description' do
+ expect(field.description). to eq expected_description
+ end
+ end
+ end
end
end
@@ -185,9 +223,8 @@ RSpec.describe Types::BaseField do
feature_flag: 'foo_flag'
)
- expectation = 'Field description. Available only when feature flag `foo_flag` is enabled. Deprecated in 1.10: Deprecation reason.'
-
- expect(field.description).to eq(expectation)
+ expect(field.description).to start_with('Field description. Available only when feature flag `foo_flag` is enabled.')
+ expect(field.description).to end_with('Deprecated in 1.10: Deprecation reason.')
end
end
end
diff --git a/spec/graphql/types/ci/detailed_status_type_spec.rb b/spec/graphql/types/ci/detailed_status_type_spec.rb
index 9fa3280657a..5ed79b73a47 100644
--- a/spec/graphql/types/ci/detailed_status_type_spec.rb
+++ b/spec/graphql/types/ci/detailed_status_type_spec.rb
@@ -8,14 +8,26 @@ RSpec.describe Types::Ci::DetailedStatusType do
specify { expect(described_class.graphql_name).to eq('DetailedStatus') }
it 'has all fields' do
- expect(described_class).to have_graphql_fields(:group, :icon, :favicon,
+ expect(described_class).to have_graphql_fields(:id, :group, :icon, :favicon,
:details_path, :has_details,
:label, :text, :tooltip, :action)
end
+ let_it_be(:stage) { create(:ci_stage_entity, status: :skipped) }
+
+ describe 'id field' do
+ it 'correctly renders the field' do
+ parent_object = double(:parent_object, object: stage)
+ parent = double(:parent, object: parent_object)
+ status = stage.detailed_status(stage.pipeline.user)
+ expected_id = "#{status.id}-#{stage.id}"
+
+ expect(resolve_field('id', status, extras: { parent: parent })).to eq(expected_id)
+ end
+ end
+
describe 'action field' do
it 'correctly renders the field' do
- stage = create(:ci_stage_entity, status: :skipped)
status = stage.detailed_status(stage.pipeline.user)
expected_status = {
diff --git a/spec/graphql/types/ci/group_type_spec.rb b/spec/graphql/types/ci/group_type_spec.rb
index d7ce5602612..f563b31342f 100644
--- a/spec/graphql/types/ci/group_type_spec.rb
+++ b/spec/graphql/types/ci/group_type_spec.rb
@@ -7,6 +7,7 @@ RSpec.describe Types::Ci::GroupType do
it 'exposes the expected fields' do
expected_fields = %i[
+ id
name
size
jobs
diff --git a/spec/graphql/types/ci/job_token_scope_type_spec.rb b/spec/graphql/types/ci/job_token_scope_type_spec.rb
new file mode 100644
index 00000000000..19a8cc324f9
--- /dev/null
+++ b/spec/graphql/types/ci/job_token_scope_type_spec.rb
@@ -0,0 +1,75 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe GitlabSchema.types['CiJobTokenScopeType'] do
+ specify { expect(described_class.graphql_name).to eq('CiJobTokenScopeType') }
+
+ it 'has the correct fields' do
+ expected_fields = [:projects]
+
+ expect(described_class).to have_graphql_fields(*expected_fields)
+ end
+
+ describe 'query' do
+ let_it_be(:project) { create(:project, ci_job_token_scope_enabled: true).tap(&:save!) }
+ let_it_be(:current_user) { create(:user) }
+
+ let(:query) do
+ %(
+ query {
+ project(fullPath: "#{project.full_path}") {
+ ciJobTokenScope {
+ projects {
+ nodes {
+ path
+ }
+ }
+ }
+ }
+ }
+ )
+ end
+
+ subject { GitlabSchema.execute(query, context: { current_user: current_user }).as_json }
+
+ let(:projects_field) { subject.dig('data', 'project', 'ciJobTokenScope', 'projects', 'nodes') }
+ let(:returned_project_paths) { projects_field.map { |project| project['path']} }
+
+ context 'with access to scope' do
+ before do
+ project.add_user(current_user, :maintainer)
+ end
+
+ context 'when multiple projects in the allow list' do
+ let!(:link) { create(:ci_job_token_project_scope_link, source_project: project) }
+
+ context 'when linked projects are readable' do
+ before do
+ link.target_project.add_user(current_user, :developer)
+ end
+
+ it 'returns readable projects in scope' do
+ expect(returned_project_paths).to contain_exactly(project.path, link.target_project.path)
+ end
+ end
+
+ context 'when linked project is not readable' do
+ it 'returns readable projects in scope' do
+ expect(returned_project_paths).to contain_exactly(project.path)
+ end
+ end
+
+ context 'when job token scope is disabled' do
+ before do
+ project.ci_cd_settings.update!(job_token_scope_enabled: false)
+ end
+
+ it 'returns nil' do
+ expect(subject.dig('data', 'project', 'ciJobTokenScope')).to be_nil
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/spec/graphql/types/ci/pipeline_type_spec.rb b/spec/graphql/types/ci/pipeline_type_spec.rb
index 35d48229fa4..9ba4252bcd5 100644
--- a/spec/graphql/types/ci/pipeline_type_spec.rb
+++ b/spec/graphql/types/ci/pipeline_type_spec.rb
@@ -14,7 +14,7 @@ RSpec.describe Types::Ci::PipelineType do
coverage created_at updated_at started_at finished_at committed_at
stages user retryable cancelable jobs source_job job downstream
upstream path project active user_permissions warnings commit_path uses_needs
- test_report_summary test_suite
+ test_report_summary test_suite ref
]
if Gitlab.ee?
diff --git a/spec/graphql/types/ci/runner_type_spec.rb b/spec/graphql/types/ci/runner_type_spec.rb
index f27216f4d39..cff4c459d79 100644
--- a/spec/graphql/types/ci/runner_type_spec.rb
+++ b/spec/graphql/types/ci/runner_type_spec.rb
@@ -11,6 +11,7 @@ RSpec.describe GitlabSchema.types['CiRunner'] do
expected_fields = %w[
id description contacted_at maximum_timeout access_level active status
version short_sha revision locked run_untagged ip_address runner_type tag_list
+ project_count job_count
]
expect(described_class).to include_graphql_fields(*expected_fields)
diff --git a/spec/graphql/types/ci/stage_type_spec.rb b/spec/graphql/types/ci/stage_type_spec.rb
index cb8c1cb02cd..48c569eca16 100644
--- a/spec/graphql/types/ci/stage_type_spec.rb
+++ b/spec/graphql/types/ci/stage_type_spec.rb
@@ -7,9 +7,11 @@ RSpec.describe Types::Ci::StageType do
it 'exposes the expected fields' do
expected_fields = %i[
+ id
name
groups
detailedStatus
+ status
jobs
]
diff --git a/spec/graphql/types/ci/status_action_type_spec.rb b/spec/graphql/types/ci/status_action_type_spec.rb
index 8a99068e44f..ab7dee3dd11 100644
--- a/spec/graphql/types/ci/status_action_type_spec.rb
+++ b/spec/graphql/types/ci/status_action_type_spec.rb
@@ -3,10 +3,13 @@
require 'spec_helper'
RSpec.describe Types::Ci::StatusActionType do
+ include GraphqlHelpers
+
specify { expect(described_class.graphql_name).to eq('StatusAction') }
it 'exposes the expected fields' do
expected_fields = %i[
+ id
buttonTitle
icon
path
@@ -16,4 +19,21 @@ RSpec.describe Types::Ci::StatusActionType do
expect(described_class).to have_graphql_fields(*expected_fields)
end
+
+ describe 'id field' do
+ it 'correctly renders the field' do
+ stage = build(:ci_stage_entity, status: :skipped)
+ status = stage.detailed_status(stage.pipeline.user)
+
+ grandparent_object = double(:grandparent_object, object: stage)
+ parent_object = double(:parent_object, object: status)
+
+ grandparent = double(:parent, object: grandparent_object)
+ parent = double(:parent, object: parent_object, parent: grandparent)
+
+ expected_id = "#{stage.class.name}-#{status.id}"
+
+ expect(resolve_field('id', status, extras: { parent: parent })).to eq(expected_id)
+ end
+ end
end
diff --git a/spec/graphql/types/deployment_tier_enum_spec.rb b/spec/graphql/types/deployment_tier_enum_spec.rb
new file mode 100644
index 00000000000..752bf895d74
--- /dev/null
+++ b/spec/graphql/types/deployment_tier_enum_spec.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Types::DeploymentTierEnum do
+ it 'includes a value for each supported environment tier' do
+ expect(described_class.values).to match(
+ 'PRODUCTION' => have_attributes(value: :production),
+ 'STAGING' => have_attributes(value: :staging),
+ 'TESTING' => have_attributes(value: :testing),
+ 'DEVELOPMENT' => have_attributes(value: :development),
+ 'OTHER' => have_attributes(value: :other)
+ )
+ end
+end
diff --git a/spec/graphql/types/global_id_type_spec.rb b/spec/graphql/types/global_id_type_spec.rb
index 37f59770817..cdf09dd9cc9 100644
--- a/spec/graphql/types/global_id_type_spec.rb
+++ b/spec/graphql/types/global_id_type_spec.rb
@@ -3,7 +3,6 @@
require 'spec_helper'
RSpec.describe Types::GlobalIDType do
- include ::Gitlab::Graphql::Laziness
include GraphqlHelpers
include GlobalIDDeprecationHelpers
@@ -103,7 +102,7 @@ RSpec.describe Types::GlobalIDType do
end
context 'with a deprecation' do
- around(:all) do |example|
+ around do |example|
# Unset all previously memoized GlobalIDTypes to allow us to define one
# that will use the constants stubbed in the `before` block.
previous_id_types = Types::GlobalIDType.instance_variable_get(:@id_types)
diff --git a/spec/graphql/types/issuable_searchable_field_enum_spec.rb b/spec/graphql/types/issuable_searchable_field_enum_spec.rb
new file mode 100644
index 00000000000..13e1b55ac7b
--- /dev/null
+++ b/spec/graphql/types/issuable_searchable_field_enum_spec.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Types::IssuableSearchableFieldEnum do
+ specify { expect(described_class.graphql_name).to eq('IssuableSearchableField') }
+
+ it 'exposes all the issuable searchable fields' do
+ expect(described_class.values.keys).to contain_exactly(
+ *Issuable::SEARCHABLE_FIELDS.map(&:upcase)
+ )
+ end
+end
diff --git a/spec/graphql/types/issue_type_spec.rb b/spec/graphql/types/issue_type_spec.rb
index 6908a610aae..a117741b3a2 100644
--- a/spec/graphql/types/issue_type_spec.rb
+++ b/spec/graphql/types/issue_type_spec.rb
@@ -9,7 +9,7 @@ RSpec.describe GitlabSchema.types['Issue'] do
specify { expect(described_class).to require_graphql_authorizations(:read_issue) }
- specify { expect(described_class.interfaces).to include(Types::Notes::NoteableType) }
+ specify { expect(described_class.interfaces).to include(Types::Notes::NoteableInterface) }
specify { expect(described_class.interfaces).to include(Types::CurrentUserTodos) }
@@ -18,7 +18,7 @@ RSpec.describe GitlabSchema.types['Issue'] do
confidential discussion_locked upvotes downvotes user_notes_count user_discussions_count web_path web_url relative_position
emails_disabled subscribed time_estimate total_time_spent human_time_estimate human_total_time_spent closed_at created_at updated_at task_completion_status
design_collection alert_management_alert severity current_user_todos moved moved_to
- create_note_email timelogs]
+ create_note_email timelogs project_id]
fields.each do |field_name|
expect(described_class).to have_graphql_field(field_name)
diff --git a/spec/graphql/types/merge_request_type_spec.rb b/spec/graphql/types/merge_request_type_spec.rb
index 875a16a79e5..bc3ccb0d9ba 100644
--- a/spec/graphql/types/merge_request_type_spec.rb
+++ b/spec/graphql/types/merge_request_type_spec.rb
@@ -9,7 +9,7 @@ RSpec.describe GitlabSchema.types['MergeRequest'] do
specify { expect(described_class).to require_graphql_authorizations(:read_merge_request) }
- specify { expect(described_class.interfaces).to include(Types::Notes::NoteableType) }
+ specify { expect(described_class.interfaces).to include(Types::Notes::NoteableInterface) }
specify { expect(described_class.interfaces).to include(Types::CurrentUserTodos) }
diff --git a/spec/graphql/types/milestone_type_spec.rb b/spec/graphql/types/milestone_type_spec.rb
index 5c2ae5cea3c..f00acb3f7cf 100644
--- a/spec/graphql/types/milestone_type_spec.rb
+++ b/spec/graphql/types/milestone_type_spec.rb
@@ -9,7 +9,7 @@ RSpec.describe GitlabSchema.types['Milestone'] do
it 'has the expected fields' do
expected_fields = %w[
- id iid title description state web_path
+ id iid title description state expired web_path
due_date start_date created_at updated_at
project_milestone group_milestone subgroup_milestone
stats
diff --git a/spec/graphql/types/notes/discussion_type_spec.rb b/spec/graphql/types/notes/discussion_type_spec.rb
index 37ed861d069..5290c1e2eb6 100644
--- a/spec/graphql/types/notes/discussion_type_spec.rb
+++ b/spec/graphql/types/notes/discussion_type_spec.rb
@@ -13,6 +13,7 @@ RSpec.describe GitlabSchema.types['Discussion'] do
resolved
resolved_at
resolved_by
+ noteable
]
expect(described_class).to have_graphql_fields(*expected_fields)
diff --git a/spec/graphql/types/notes/noteable_type_spec.rb b/spec/graphql/types/notes/noteable_interface_spec.rb
index fad24c6fed4..be2c30aac72 100644
--- a/spec/graphql/types/notes/noteable_type_spec.rb
+++ b/spec/graphql/types/notes/noteable_interface_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-RSpec.describe Types::Notes::NoteableType do
+RSpec.describe Types::Notes::NoteableInterface do
it 'exposes the expected fields' do
expected_fields = %i[
discussions
diff --git a/spec/graphql/types/project_type_spec.rb b/spec/graphql/types/project_type_spec.rb
index 0f7cadbd4a7..a22110e8338 100644
--- a/spec/graphql/types/project_type_spec.rb
+++ b/spec/graphql/types/project_type_spec.rb
@@ -4,6 +4,7 @@ require 'spec_helper'
RSpec.describe GitlabSchema.types['Project'] do
include GraphqlHelpers
+ include Ci::TemplateHelpers
specify { expect(described_class).to expose_permissions_using(Types::PermissionTypes::Project) }
@@ -38,6 +39,61 @@ RSpec.describe GitlabSchema.types['Project'] do
expect(described_class).to include_graphql_fields(*expected_fields)
end
+ describe 'container_registry_enabled' do
+ let_it_be(:project, reload: true) { create(:project, :public) }
+ let_it_be(:user) { create(:user) }
+
+ let(:query) do
+ %(
+ query {
+ project(fullPath: "#{project.full_path}") {
+ containerRegistryEnabled
+ }
+ }
+ )
+ end
+
+ subject { GitlabSchema.execute(query, context: { current_user: user }).as_json }
+
+ context 'with `enabled` visibility' do
+ before do
+ project.project_feature.update_column(:container_registry_access_level, ProjectFeature::ENABLED)
+ end
+
+ context 'with non member user' do
+ it 'returns true' do
+ expect(subject.dig('data', 'project', 'containerRegistryEnabled')).to eq(true)
+ end
+ end
+ end
+
+ context 'with `private` visibility' do
+ before do
+ project.project_feature.update_column(:container_registry_access_level, ProjectFeature::PRIVATE)
+ end
+
+ context 'with reporter user' do
+ before do
+ project.add_reporter(user)
+ end
+
+ it 'returns true' do
+ expect(subject.dig('data', 'project', 'containerRegistryEnabled')).to eq(true)
+ end
+ end
+
+ context 'with guest user' do
+ before do
+ project.add_guest(user)
+ end
+
+ it 'returns false' do
+ expect(subject.dig('data', 'project', 'containerRegistryEnabled')).to eq(false)
+ end
+ end
+ end
+ end
+
describe 'sast_ci_configuration' do
let_it_be(:project) { create(:project) }
let_it_be(:user) { create(:user) }
@@ -103,15 +159,14 @@ RSpec.describe GitlabSchema.types['Project'] do
subject { GitlabSchema.execute(query, context: { current_user: user }).as_json }
it "returns the project's sast configuration for global variables" do
- secure_analyzers_prefix = subject.dig('data', 'project', 'sastCiConfiguration', 'global', 'nodes').first
- expect(secure_analyzers_prefix['type']).to eq('string')
- expect(secure_analyzers_prefix['field']).to eq('SECURE_ANALYZERS_PREFIX')
- expect(secure_analyzers_prefix['label']).to eq('Image prefix')
- expect(secure_analyzers_prefix['defaultValue'])
- .to eq('registry.gitlab.com/gitlab-org/security-products/analyzers')
- expect(secure_analyzers_prefix['value']).to eq('registry.gitlab.com/gitlab-org/security-products/analyzers')
- expect(secure_analyzers_prefix['size']).to eq('LARGE')
- expect(secure_analyzers_prefix['options']).to be_nil
+ secure_analyzers = subject.dig('data', 'project', 'sastCiConfiguration', 'global', 'nodes').first
+ expect(secure_analyzers['type']).to eq('string')
+ expect(secure_analyzers['field']).to eq('SECURE_ANALYZERS_PREFIX')
+ expect(secure_analyzers['label']).to eq('Image prefix')
+ expect(secure_analyzers['defaultValue']).to eq(secure_analyzers_prefix)
+ expect(secure_analyzers['value']).to eq(secure_analyzers_prefix)
+ expect(secure_analyzers['size']).to eq('LARGE')
+ expect(secure_analyzers['options']).to be_nil
end
it "returns the project's sast configuration for pipeline variables" do
@@ -387,4 +442,11 @@ RSpec.describe GitlabSchema.types['Project'] do
it { is_expected.to have_graphql_type(Types::Ci::TemplateType) }
it { is_expected.to have_graphql_arguments(:name) }
end
+
+ describe 'ci_job_token_scope field' do
+ subject { described_class.fields['ciJobTokenScope'] }
+
+ it { is_expected.to have_graphql_type(Types::Ci::JobTokenScopeType) }
+ it { is_expected.to have_graphql_resolver(Resolvers::Ci::JobTokenScopeResolver) }
+ end
end
diff --git a/spec/graphql/types/projects/service_type_spec.rb b/spec/graphql/types/projects/service_type_spec.rb
index 567bdfaec24..cb09f1ca6cc 100644
--- a/spec/graphql/types/projects/service_type_spec.rb
+++ b/spec/graphql/types/projects/service_type_spec.rb
@@ -7,7 +7,7 @@ RSpec.describe Types::Projects::ServiceType do
describe ".resolve_type" do
it 'resolves the corresponding type for objects' do
- expect(described_class.resolve_type(build(:jira_service), {})).to eq(Types::Projects::Services::JiraServiceType)
+ expect(described_class.resolve_type(build(:jira_integration), {})).to eq(Types::Projects::Services::JiraServiceType)
expect(described_class.resolve_type(build(:service), {})).to eq(Types::Projects::Services::BaseServiceType)
expect(described_class.resolve_type(build(:drone_ci_integration), {})).to eq(Types::Projects::Services::BaseServiceType)
expect(described_class.resolve_type(build(:custom_issue_tracker_integration), {})).to eq(Types::Projects::Services::BaseServiceType)
diff --git a/spec/graphql/types/projects/services_enum_spec.rb b/spec/graphql/types/projects/services_enum_spec.rb
index 39c2dcd07f6..00427e1d580 100644
--- a/spec/graphql/types/projects/services_enum_spec.rb
+++ b/spec/graphql/types/projects/services_enum_spec.rb
@@ -8,6 +8,6 @@ RSpec.describe GitlabSchema.types['ServiceType'] do
end
def available_services_enum
- ::Integration.available_services_types(include_dev: false).map(&:underscore).map(&:upcase)
+ ::Integration.available_integration_types(include_dev: false).map(&:underscore).map(&:upcase)
end
end
diff --git a/spec/graphql/types/query_complexity_type_spec.rb b/spec/graphql/types/query_complexity_type_spec.rb
new file mode 100644
index 00000000000..6b2330f2b13
--- /dev/null
+++ b/spec/graphql/types/query_complexity_type_spec.rb
@@ -0,0 +1,35 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe GitlabSchema.types['QueryComplexity'] do
+ include GraphqlHelpers
+
+ specify do
+ expect(described_class).to have_graphql_fields(:limit, :score).only
+ end
+
+ it 'works when executed' do
+ query = <<-GQL
+ query {
+ queryComplexity {
+ score
+ limit
+ }
+
+ currentUser {
+ name
+ }
+ }
+ GQL
+
+ query_result = run_with_clean_state(query).to_h
+
+ data = graphql_dig_at(query_result, :data, :queryComplexity)
+
+ expect(data).to include(
+ 'score' => be > 0,
+ 'limit' => GitlabSchema::DEFAULT_MAX_COMPLEXITY
+ )
+ end
+end
diff --git a/spec/graphql/types/release_asset_link_type_spec.rb b/spec/graphql/types/release_asset_link_type_spec.rb
index 6800d5459c4..0c903b8d27a 100644
--- a/spec/graphql/types/release_asset_link_type_spec.rb
+++ b/spec/graphql/types/release_asset_link_type_spec.rb
@@ -7,7 +7,7 @@ RSpec.describe GitlabSchema.types['ReleaseAssetLink'] do
it 'has the expected fields' do
expected_fields = %w[
- id name url external link_type direct_asset_url
+ id name url external link_type direct_asset_url direct_asset_path
]
expect(described_class).to include_graphql_fields(*expected_fields)
diff --git a/spec/graphql/types/snippets/blob_type_spec.rb b/spec/graphql/types/snippets/blob_type_spec.rb
index 60c0db8e551..e20b001ba7f 100644
--- a/spec/graphql/types/snippets/blob_type_spec.rb
+++ b/spec/graphql/types/snippets/blob_type_spec.rb
@@ -6,7 +6,7 @@ RSpec.describe GitlabSchema.types['SnippetBlob'] do
include GraphqlHelpers
it 'has the correct fields' do
- expected_fields = [:rich_data, :plain_data,
+ expected_fields = [:rich_data, :plain_data, :raw_plain_data,
:raw_path, :size, :binary, :name, :path,
:simple_viewer, :rich_viewer, :mode, :external_storage,
:rendered_as_text]
@@ -18,6 +18,7 @@ RSpec.describe GitlabSchema.types['SnippetBlob'] do
{
'richData' => be_nullable,
'plainData' => be_nullable,
+ 'rawPlainData' => be_nullable,
'rawPath' => be_non_null,
'size' => be_non_null,
'binary' => be_non_null,