diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2024-01-08 09:07:15 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2024-01-08 09:07:15 +0300 |
commit | 80abbcbeaf4b0c47a8fe6201bd5e2d9c8af6e272 (patch) | |
tree | e729ae01587f97a0375c36aa8fe4f42e5ad91be5 /spec/requests | |
parent | e7dc35bfd6a07a4c23f83b8173df2e4d1963402a (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/requests')
-rw-r--r-- | spec/requests/api/graphql/ci/runners_spec.rb | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/spec/requests/api/graphql/ci/runners_spec.rb b/spec/requests/api/graphql/ci/runners_spec.rb index 189106fae7b..bfe5282cbaa 100644 --- a/spec/requests/api/graphql/ci/runners_spec.rb +++ b/spec/requests/api/graphql/ci/runners_spec.rb @@ -165,6 +165,43 @@ RSpec.describe 'Query.runners', feature_category: :fleet_visibility do end end end + + context 'when filtered by creator' do + let_it_be(:user) { create(:user) } + let_it_be(:runner_created_by_user) { create(:ci_runner, :project, creator: user) } + + let(:query) do + %( + query { + runners(creatorId: "#{creator.to_global_id}") { + #{fields} + } + } + ) + end + + context 'when existing user id given' do + let(:creator) { user } + + before do + create(:ci_runner, :project, creator: create(:user)) # Should not be returned + end + + it_behaves_like 'a working graphql query returning expected runners' do + let(:expected_runners) { runner_created_by_user } + end + end + + context 'when non existent user id given' do + let(:creator) { User.new(id: non_existing_record_id) } + + it 'does not return any runners' do + post_graphql(query, current_user: current_user) + + expect(graphql_data_at(:runners, :nodes)).to be_empty + end + end + end end end |