diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-20 09:40:42 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-20 09:40:42 +0000 |
commit | ee664acb356f8123f4f6b00b73c1e1cf0866c7fb (patch) | |
tree | f8479f94a28f66654c6a4f6fb99bad6b4e86a40e /spec/requests/api/ci/runners_spec.rb | |
parent | 62f7d5c5b69180e82ae8196b7b429eeffc8e7b4f (diff) | |
download | gitlab-ce-15.5.0-rc42.tar.gz |
Add latest changes from gitlab-org/gitlab@15-5-stable-eev15.5.0-rc42
Diffstat (limited to 'spec/requests/api/ci/runners_spec.rb')
-rw-r--r-- | spec/requests/api/ci/runners_spec.rb | 40 |
1 files changed, 16 insertions, 24 deletions
diff --git a/spec/requests/api/ci/runners_spec.rb b/spec/requests/api/ci/runners_spec.rb index fa1f713e757..69f26d3f257 100644 --- a/spec/requests/api/ci/runners_spec.rb +++ b/spec/requests/api/ci/runners_spec.rb @@ -918,10 +918,11 @@ RSpec.describe API::Ci::Runners do create(:ci_build, :failed, runner: shared_runner, project: project_with_repo, pipeline: pipeline) expect_next_instance_of(Repository) do |repo| - expect(repo).to receive(:commits_by).with(oids: %w[ - 1a0b36b3cdad1d2ee32457c102a8c0b7056fa863 - c1c67abbaf91f624347bb3ae96eabe3a1b742478 - ]).once.and_call_original + expect(repo).to receive(:commits_by).with(oids: + %w[ + 1a0b36b3cdad1d2ee32457c102a8c0b7056fa863 + c1c67abbaf91f624347bb3ae96eabe3a1b742478 + ]).once.and_call_original end get api("/runners/#{shared_runner.id}/jobs", admin), params: { per_page: 2, order_by: 'id', sort: 'desc' } @@ -1124,30 +1125,27 @@ RSpec.describe API::Ci::Runners do it 'returns all runners' do get api("/groups/#{group.id}/runners", user) - expect(json_response).to match_array([ - a_hash_including('description' => 'Group runner A', 'active' => true, 'paused' => false), - a_hash_including('description' => 'Shared runner', 'active' => true, 'paused' => false) - ]) + expect(json_response).to match_array( + [ + a_hash_including('description' => 'Group runner A', 'active' => true, 'paused' => false), + a_hash_including('description' => 'Shared runner', 'active' => true, 'paused' => false) + ]) end context 'filter by type' do it 'returns record when valid and present' do get api("/groups/#{group.id}/runners?type=group_type", user) - expect(json_response).to match_array([ - a_hash_including('description' => 'Group runner A') - ]) + expect(json_response).to match_array([a_hash_including('description' => 'Group runner A')]) end it 'returns instance runners when instance_type is specified' do get api("/groups/#{group.id}/runners?type=instance_type", user) - expect(json_response).to match_array([ - a_hash_including('description' => 'Shared runner') - ]) + expect(json_response).to match_array([a_hash_including('description' => 'Shared runner')]) end - # TODO: Remove in %15.0 (https://gitlab.com/gitlab-org/gitlab/-/issues/351466) + # TODO: Remove when REST API v5 is implemented (https://gitlab.com/gitlab-org/gitlab/-/issues/351466) it 'returns empty result when type does not match' do get api("/groups/#{group.id}/runners?type=project_type", user) @@ -1167,18 +1165,14 @@ RSpec.describe API::Ci::Runners do it 'returns runners by paused state' do get api("/groups/#{group.id}/runners?paused=true", user) - expect(json_response).to match_array([ - a_hash_including('description' => 'Inactive group runner') - ]) + expect(json_response).to match_array([a_hash_including('description' => 'Inactive group runner')]) end context 'filter runners by status' do it 'returns runners by valid status' do get api("/groups/#{group.id}/runners?status=paused", user) - expect(json_response).to match_array([ - a_hash_including('description' => 'Inactive group runner') - ]) + expect(json_response).to match_array([a_hash_including('description' => 'Inactive group runner')]) end it 'does not filter by invalid status' do @@ -1195,9 +1189,7 @@ RSpec.describe API::Ci::Runners do get api("/groups/#{group.id}/runners?tag_list=tag1,tag2", user) - expect(json_response).to match_array([ - a_hash_including('description' => 'Runner tagged with tag1 and tag2') - ]) + expect(json_response).to match_array([a_hash_including('description' => 'Runner tagged with tag1 and tag2')]) end end |