diff options
Diffstat (limited to 'spec/requests/api/graphql/ci/runners_spec.rb')
-rw-r--r-- | spec/requests/api/graphql/ci/runners_spec.rb | 49 |
1 files changed, 48 insertions, 1 deletions
diff --git a/spec/requests/api/graphql/ci/runners_spec.rb b/spec/requests/api/graphql/ci/runners_spec.rb index d3e94671724..a5b8115286e 100644 --- a/spec/requests/api/graphql/ci/runners_spec.rb +++ b/spec/requests/api/graphql/ci/runners_spec.rb @@ -18,7 +18,10 @@ RSpec.describe 'Query.runners' do let(:fields) do <<~QUERY nodes { - #{all_graphql_fields_for('CiRunner')} + #{all_graphql_fields_for('CiRunner', excluded: %w[ownerProject])} + ownerProject { + id + } } QUERY end @@ -123,3 +126,47 @@ RSpec.describe 'Query.runners' do end end end + +RSpec.describe 'Group.runners' do + include GraphqlHelpers + + let_it_be(:group) { create(:group) } + let_it_be(:group_owner) { create_default(:user) } + + before do + group.add_owner(group_owner) + end + + describe 'edges' do + let_it_be(:runner) do + create(:ci_runner, :group, active: false, version: 'def', revision: '456', + description: 'Project runner', groups: [group], ip_address: '127.0.0.1') + end + + let(:query) do + %( + query($path: ID!) { + group(fullPath: $path) { + runners { + edges { + webUrl + editUrl + node { #{all_graphql_fields_for('CiRunner')} } + } + } + } + } + ) + end + + it 'contains custom edge information' do + r = GitlabSchema.execute(query, + context: { current_user: group_owner }, + variables: { path: group.full_path }) + + edges = graphql_dig_at(r.to_h, :data, :group, :runners, :edges) + + expect(edges).to contain_exactly(a_graphql_entity_for(web_url: be_present, edit_url: be_present)) + end + end +end |