Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/controllers/graphql_controller_spec.rb')
-rw-r--r--spec/controllers/graphql_controller_spec.rb33
1 files changed, 7 insertions, 26 deletions
diff --git a/spec/controllers/graphql_controller_spec.rb b/spec/controllers/graphql_controller_spec.rb
index b4a7e41ccd2..be47b32ec4f 100644
--- a/spec/controllers/graphql_controller_spec.rb
+++ b/spec/controllers/graphql_controller_spec.rb
@@ -431,6 +431,13 @@ RSpec.describe GraphqlController, feature_category: :integrations do
context 'when querying an IntrospectionQuery', :use_clean_rails_memory_store_caching do
let_it_be(:query) { File.read(Rails.root.join('spec/fixtures/api/graphql/introspection.graphql')) }
+ it 'caches IntrospectionQuery even when operationName is not given' do
+ expect(GitlabSchema).to receive(:execute).exactly(:once)
+
+ post :execute, params: { query: query }
+ post :execute, params: { query: query }
+ end
+
it 'caches the IntrospectionQuery' do
expect(GitlabSchema).to receive(:execute).exactly(:once)
@@ -461,35 +468,9 @@ RSpec.describe GraphqlController, feature_category: :integrations do
post :execute, params: { query: query, operationName: 'IntrospectionQuery' }
end
- it 'logs that it will try to hit the cache' do
- expect(Gitlab::AppLogger).to receive(:info).with(message: "IntrospectionQueryCache hit")
- expect(Gitlab::AppLogger).to receive(:info).with(
- message: "IntrospectionQueryCache",
- can_use_introspection_query_cache: "true",
- query: query.to_s,
- variables: "{}",
- introspection_query_cache_key: "[\"introspection-query-cache\", \"#{Gitlab.revision}\", false]"
- )
-
- post :execute, params: { query: query, operationName: 'IntrospectionQuery' }
- end
-
context 'when there is an unknown introspection query' do
let(:query) { File.read(Rails.root.join('spec/fixtures/api/graphql/fake_introspection.graphql')) }
- it 'logs that it did not try to hit the cache' do
- expect(Gitlab::AppLogger).to receive(:info).with(message: "IntrospectionQueryCache miss")
- expect(Gitlab::AppLogger).to receive(:info).with(
- message: "IntrospectionQueryCache",
- can_use_introspection_query_cache: "false",
- query: query.to_s,
- variables: "{}",
- introspection_query_cache_key: "[\"introspection-query-cache\", \"#{Gitlab.revision}\", false]"
- )
-
- post :execute, params: { query: query, operationName: 'IntrospectionQuery' }
- end
-
it 'does not cache an unknown introspection query' do
expect(GitlabSchema).to receive(:execute).exactly(:twice)