diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-03-29 03:08:22 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-03-29 03:08:22 +0000 |
commit | f26311e23466947e3b57914341866aa440e67267 (patch) | |
tree | 5e23f61d79bfb8ef6b8fb745f46d21401b141c04 /qa | |
parent | 2c99b3e0f38bd94ace525f35469dae1eda051c16 (diff) | |
download | gitlab-ce-f26311e23466947e3b57914341866aa440e67267.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'qa')
-rw-r--r-- | qa/qa/resource/project.rb | 7 | ||||
-rw-r--r-- | qa/qa/resource/runner.rb | 14 | ||||
-rw-r--r-- | qa/qa/specs/features/api/4_verify/remove_runner_spec.rb | 14 | ||||
-rw-r--r-- | qa/qa/specs/features/browser_ui/3_create/web_ide/open_fork_in_web_ide_spec.rb | 7 |
4 files changed, 26 insertions, 16 deletions
diff --git a/qa/qa/resource/project.rb b/qa/qa/resource/project.rb index 740a8920cf2..1a09a3e8e59 100644 --- a/qa/qa/resource/project.rb +++ b/qa/qa/resource/project.rb @@ -295,13 +295,6 @@ module QA merge_requests.find { |mr| mr[:title] == title } end - def runners(tag_list: nil) - url = tag_list ? "#{api_runners_path}?tag_list=#{tag_list.compact.join(',')}" : api_runners_path - response = get(request_url(url, per_page: '100')) - - parse_body(response) - end - def registry_repositories response = get(request_url(api_registry_repositories_path)) parse_body(response) diff --git a/qa/qa/resource/runner.rb b/qa/qa/resource/runner.rb index 9c5c9992442..2075f302370 100644 --- a/qa/qa/resource/runner.rb +++ b/qa/qa/resource/runner.rb @@ -46,11 +46,12 @@ module QA end def remove_via_api! - runners = project.runners(tag_list: @tags) + runners = list_of_runners(tag_list: @tags) return if runners.blank? this_runner = runners.find { |runner| runner[:description] == name } + unless this_runner raise "Project #{project.path_with_namespace} does not have a runner with a description matching #{name} #{"or tags #{@tags}" if @tags&.any?}. Runners available: #{runners}" end @@ -62,6 +63,16 @@ module QA Service::DockerRun::GitlabRunner.new(name).remove! end + def list_of_runners(tag_list: nil) + url = tag_list ? "#{api_post_path}?tag_list=#{tag_list.compact.join(',')}" : api_post_path + response = get(request_url(url, per_page: '100')) + + # Capturing 500 error code responses to log this issue better. We can consider cleaning it up once https://gitlab.com/gitlab-org/gitlab/-/issues/331753 is addressed. + raise "Response returned a #{response.code} error code. #{response.body}" if response.code == Support::API::HTTP_STATUS_SERVER_ERROR + + parse_body(response) + end + def api_delete_path "/runners/#{id}" end @@ -70,6 +81,7 @@ module QA end def api_post_path + "/runners" end def api_post_body diff --git a/qa/qa/specs/features/api/4_verify/remove_runner_spec.rb b/qa/qa/specs/features/api/4_verify/remove_runner_spec.rb index 55744332d8d..64b15c6ff74 100644 --- a/qa/qa/specs/features/api/4_verify/remove_runner_spec.rb +++ b/qa/qa/specs/features/api/4_verify/remove_runner_spec.rb @@ -7,7 +7,7 @@ module QA let(:api_client) { Runtime::API::Client.new(:gitlab) } let(:executor) { "qa-runner-#{Time.now.to_i}" } - let(:runner_tags) { ['runner-registration-e2e-test'] } + let(:runner_tags) { ["runner-registration-e2e-test-#{Faker::Alphanumeric.alphanumeric(number: 8)}"] } let!(:runner) do Resource::Runner.fabricate! do |runner| runner.name = executor @@ -20,16 +20,18 @@ module QA end # Removing a runner via the UI is covered by `spec/features/runners_spec.rb`` - it 'removes the runner', quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/355302', type: :investigating }, testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/354828' do - expect(runner.project.runners.size).to eq(1) - expect(runner.project.runners.first[:description]).to eq(executor) + it 'removes the runner' do + runners = runner.list_of_runners(tag_list: runner_tags) - request = Runtime::API::Request.new(api_client, "runners/#{runner.project.runners.first[:id]}") + expect(runners.size).to eq(1) + expect(runners.first[:description]).to eq(executor) + + request = Runtime::API::Request.new(api_client, "runners/#{runners.first[:id]}") response = delete(request.url) expect(response.code).to eq(Support::API::HTTP_STATUS_NO_CONTENT) expect(response.body).to be_empty - expect(runner.project.runners).to be_empty + expect(runner.list_of_runners(tag_list: runner_tags)).to be_empty end end end diff --git a/qa/qa/specs/features/browser_ui/3_create/web_ide/open_fork_in_web_ide_spec.rb b/qa/qa/specs/features/browser_ui/3_create/web_ide/open_fork_in_web_ide_spec.rb index 653c0657c81..e9871a70560 100644 --- a/qa/qa/specs/features/browser_ui/3_create/web_ide/open_fork_in_web_ide_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/web_ide/open_fork_in_web_ide_spec.rb @@ -2,10 +2,13 @@ module QA RSpec.describe 'Create' do - describe 'Open a fork in Web IDE', quarantine: { + describe 'Open a fork in Web IDE', + # TODO: remove limitation to only run on main when the test is fixed + only: { pipeline: :main }, + quarantine: { issue: "https://gitlab.com/gitlab-org/gitlab/-/issues/351696", type: :flaky - } do + } do let(:parent_project) do Resource::Project.fabricate_via_api! do |project| project.name = 'parent-project' |