diff options
author | Bob Van Landuyt <bob@gitlab.com> | 2019-07-05 10:46:17 +0300 |
---|---|---|
committer | Bob Van Landuyt <bob@gitlab.com> | 2019-07-05 10:46:17 +0300 |
commit | 2e74680358353ee8b258adf2ca1cda422389fc89 (patch) | |
tree | f37d325af9866d98cf47d4f652122fd7199eea36 /spec/requests/api/graphql_spec.rb | |
parent | f845a081e336621e991587f88ee7d8ce6d012e21 (diff) | |
parent | 675c9b9f6bec35f1e6988a42c4fa6a6f8331d14f (diff) |
Merge branch '58409-increase-graphql-complexity-for-fields-that-make-gitaly-calls' into 'master'
Increase GraphQL complexity for fields that make Gitaly Calls
Closes #58409
See merge request gitlab-org/gitlab-ce!28814
Diffstat (limited to 'spec/requests/api/graphql_spec.rb')
-rw-r--r-- | spec/requests/api/graphql_spec.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/requests/api/graphql_spec.rb b/spec/requests/api/graphql_spec.rb index 656d6f8b50b..67371cb35b6 100644 --- a/spec/requests/api/graphql_spec.rb +++ b/spec/requests/api/graphql_spec.rb @@ -131,4 +131,35 @@ describe 'GraphQL' do end end end + + describe 'testing for Gitaly calls' do + let(:project) { create(:project, :repository) } + let(:user) { create(:user) } + + let(:query) do + graphql_query_for('project', { 'fullPath' => project.full_path }, %w(id)) + end + + before do + project.add_developer(user) + end + + it_behaves_like 'a working graphql query' do + before do + post_graphql(query, current_user: user) + end + end + + context 'when Gitaly is called' do + before do + allow(Gitlab::GitalyClient).to receive(:get_request_count).and_return(1, 2) + end + + it "logs a warning that the 'calls_gitaly' field declaration is missing" do + expect(Gitlab::Sentry).to receive(:track_exception).once + + post_graphql(query, current_user: user) + end + end + end end |