diff options
Diffstat (limited to 'qa/qa/specs/features')
52 files changed, 904 insertions, 116 deletions
diff --git a/qa/qa/specs/features/api/1_manage/import_github_repo_spec.rb b/qa/qa/specs/features/api/1_manage/import_github_repo_spec.rb index c39db63f64d..79bba484bea 100644 --- a/qa/qa/specs/features/api/1_manage/import_github_repo_spec.rb +++ b/qa/qa/specs/features/api/1_manage/import_github_repo_spec.rb @@ -1,7 +1,9 @@ # frozen_string_literal: true module QA - RSpec.describe 'Manage', :github, :requires_admin, :reliable do + # Spec uses real github.com, which means outage of github.com can actually block deployment + # Keep spec in reliable bucket but don't run in blocking pipelines + RSpec.describe 'Manage', :github, :reliable, :skip_live_env, :requires_admin do describe 'Project import', issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/353583' do let!(:api_client) { Runtime::API::Client.as_admin } let!(:group) { Resource::Group.fabricate_via_api! { |resource| resource.api_client = api_client } } diff --git a/qa/qa/specs/features/api/1_manage/import_large_github_repo_spec.rb b/qa/qa/specs/features/api/1_manage/import_large_github_repo_spec.rb index 84eda023576..6585d08d2ac 100644 --- a/qa/qa/specs/features/api/1_manage/import_large_github_repo_spec.rb +++ b/qa/qa/specs/features/api/1_manage/import_large_github_repo_spec.rb @@ -21,11 +21,11 @@ module QA end end - let(:github_repo) { ENV['QA_LARGE_GH_IMPORT_REPO'] || 'rspec/rspec-core' } - let(:import_max_duration) { ENV['QA_LARGE_GH_IMPORT_DURATION'] ? ENV['QA_LARGE_GH_IMPORT_DURATION'].to_i : 7200 } + let(:github_repo) { ENV['QA_LARGE_IMPORT_REPO'] || 'rspec/rspec-core' } + let(:import_max_duration) { ENV['QA_LARGE_IMPORT_DURATION'] ? ENV['QA_LARGE_IMPORT_DURATION'].to_i : 7200 } let(:github_client) do Octokit::Client.new( - access_token: ENV['QA_LARGE_GH_IMPORT_GH_TOKEN'] || Runtime::Env.github_access_token, + access_token: ENV['QA_LARGE_IMPORT_GH_TOKEN'] || Runtime::Env.github_access_token, auto_paginate: true ) end @@ -106,37 +106,47 @@ module QA end end + # rubocop:disable RSpec/InstanceVariable after do |example| user.remove_via_api! unless example.exception next unless defined?(@import_time) - # save data for comparison after run finished + # save data for comparison notification creation save_json( "data", { + importer: :github, import_time: @import_time, reported_stats: @stats, - github: { + source: { + name: "GitHub", project_name: github_repo, - branches: gh_branches.length, - commits: gh_commits.length, - labels: gh_labels.length, - milestones: gh_milestones.length, - prs: gh_prs.length, - pr_comments: gh_prs.sum { |_k, v| v[:comments].length }, - issues: gh_issues.length, - issue_comments: gh_issues.sum { |_k, v| v[:comments].length } + address: "https://github.com", + data: { + branches: gh_branches.length, + commits: gh_commits.length, + labels: gh_labels.length, + milestones: gh_milestones.length, + mrs: gh_prs.length, + mr_comments: gh_prs.sum { |_k, v| v[:comments].length }, + issues: gh_issues.length, + issue_comments: gh_issues.sum { |_k, v| v[:comments].length } + } }, - gitlab: { + target: { + name: "GitLab", project_name: imported_project.path_with_namespace, - branches: gl_branches.length, - commits: gl_commits.length, - labels: gl_labels.length, - milestones: gl_milestones.length, - mrs: mrs.length, - mr_comments: mrs.sum { |_k, v| v[:comments].length }, - issues: gl_issues.length, - issue_comments: gl_issues.sum { |_k, v| v[:comments].length } + address: QA::Runtime::Scenario.gitlab_address, + data: { + branches: gl_branches.length, + commits: gl_commits.length, + labels: gl_labels.length, + milestones: gl_milestones.length, + mrs: mrs.length, + mr_comments: mrs.sum { |_k, v| v[:comments].length }, + issues: gl_issues.length, + issue_comments: gl_issues.sum { |_k, v| v[:comments].length } + } }, not_imported: { mrs: @mr_diff, @@ -145,6 +155,7 @@ module QA } ) end + # rubocop:enable RSpec/InstanceVariable it( 'imports large Github repo via api', @@ -153,7 +164,7 @@ module QA start = Time.now # import the project and log gitlab path - Runtime::Logger.info("== Importing project '#{github_repo}' in to '#{imported_project.reload!.full_path}' ==") + logger.info("== Importing project '#{github_repo}' in to '#{imported_project.reload!.full_path}' ==") # fetch all objects right after import has started fetch_github_objects diff --git a/qa/qa/specs/features/api/1_manage/migration/gitlab_migration_large_project_spec.rb b/qa/qa/specs/features/api/1_manage/migration/gitlab_migration_large_project_spec.rb new file mode 100644 index 00000000000..edb7838e81d --- /dev/null +++ b/qa/qa/specs/features/api/1_manage/migration/gitlab_migration_large_project_spec.rb @@ -0,0 +1,412 @@ +# frozen_string_literal: true + +# rubocop:disable Rails/Pluck, Layout/LineLength, RSpec/MultipleMemoizedHelpers +module QA + RSpec.describe "Manage", requires_admin: 'uses admin API client for resource creation', + feature_flag: { name: 'bulk_import_projects', scope: :global }, + only: { job: 'large-gitlab-import' } do + describe "Gitlab migration" do + let(:logger) { Runtime::Logger.logger } + let(:differ) { RSpec::Support::Differ.new(color: true) } + let(:gitlab_group) { ENV['QA_LARGE_IMPORT_GROUP'] || 'gitlab-migration' } + let(:gitlab_project) { ENV['QA_LARGE_IMPORT_REPO'] || 'dri' } + let(:gitlab_source_address) { 'https://staging.gitlab.com' } + + let(:import_wait_duration) do + { + max_duration: (ENV['QA_LARGE_IMPORT_DURATION'] || 3600).to_i, + sleep_interval: 30 + } + end + + let(:admin_api_client) { Runtime::API::Client.as_admin } + + # explicitly create PAT via api to not create it via UI in environments where admin token env var is not present + let(:target_api_client) do + Runtime::API::Client.new( + user: user, + personal_access_token: Resource::PersonalAccessToken.fabricate_via_api! do |pat| + pat.api_client = admin_api_client + end.token + ) + end + + let(:user) do + Resource::User.fabricate_via_api! do |usr| + usr.api_client = admin_api_client + end + end + + let(:source_api_client) do + Runtime::API::Client.new( + gitlab_source_address, + personal_access_token: ENV["QA_LARGE_IMPORT_GL_TOKEN"], + is_new_session: false + ) + end + + let(:sandbox) do + Resource::Sandbox.fabricate_via_api! do |group| + group.api_client = admin_api_client + end + end + + let(:destination_group) do + Resource::Group.fabricate_via_api! do |group| + group.api_client = admin_api_client + group.sandbox = sandbox + group.path = "imported-group-destination-#{SecureRandom.hex(4)}" + end + end + + # Source group and it's objects + # + let(:source_group) do + Resource::Sandbox.fabricate_via_api! do |group| + group.api_client = source_api_client + group.path = gitlab_group + end + end + + let(:source_project) { source_group.projects.find { |project| project.name.include?(gitlab_project) }.reload! } + let(:source_branches) { source_project.repository_branches(auto_paginate: true).map { |b| b[:name] } } + let(:source_commits) { source_project.commits(auto_paginate: true).map { |c| c[:id] } } + let(:source_labels) { source_project.labels(auto_paginate: true).map { |l| l.except(:id) } } + let(:source_milestones) { source_project.milestones(auto_paginate: true).map { |ms| ms.except(:id, :web_url, :project_id) } } + let(:source_pipelines) { source_project.pipelines.map { |pp| pp.except(:id, :web_url, :project_id) } } + let(:source_mrs) { fetch_mrs(source_project, source_api_client) } + let(:source_issues) { fetch_issues(source_project, source_api_client) } + + # Imported group and it's objects + # + let(:imported_group) do + Resource::BulkImportGroup.fabricate_via_api! do |group| + group.import_access_token = source_api_client.personal_access_token # token for importing on source instance + group.api_client = target_api_client # token used by qa framework to access resources in destination instance + group.gitlab_address = gitlab_source_address + group.source_group = source_group + group.sandbox = destination_group + end + end + + let(:imported_project) { imported_group.projects.find { |project| project.name.include?(gitlab_project) }.reload! } + let(:branches) { imported_project.repository_branches(auto_paginate: true).map { |b| b[:name] } } + let(:commits) { imported_project.commits(auto_paginate: true).map { |c| c[:id] } } + let(:labels) { imported_project.labels(auto_paginate: true).map { |l| l.except(:id) } } + let(:milestones) { imported_project.milestones(auto_paginate: true).map { |ms| ms.except(:id, :web_url, :project_id) } } + let(:pipelines) { imported_project.pipelines.map { |pp| pp.except(:id, :web_url, :project_id) } } + let(:mrs) { fetch_mrs(imported_project, target_api_client) } + let(:issues) { fetch_issues(imported_project, target_api_client) } + + before do + Runtime::Feature.enable(:bulk_import_projects) + + destination_group.add_member(user, Resource::Members::AccessLevel::MAINTAINER) + end + + # rubocop:disable RSpec/InstanceVariable + after do |example| + next unless defined?(@import_time) + + # save data for comparison notification creation + save_json( + "data", + { + importer: :gitlab, + import_time: @import_time, + source: { + name: "GitLab Source", + project_name: source_project.path_with_namespace, + address: gitlab_source_address, + data: { + branches: source_branches.length, + commits: source_commits.length, + labels: source_labels.length, + milestones: source_milestones.length, + pipelines: source_pipelines.length, + mrs: source_mrs.length, + mr_comments: source_mrs.sum { |_k, v| v[:comments].length }, + issues: source_issues.length, + issue_comments: source_issues.sum { |_k, v| v[:comments].length } + } + }, + target: { + name: "GitLab Target", + project_name: imported_project.path_with_namespace, + address: QA::Runtime::Scenario.gitlab_address, + data: { + branches: branches.length, + commits: commits.length, + labels: labels.length, + milestones: milestones.length, + pipelines: pipelines.length, + mrs: mrs.length, + mr_comments: mrs.sum { |_k, v| v[:comments].length }, + issues: issues.length, + issue_comments: issues.sum { |_k, v| v[:comments].length } + } + }, + not_imported: { + mrs: @mr_diff, + issues: @issue_diff + } + } + ) + end + # rubocop:enable RSpec/InstanceVariable + + it "migrates large gitlab group via api", testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/358842' do + start = Time.now + + # trigger import and log imported group path + logger.info("== Importing group '#{gitlab_group}' in to '#{imported_group.full_path}' ==") + + # fetch all objects right after import has started + fetch_source_gitlab_objects + + # wait for import to finish and save import time + logger.info("== Waiting for import to be finished ==") + expect { imported_group.import_status }.to eventually_eq('finished').within(import_wait_duration) + @import_time = Time.now - start + + aggregate_failures do + verify_repository_import + verify_labels_import + verify_milestones_import + verify_pipelines_import + verify_merge_requests_import + verify_issues_import + end + end + + # Fetch source project objects for comparison + # + # @return [void] + def fetch_source_gitlab_objects + logger.info("== Fetching source group objects ==") + + source_branches + source_commits + source_labels + source_milestones + source_pipelines + source_mrs + source_issues + end + + # Verify repository imported correctly + # + # @return [void] + def verify_repository_import + logger.info("== Verifying repository import ==") + expect(imported_project.description).to eq(source_project.description) + expect(branches).to match_array(source_branches) + expect(commits).to match_array(source_commits) + end + + # Verify imported labels + # + # @return [void] + def verify_labels_import + logger.info("== Verifying label import ==") + expect(labels).to include(*source_labels) + end + + # Verify milestones import + # + # @return [void] + def verify_milestones_import + logger.info("== Verifying milestones import ==") + expect(milestones).to match_array(source_milestones) + end + + # Verify pipelines import + # + # @return [void] + def verify_pipelines_import + logger.info("== Verifying pipelines import ==") + expect(pipelines).to match_array(source_pipelines) + end + + # Verify imported merge requests and mr issues + # + # @return [void] + def verify_merge_requests_import + logger.info("== Verifying merge request import ==") + @mr_diff = verify_mrs_or_issues('mr') + end + + # Verify imported issues and issue comments + # + # @return [void] + def verify_issues_import + logger.info("== Verifying issue import ==") + @issue_diff = verify_mrs_or_issues('issue') + end + + # Verify imported mrs or issues and return missing items + # + # @param [String] type verification object, 'mr' or 'issue' + # @return [Hash] + def verify_mrs_or_issues(type) + # Compare length to have easy to read overview how many objects are missing + # + expected = type == 'mr' ? source_mrs : source_issues + actual = type == 'mr' ? mrs : issues + count_msg = "Expected to contain same amount of #{type}s. Source: #{expected.length}, Target: #{actual.length}" + expect(actual.length).to eq(expected.length), count_msg + + missing_comments = verify_comments(type, actual, expected) + + { + "#{type}s": (expected.keys - actual.keys).map { |it| actual[it].slice(:title, :url) }, + "#{type}_comments": missing_comments + } + end + + # Verify imported comments + # + # @param [String] type verification object, 'mrs' or 'issues' + # @param [Hash] actual + # @param [Hash] expected + # @return [Hash] + def verify_comments(type, actual, expected) + actual.each_with_object([]) do |(key, actual_item), missing_comments| + expected_item = expected[key] + title = actual_item[:title] + msg = "expected #{type} with title '#{title}' to have" + + # Print title in the error message to see which object is missing + # + expect(actual_item).to be_truthy, "#{msg} been imported" + next unless expected_item + + # Print difference in the description + # + expected_body = expected_item[:body] + actual_body = actual_item[:body] + body_msg = "#{msg} same description. diff:\n#{differ.diff(expected_body, actual_body)}" + expect(actual_body).to eq(expected_body), body_msg + + # Print difference in state + # + expected_state = expected_item[:state] + actual_state = actual_item[:state] + state_msg = "#{msg} same state. Source: #{expected_state}, Target: #{actual_state}" + expect(actual_state).to eq(expected_state), state_msg + + # Print amount difference first + # + expected_comments = expected_item[:comments] + actual_comments = actual_item[:comments] + comment_count_msg = <<~MSG + #{msg} same amount of comments. Source: #{expected_comments.length}, Target: #{actual_comments.length} + MSG + expect(actual_comments.length).to eq(expected_comments.length), comment_count_msg + expect(actual_comments).to match_array(expected_comments) + + # Save missing comments + # + comment_diff = expected_comments - actual_comments + next if comment_diff.empty? + + missing_comments << { + title: title, + target_url: actual_item[:url], + source_url: expected_item[:url], + missing_comments: comment_diff + } + end + end + + private + + # Project merge requests with comments + # + # @param [QA::Resource::Project] + # @param [Runtime::API::Client] client + # @return [Hash] + def fetch_mrs(project, client) + imported_mrs = project.merge_requests(auto_paginate: true, attempts: 2) + + Parallel.map(imported_mrs, in_threads: 4) do |mr| + resource = Resource::MergeRequest.init do |resource| + resource.project = project + resource.iid = mr[:iid] + resource.api_client = client + end + + [mr[:iid], { + url: mr[:web_url], + title: mr[:title], + body: sanitize_description(mr[:description]) || '', + state: mr[:state], + comments: resource + .comments(auto_paginate: true, attempts: 2) + .map { |c| sanitize_comment(c[:body]) } + }] + end.to_h + end + + # Project issues with comments + # + # @param [QA::Resource::Project] + # @param [Runtime::API::Client] client + # @return [Hash] + def fetch_issues(project, client) + imported_issues = project.issues(auto_paginate: true, attempts: 2) + + Parallel.map(imported_issues, in_threads: 4) do |issue| + resource = Resource::Issue.init do |issue_resource| + issue_resource.project = project + issue_resource.iid = issue[:iid] + issue_resource.api_client = client + end + + [issue[:iid], { + url: issue[:web_url], + title: issue[:title], + state: issue[:state], + body: sanitize_description(issue[:description]) || '', + comments: resource + .comments(auto_paginate: true, attempts: 2) + .map { |c| sanitize_comment(c[:body]) } + }] + end.to_h + end + + # Importer user mention pattern + # + # @return [Regex] + def created_by_pattern + @created_by_pattern ||= /\n\n \*By gitlab-migration on \S+ \(imported from GitLab\)\*/ + end + + # Remove added prefixes and legacy diff format from comments + # + # @param [String] body + # @return [String] + def sanitize_comment(body) + body&.gsub(created_by_pattern, "") + end + + # Remove created by prefix from descripion + # + # @param [String] body + # @return [String] + def sanitize_description(body) + body&.gsub(created_by_pattern, "") + end + + # Save json as file + # + # @param [String] name + # @param [Hash] json + # @return [void] + def save_json(name, json) + File.open("tmp/#{name}.json", "w") { |file| file.write(JSON.pretty_generate(json)) } + end + end + end +end +# rubocop:enable Rails/Pluck, Layout/LineLength, RSpec/MultipleMemoizedHelpers diff --git a/qa/qa/specs/features/api/1_manage/migration/gitlab_project_migration_common.rb b/qa/qa/specs/features/api/1_manage/migration/gitlab_project_migration_common.rb index 70f19e9f3d7..5a9cef6fded 100644 --- a/qa/qa/specs/features/api/1_manage/migration/gitlab_project_migration_common.rb +++ b/qa/qa/specs/features/api/1_manage/migration/gitlab_project_migration_common.rb @@ -3,7 +3,11 @@ module QA # Disable on live envs until bulk_import_projects toggle is on by default # Otherwise tests running in parallel can disable feature in the middle of other test - RSpec.shared_context 'with gitlab project migration', :requires_admin, :skip_live_env do + RSpec.shared_context 'with gitlab project migration', requires_admin: 'creates a user via API', + feature_flag: { + name: 'bulk_import_projects', + scope: :global + } do let(:source_project_with_readme) { false } let(:import_wait_duration) { { max_duration: 300, sleep_interval: 2 } } let(:admin_api_client) { Runtime::API::Client.as_admin } diff --git a/qa/qa/specs/features/api/3_create/gitaly/changing_repository_storage_spec.rb b/qa/qa/specs/features/api/3_create/gitaly/changing_repository_storage_spec.rb index 624ddbb68e1..cd1b7730fa9 100644 --- a/qa/qa/specs/features/api/3_create/gitaly/changing_repository_storage_spec.rb +++ b/qa/qa/specs/features/api/3_create/gitaly/changing_repository_storage_spec.rb @@ -2,7 +2,7 @@ module QA RSpec.describe 'Create' do - describe 'Changing Gitaly repository storage', :requires_admin do + describe 'Changing Gitaly repository storage', :requires_admin, except: { job: 'review-qa-*' } do praefect_manager = Service::PraefectManager.new shared_examples 'repository storage move' do @@ -11,12 +11,16 @@ module QA expect { project.change_repository_storage(destination_storage[:name]) }.not_to raise_error expect { praefect_manager.verify_storage_move(source_storage, destination_storage, repo_type: :project) }.not_to raise_error - Resource::Repository::ProjectPush.fabricate! do |push| - push.project = project - push.file_name = 'new_file' - push.file_content = '# This is a new file' - push.commit_message = 'Add new file' - push.new_branch = false + Support::Retrier.retry_on_exception(sleep_interval: 5) do + # For a short period of time after migrating, the repository can be 'read only' which may lead to errors + # 'The repository is temporarily read-only. Please try again later.' + Resource::Repository::Commit.fabricate_via_api! do |commit| + commit.project = project + commit.commit_message = 'Add new file' + commit.add_files([ + { file_path: 'new_file', content: '# This is a new file' } + ]) + end end expect(project).to have_file('README.md') @@ -45,7 +49,7 @@ module QA # Note: This test doesn't have the :orchestrated tag because it runs in the Test::Integration::Praefect # scenario with other tests that aren't considered orchestrated. # It also runs on staging using nfs-file07 as non-cluster storage and nfs-file22 as cluster/praefect storage - context 'when moving from Gitaly to Gitaly Cluster', :requires_praefect, testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347828', quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/284645', type: :investigating } do + context 'when moving from Gitaly to Gitaly Cluster', :requires_praefect, testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347828' do let(:source_storage) { { type: :gitaly, name: QA::Runtime::Env.non_cluster_repository_storage } } let(:destination_storage) { { type: :praefect, name: QA::Runtime::Env.praefect_repository_storage } } let(:project) do diff --git a/qa/qa/specs/features/api/3_create/integrations/webhook_events_spec.rb b/qa/qa/specs/features/api/3_create/integrations/webhook_events_spec.rb index 7a277d754c9..aae0329003b 100644 --- a/qa/qa/specs/features/api/3_create/integrations/webhook_events_spec.rb +++ b/qa/qa/specs/features/api/3_create/integrations/webhook_events_spec.rb @@ -70,7 +70,7 @@ module QA end end - it 'sends an issues and note event', 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/349723' do + it 'sends an issues and note event', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/349723' do setup_webhook(issues: true, note: true) do |webhook, smocker| issue = Resource::Issue.fabricate_via_api! do |issue_init| issue_init.project = webhook.project diff --git a/qa/qa/specs/features/api/3_create/repository/commit_to_templated_project_spec.rb b/qa/qa/specs/features/api/3_create/repository/commit_to_templated_project_spec.rb new file mode 100644 index 00000000000..c06912e0367 --- /dev/null +++ b/qa/qa/specs/features/api/3_create/repository/commit_to_templated_project_spec.rb @@ -0,0 +1,38 @@ +# frozen_string_literal: true + +module QA + RSpec.describe 'Create' do + describe 'Create a new project from a template' do + let(:project) do + Resource::Project.fabricate_via_api! do |project| + project.name = 'templated-project' + project.template_name = 'dotnetcore' + end + end + + it 'commits via the api', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/357234' do + expect do + Resource::Repository::Commit.fabricate_via_api! do |commit| + commit.project = project + commit.update_files( + [ + { + file_path: '.gitlab-ci.yml', + content: 'script' + } + ] + ) + commit.add_files( + [ + { + file_path: 'foo', + content: 'bar' + } + ] + ) + end + end.not_to raise_exception + end + end + end +end 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 0d10783735b..6e6198328e5 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 @@ -15,21 +15,19 @@ module QA end end - before do - sleep 5 # Runner should register within 5 seconds - 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 } do - expect(runner.project.runners.size).to eq(1) - expect(runner.project.runners.first[:description]).to eq(executor) + it 'removes the runner', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/354828' do + runners = nil + expect { (runners = runner.list_of_runners(tag_list: runner_tags)).size } + .to eventually_eq(1).within(max_duration: 10, sleep_interval: 1) + expect(runners.first[:description]).to eq(executor) - request = Runtime::API::Request.new(api_client, "runners/#{runner.project.runners.first[:id]}") + 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/1_manage/login/log_into_mattermost_via_gitlab_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/login/log_into_mattermost_via_gitlab_spec.rb index 6bfb9c96fbd..80e660c1c1d 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/login/log_into_mattermost_via_gitlab_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/login/log_into_mattermost_via_gitlab_spec.rb @@ -11,7 +11,7 @@ module QA Page::Mattermost::Login.perform(&:sign_in_using_oauth) Page::Mattermost::Main.perform do |mattermost| - expect(mattermost).to have_content(/(Welcome to: Mattermost|Logout GitLab Mattermost)/) + expect(mattermost).to have_content(/(GitLab Mattermost|What’s the name of your organization)/) end end end diff --git a/qa/qa/specs/features/browser_ui/1_manage/project/create_project_badge_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/project/create_project_badge_spec.rb index 2933d580957..3921595204c 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/project/create_project_badge_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/project/create_project_badge_spec.rb @@ -2,7 +2,7 @@ module QA RSpec.describe 'Manage' do - describe 'Create project badge' do + describe 'Create project badge', :reliable do let(:badge_name) { "project-badge-#{SecureRandom.hex(8)}" } let(:expected_badge_link_url) { "#{Runtime::Scenario.gitlab_address}/#{project.path_with_namespace}" } let(:expected_badge_image_url) { "#{Runtime::Scenario.gitlab_address}/#{project.path_with_namespace}/badges/main/pipeline.svg" } diff --git a/qa/qa/specs/features/browser_ui/1_manage/project/import_github_repo_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/project/import_github_repo_spec.rb index d803f5e473c..3bf5a11b074 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/project/import_github_repo_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/project/import_github_repo_spec.rb @@ -1,7 +1,9 @@ # frozen_string_literal: true module QA - RSpec.describe 'Manage', :reliable, :github, :requires_admin do + # Spec uses real github.com, which means outage of github can actually block deployment + # Keep spec in reliable bucket but don't run in blocking pipelines + RSpec.describe 'Manage', :github, :reliable, :skip_live_env, :requires_admin do describe 'Project import' do let(:github_repo) { 'gitlab-qa-github/import-test' } let(:api_client) { Runtime::API::Client.as_admin } diff --git a/qa/qa/specs/features/browser_ui/1_manage/project/personal_project_permissions_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/project/personal_project_permissions_spec.rb index 2aefa1c39ed..5d0befea1ce 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/project/personal_project_permissions_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/project/personal_project_permissions_spec.rb @@ -2,7 +2,7 @@ module QA RSpec.describe 'Manage' do - describe 'Personal project permissions' do + describe 'Personal project permissions', :reliable do let!(:owner) { Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_1, Runtime::Env.gitlab_qa_password_1) } let!(:owner_api_client) { Runtime::API::Client.new(:gitlab, user: owner) } diff --git a/qa/qa/specs/features/browser_ui/2_plan/issue/mentions_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/issue/mentions_spec.rb index e7025920def..96f5731ea65 100644 --- a/qa/qa/specs/features/browser_ui/2_plan/issue/mentions_spec.rb +++ b/qa/qa/specs/features/browser_ui/2_plan/issue/mentions_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - RSpec.describe 'Plan', :smoke, :reliable do + RSpec.describe 'Plan', :smoke do describe 'mention' do let(:user) { Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_1, Runtime::Env.gitlab_qa_password_1) } let(:project) do diff --git a/qa/qa/specs/features/browser_ui/3_create/jenkins/jenkins_build_status_spec.rb b/qa/qa/specs/features/browser_ui/3_create/jenkins/jenkins_build_status_spec.rb index e5a6c57656e..ea531d84634 100644 --- a/qa/qa/specs/features/browser_ui/3_create/jenkins/jenkins_build_status_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/jenkins/jenkins_build_status_spec.rb @@ -30,7 +30,7 @@ module QA setup_project_integration_with_jenkins - expect(page).to have_text("Jenkins CI activated.") + expect(page).to have_text("Jenkins settings saved and active.") QA::Support::Retrier.retry_on_exception do Resource::Repository::ProjectPush.fabricate! do |push| diff --git a/qa/qa/specs/features/browser_ui/3_create/merge_request/create_merge_request_via_template_spec.rb b/qa/qa/specs/features/browser_ui/3_create/merge_request/create_merge_request_via_template_spec.rb index c4aacd8fb06..3373f4f4233 100644 --- a/qa/qa/specs/features/browser_ui/3_create/merge_request/create_merge_request_via_template_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/merge_request/create_merge_request_via_template_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - RSpec.describe 'Create' do + RSpec.describe 'Create', :reliable do describe 'Merge request custom templates' do let(:template_name) { 'custom_merge_request_template'} let(:template_content) { 'This is a custom merge request template test' } diff --git a/qa/qa/specs/features/browser_ui/3_create/merge_request/merge_merge_request_from_fork_spec.rb b/qa/qa/specs/features/browser_ui/3_create/merge_request/merge_merge_request_from_fork_spec.rb index b0c6d01e8ca..d1e852979d0 100644 --- a/qa/qa/specs/features/browser_ui/3_create/merge_request/merge_merge_request_from_fork_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/merge_request/merge_merge_request_from_fork_spec.rb @@ -3,7 +3,7 @@ module QA RSpec.describe 'Create' do describe 'Merge request creation from fork', quarantine: { - only: { subdomain: %i[canary production] }, + only: :production, issue: "https://gitlab.com/gitlab-org/gitlab/-/issues/343801", type: :investigation } do diff --git a/qa/qa/specs/features/browser_ui/3_create/merge_request/revert/revert_commit_spec.rb b/qa/qa/specs/features/browser_ui/3_create/merge_request/revert/revert_commit_spec.rb index a2b27e294e6..8885163b5e3 100644 --- a/qa/qa/specs/features/browser_ui/3_create/merge_request/revert/revert_commit_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/merge_request/revert/revert_commit_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - RSpec.describe 'Create' do + RSpec.describe 'Create', :reliable do describe 'Reverting a commit' do let(:file_name) { "secret_file.md" } diff --git a/qa/qa/specs/features/browser_ui/3_create/merge_request/revert/reverting_merge_request_spec.rb b/qa/qa/specs/features/browser_ui/3_create/merge_request/revert/reverting_merge_request_spec.rb index 90ca836f8b0..d66895de9c1 100644 --- a/qa/qa/specs/features/browser_ui/3_create/merge_request/revert/reverting_merge_request_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/merge_request/revert/reverting_merge_request_spec.rb @@ -19,7 +19,7 @@ module QA Flow::Login.sign_in end - it 'can be reverted', :can_use_large_setup, testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347709', quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/335987', type: :investigating } do + it 'can be reverted', :can_use_large_setup, testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347709' do revertable_merge_request.visit! Page::MergeRequest::Show.perform do |merge_request| diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/file/create_file_via_web_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/file/create_file_via_web_spec.rb index f335cfdb367..095444d99f1 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/file/create_file_via_web_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/file/create_file_via_web_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - RSpec.describe 'Create' do + RSpec.describe 'Create', :reliable do context 'File management' do file_name = 'QA Test - File name' file_content = 'QA Test - File content' diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/file/edit_file_via_web_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/file/edit_file_via_web_spec.rb index 25c095d9eda..95e7a2a12d0 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/file/edit_file_via_web_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/file/edit_file_via_web_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - RSpec.describe 'Create' do + RSpec.describe 'Create', :reliable do context 'File management' do let(:file) { Resource::File.fabricate_via_api! } diff --git a/qa/qa/specs/features/browser_ui/3_create/snippet/create_personal_snippet_with_multiple_files_spec.rb b/qa/qa/specs/features/browser_ui/3_create/snippet/create_personal_snippet_with_multiple_files_spec.rb index ce99822b572..0560a5b125c 100644 --- a/qa/qa/specs/features/browser_ui/3_create/snippet/create_personal_snippet_with_multiple_files_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/snippet/create_personal_snippet_with_multiple_files_spec.rb @@ -2,7 +2,7 @@ module QA RSpec.describe 'Create' do - describe 'Multiple file snippet' do + describe 'Multiple file snippet', :reliable do let(:snippet) do Resource::Snippet.fabricate_via_browser_ui! do |snippet| snippet.title = 'Personal snippet with multiple files' diff --git a/qa/qa/specs/features/browser_ui/3_create/snippet/create_project_snippet_with_multiple_files_spec.rb b/qa/qa/specs/features/browser_ui/3_create/snippet/create_project_snippet_with_multiple_files_spec.rb index 70891ec72c7..77b3c4df7e1 100644 --- a/qa/qa/specs/features/browser_ui/3_create/snippet/create_project_snippet_with_multiple_files_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/snippet/create_project_snippet_with_multiple_files_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - RSpec.describe 'Create' do + RSpec.describe 'Create', :reliable do describe 'Multiple file snippet' do let(:snippet) do Resource::ProjectSnippet.fabricate_via_browser_ui! do |snippet| diff --git a/qa/qa/specs/features/browser_ui/3_create/snippet/delete_file_from_snippet_spec.rb b/qa/qa/specs/features/browser_ui/3_create/snippet/delete_file_from_snippet_spec.rb index b6092ef0c4c..e9339342386 100644 --- a/qa/qa/specs/features/browser_ui/3_create/snippet/delete_file_from_snippet_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/snippet/delete_file_from_snippet_spec.rb @@ -2,7 +2,7 @@ module QA RSpec.describe 'Create' do - describe 'Multiple file snippet' do + describe 'Multiple file snippet', :reliable do let(:personal_snippet) do Resource::Snippet.fabricate_via_api! do |snippet| snippet.title = 'Personal snippet to delete file from' diff --git a/qa/qa/specs/features/browser_ui/3_create/snippet/share_snippet_spec.rb b/qa/qa/specs/features/browser_ui/3_create/snippet/share_snippet_spec.rb index 6777c113f36..182a21a9377 100644 --- a/qa/qa/specs/features/browser_ui/3_create/snippet/share_snippet_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/snippet/share_snippet_spec.rb @@ -2,7 +2,7 @@ module QA RSpec.describe 'Create' do - describe 'Sharing snippets' do + describe 'Sharing snippets', :reliable do let(:snippet) do Resource::Snippet.fabricate! do |snippet| snippet.title = 'Shared snippet' 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' diff --git a/qa/qa/specs/features/browser_ui/4_verify/ci_variable/pipeline_with_protected_variable_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/ci_variable/pipeline_with_protected_variable_spec.rb index 7704111ea21..5bb60e64da5 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/ci_variable/pipeline_with_protected_variable_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/ci_variable/pipeline_with_protected_variable_spec.rb @@ -135,7 +135,7 @@ module QA def go_to_pipeline_job(user) Flow::Login.sign_in(as: user) project.visit! - Flow::Pipeline.visit_latest_pipeline(pipeline_condition: 'completed') + Flow::Pipeline.visit_latest_pipeline Page::Project::Pipeline::Show.perform do |pipeline| pipeline.click_job('job') diff --git a/qa/qa/specs/features/browser_ui/4_verify/ci_variable/ui_variable_inheritable_when_forward_pipeline_variables_true_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/ci_variable/ui_variable_inheritable_when_forward_pipeline_variables_true_spec.rb new file mode 100644 index 00000000000..496cc5f8a60 --- /dev/null +++ b/qa/qa/specs/features/browser_ui/4_verify/ci_variable/ui_variable_inheritable_when_forward_pipeline_variables_true_spec.rb @@ -0,0 +1,64 @@ +# frozen_string_literal: true + +module QA + # TODO: + # Remove FF :ci_trigger_forward_variables + # when https://gitlab.com/gitlab-org/gitlab/-/issues/355572 is closed + RSpec.describe 'Verify', :runner, feature_flag: { + name: 'ci_trigger_forward_variables', + scope: :global + } do + describe 'UI defined variable' do + include_context 'variable inheritance test prep' + + before do + add_ci_file(downstream1_project, [downstream1_ci_file]) + add_ci_file(upstream_project, [upstream_ci_file, upstream_child1_ci_file]) + + start_pipeline_with_variable + Page::Project::Pipeline::Show.perform do |show| + Support::Waiter.wait_until { show.passed? } + end + end + + it( + 'is inheritable when forward:pipeline_variables is true', + :aggregate_failures, + testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/358197' + ) do + visit_job_page('child1', 'child1_job') + verify_job_log_shows_variable_value + + page.go_back + + visit_job_page('downstream1', 'downstream1_job') + verify_job_log_shows_variable_value + end + + def upstream_ci_file + { + file_path: '.gitlab-ci.yml', + content: <<~YAML + stages: + - test + - deploy + + child1_trigger: + stage: test + trigger: + include: .child1-ci.yml + forward: + pipeline_variables: true + + downstream1_trigger: + stage: deploy + trigger: + project: #{downstream1_project.full_path} + forward: + pipeline_variables: true + YAML + } + end + end + end +end diff --git a/qa/qa/specs/features/browser_ui/4_verify/ci_variable/ui_variable_non_inheritable_when_forward_pipeline_variables_false_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/ci_variable/ui_variable_non_inheritable_when_forward_pipeline_variables_false_spec.rb new file mode 100644 index 00000000000..2a0aaf6d7a3 --- /dev/null +++ b/qa/qa/specs/features/browser_ui/4_verify/ci_variable/ui_variable_non_inheritable_when_forward_pipeline_variables_false_spec.rb @@ -0,0 +1,91 @@ +# frozen_string_literal: true + +module QA + # TODO: + # Remove FF :ci_trigger_forward_variables + # when https://gitlab.com/gitlab-org/gitlab/-/issues/355572 is closed + RSpec.describe 'Verify', :runner, feature_flag: { + name: 'ci_trigger_forward_variables', + scope: :global + } do + describe 'UI defined variable' do + include_context 'variable inheritance test prep' + + before do + add_ci_file(downstream1_project, [downstream1_ci_file]) + add_ci_file(downstream2_project, [downstream2_ci_file]) + add_ci_file(upstream_project, [upstream_ci_file, upstream_child1_ci_file, upstream_child2_ci_file]) + + start_pipeline_with_variable + Page::Project::Pipeline::Show.perform do |show| + Support::Waiter.wait_until { show.passed? } + end + end + + it( + 'is not inheritable when forward:pipeline_variables is false', + :aggregate_failures, + testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/358199' + ) do + visit_job_page('child1', 'child1_job') + verify_job_log_does_not_show_variable_value + + page.go_back + + visit_job_page('downstream1', 'downstream1_job') + verify_job_log_does_not_show_variable_value + end + + it( + 'is not inheritable by default', + :aggregate_failures, + testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/358200' + ) do + visit_job_page('child2', 'child2_job') + verify_job_log_does_not_show_variable_value + + page.go_back + + visit_job_page('downstream2', 'downstream2_job') + verify_job_log_does_not_show_variable_value + end + + def upstream_ci_file + { + file_path: '.gitlab-ci.yml', + content: <<~YAML + stages: + - test + - deploy + + child1_trigger: + stage: test + trigger: + include: .child1-ci.yml + forward: + pipeline_variables: false + + # default behavior + child2_trigger: + stage: test + trigger: + include: .child2-ci.yml + + downstream1_trigger: + stage: deploy + trigger: + project: #{downstream1_project.full_path} + forward: + pipeline_variables: false + + # default behavior + downstream2_trigger: + stage: deploy + trigger: + project: #{downstream2_project.full_path} + YAML + } + end + end + end +end diff --git a/qa/qa/specs/features/browser_ui/4_verify/pipeline/create_and_process_pipeline_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/pipeline/create_and_process_pipeline_spec.rb index bd3135bafdc..1bba5355790 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/pipeline/create_and_process_pipeline_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/create_and_process_pipeline_spec.rb @@ -1,7 +1,10 @@ # frozen_string_literal: true module QA - RSpec.describe 'Verify', :smoke, :runner do + RSpec.describe 'Verify', :smoke, :runner, quarantine: { + issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/356295', + type: :investigating + } do describe 'Pipeline creation and processing' do let(:executor) { "qa-runner-#{Time.now.to_i}" } @@ -58,6 +61,16 @@ module QA artifacts: paths: - my-artifacts/ + + test-coverage-report: + tags: + - #{executor} + script: mkdir coverage; echo "CONTENTS" > coverage/cobertura.xml + artifacts: + reports: + coverage_report: + coverage_format: cobertura + path: coverage/cobertura.xml YAML } ] @@ -71,7 +84,8 @@ module QA 'test-success': 'passed', 'test-failure': 'failed', 'test-tags-mismatch': 'pending', - 'test-artifacts': 'passed' + 'test-artifacts': 'passed', + 'test-coverage-report': 'passed' }.each do |job, status| Page::Project::Pipeline::Show.perform do |pipeline| pipeline.click_job(job) diff --git a/qa/qa/specs/features/browser_ui/4_verify/pipeline/include_multiple_files_from_a_project_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/pipeline/include_multiple_files_from_a_project_spec.rb index 9521cd20fc5..2fa6b9179ef 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/pipeline/include_multiple_files_from_a_project_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/include_multiple_files_from_a_project_spec.rb @@ -32,7 +32,7 @@ module QA add_included_files add_main_ci_file project.visit! - Flow::Pipeline.visit_latest_pipeline(pipeline_condition: 'succeeded') + Flow::Pipeline.visit_latest_pipeline(status: 'passed') end after do diff --git a/qa/qa/specs/features/browser_ui/4_verify/pipeline/locked_artifacts_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/pipeline/locked_artifacts_spec.rb index 9abb25c8dc1..3356d1274c8 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/pipeline/locked_artifacts_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/locked_artifacts_spec.rb @@ -56,7 +56,7 @@ module QA ) end.project.visit! - Flow::Pipeline.visit_latest_pipeline(pipeline_condition: 'completed') + Flow::Pipeline.visit_latest_pipeline Page::Project::Pipeline::Show.perform do |pipeline| pipeline.click_job('test-artifacts') diff --git a/qa/qa/specs/features/browser_ui/4_verify/pipeline/multi-project_pipelines_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/pipeline/multi-project_pipelines_spec.rb new file mode 100644 index 00000000000..0d8756fc9a3 --- /dev/null +++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/multi-project_pipelines_spec.rb @@ -0,0 +1,105 @@ +# frozen_string_literal: true + +module QA + RSpec.describe 'Verify' do + describe 'Multi-project pipelines' do + let(:downstream_job_name) { 'downstream_job' } + let(:executor) { "qa-runner-#{SecureRandom.hex(4)}" } + let!(:group) { Resource::Group.fabricate_via_api! } + + let(:upstream_project) do + Resource::Project.fabricate_via_api! do |project| + project.group = group + project.name = 'upstream-project' + end + end + + let(:downstream_project) do + Resource::Project.fabricate_via_api! do |project| + project.group = group + project.name = 'downstream-project' + end + end + + let!(:runner) do + Resource::Runner.fabricate_via_api! do |runner| + runner.token = group.reload!.runners_token + runner.name = executor + runner.tags = [executor] + end + end + + before do + add_ci_file(downstream_project, downstream_ci_file) + add_ci_file(upstream_project, upstream_ci_file) + + Flow::Login.sign_in + upstream_project.visit! + Flow::Pipeline.visit_latest_pipeline(status: 'passed') + end + + after do + runner.remove_via_api! + [upstream_project, downstream_project].each(&:remove_via_api!) + end + + it( + 'creates a multi-project pipeline', + testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/358064' + ) do + Page::Project::Pipeline::Show.perform do |show| + expect(show).to have_passed + expect(show).not_to have_job(downstream_job_name) + + show.expand_linked_pipeline + + expect(show).to have_job(downstream_job_name) + end + end + + private + + def add_ci_file(project, file) + Resource::Repository::Commit.fabricate_via_api! do |commit| + commit.project = project + commit.commit_message = 'Add CI config file' + commit.add_files([file]) + end + end + + def upstream_ci_file + { + file_path: '.gitlab-ci.yml', + content: <<~YAML + stages: + - test + - deploy + + job1: + stage: test + tags: ["#{executor}"] + script: echo 'done' + + staging: + stage: deploy + trigger: + project: #{downstream_project.path_with_namespace} + strategy: depend + YAML + } + end + + def downstream_ci_file + { + file_path: '.gitlab-ci.yml', + content: <<~YAML + "#{downstream_job_name}": + stage: test + tags: ["#{executor}"] + script: echo 'done' + YAML + } + end + end + end +end diff --git a/qa/qa/specs/features/browser_ui/6_release/pipeline/parent_child_pipelines_dependent_relationship_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/pipeline/parent_child_pipelines_dependent_relationship_spec.rb index e34f41b4c95..5b7a569fa8a 100644 --- a/qa/qa/specs/features/browser_ui/6_release/pipeline/parent_child_pipelines_dependent_relationship_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/parent_child_pipelines_dependent_relationship_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - RSpec.describe 'Release', :runner, :reliable do + RSpec.describe 'Verify', :runner, :reliable do describe 'Parent-child pipelines dependent relationship' do let!(:project) do Resource::Project.fabricate_via_api! do |project| @@ -25,23 +25,29 @@ module QA runner.remove_via_api! end - it 'parent pipelines passes if child passes', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/348092' do + it( + 'parent pipelines passes if child passes', + testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/358062' + ) do add_ci_files(success_child_ci_file) - Flow::Pipeline.visit_latest_pipeline(pipeline_condition: 'completed') + Flow::Pipeline.visit_latest_pipeline Page::Project::Pipeline::Show.perform do |parent_pipeline| expect(parent_pipeline).to have_child_pipeline - expect(parent_pipeline).to have_passed + expect { parent_pipeline.has_passed? }.to eventually_be_truthy end end - it 'parent pipeline fails if child fails', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/348091' do + it( + 'parent pipeline fails if child fails', + testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/358063' + ) do add_ci_files(fail_child_ci_file) - Flow::Pipeline.visit_latest_pipeline(pipeline_condition: 'completed') + Flow::Pipeline.visit_latest_pipeline Page::Project::Pipeline::Show.perform do |parent_pipeline| expect(parent_pipeline).to have_child_pipeline - expect(parent_pipeline).to have_failed + expect { parent_pipeline.has_failed? }.to eventually_be_truthy end end diff --git a/qa/qa/specs/features/browser_ui/6_release/pipeline/parent_child_pipelines_independent_relationship_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/pipeline/parent_child_pipelines_independent_relationship_spec.rb index ef0c8d35c37..9e3c29db9e7 100644 --- a/qa/qa/specs/features/browser_ui/6_release/pipeline/parent_child_pipelines_independent_relationship_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/parent_child_pipelines_independent_relationship_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - RSpec.describe 'Release', :runner, :reliable do + RSpec.describe 'Verify', :runner, :reliable do describe 'Parent-child pipelines independent relationship' do let!(:project) do Resource::Project.fabricate_via_api! do |project| @@ -25,23 +25,29 @@ module QA runner.remove_via_api! end - it 'parent pipelines passes if child passes', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/348093' do + it( + 'parent pipelines passes if child passes', + testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/358059' + ) do add_ci_files(success_child_ci_file) - Flow::Pipeline.visit_latest_pipeline(pipeline_condition: 'completed') + Flow::Pipeline.visit_latest_pipeline Page::Project::Pipeline::Show.perform do |parent_pipeline| expect(parent_pipeline).to have_child_pipeline - expect(parent_pipeline).to have_passed + expect { parent_pipeline.has_passed? }.to eventually_be_truthy end end - it 'parent pipeline passes even if child fails', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/348094' do + it( + 'parent pipeline passes even if child fails', + testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/358060' + ) do add_ci_files(fail_child_ci_file) - Flow::Pipeline.visit_latest_pipeline(pipeline_condition: 'completed') + Flow::Pipeline.visit_latest_pipeline Page::Project::Pipeline::Show.perform do |parent_pipeline| expect(parent_pipeline).to have_child_pipeline - expect(parent_pipeline).to have_passed + expect { parent_pipeline.has_passed? }.to eventually_be_truthy end end diff --git a/qa/qa/specs/features/browser_ui/4_verify/pipeline/pass_dotenv_variables_to_downstream_via_bridge_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/pipeline/pass_dotenv_variables_to_downstream_via_bridge_spec.rb index 0bc3fb7b829..bbcc71bade7 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/pipeline/pass_dotenv_variables_to_downstream_via_bridge_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/pass_dotenv_variables_to_downstream_via_bridge_spec.rb @@ -3,8 +3,8 @@ module QA RSpec.describe 'Verify', :runner do describe 'Pass dotenv variables to downstream via bridge' do - let(:executor) { "qa-runner-#{Faker::Alphanumeric.alphanumeric(8)}" } - let(:upstream_var) { Faker::Alphanumeric.alphanumeric(8) } + let(:executor) { "qa-runner-#{Faker::Alphanumeric.alphanumeric(number: 8)}" } + let(:upstream_var) { Faker::Alphanumeric.alphanumeric(number: 8) } let(:group) { Resource::Group.fabricate_via_api! } let(:upstream_project) do @@ -34,7 +34,7 @@ module QA add_ci_file(downstream_project, downstream_ci_file) add_ci_file(upstream_project, upstream_ci_file) upstream_project.visit! - Flow::Pipeline.visit_latest_pipeline(pipeline_condition: 'succeeded') + Flow::Pipeline.visit_latest_pipeline(status: 'passed') end after do @@ -44,8 +44,8 @@ module QA it 'runs the pipeline with composed config', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/348088' do Page::Project::Pipeline::Show.perform do |parent_pipeline| - Support::Waiter.wait_until { parent_pipeline.has_child_pipeline? } - parent_pipeline.expand_child_pipeline + Support::Waiter.wait_until { parent_pipeline.has_linked_pipeline? } + parent_pipeline.expand_linked_pipeline parent_pipeline.click_job('downstream_test') end @@ -73,7 +73,7 @@ module QA stage: build tags: ["#{executor}"] script: - - echo "DYNAMIC_ENVIRONMENT_VAR=#{upstream_var}" >> variables.env + - for i in `seq 1 20`; do echo "VAR_$i=#{upstream_var}" >> variables.env; done; artifacts: reports: dotenv: variables.env @@ -81,7 +81,7 @@ module QA trigger: stage: deploy variables: - PASSED_MY_VAR: $DYNAMIC_ENVIRONMENT_VAR + PASSED_MY_VAR: "$VAR_#{rand(1..20)}" trigger: #{downstream_project.full_path} YAML } diff --git a/qa/qa/specs/features/browser_ui/4_verify/pipeline/pipeline_editor_can_create_merge_request_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/pipeline/pipeline_editor_can_create_merge_request_spec.rb index 0e7a38626aa..b9f616aa733 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/pipeline/pipeline_editor_can_create_merge_request_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/pipeline_editor_can_create_merge_request_spec.rb @@ -22,7 +22,7 @@ module QA it( 'can create merge request', - test_case: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/349130' + testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/349130' ) do Page::Project::PipelineEditor::New.perform(&:create_new_ci) diff --git a/qa/qa/specs/features/browser_ui/4_verify/pipeline/run_pipeline_via_web_only_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/pipeline/run_pipeline_via_web_only_spec.rb index d1e9981ae74..f36593218a9 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/pipeline/run_pipeline_via_web_only_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/run_pipeline_via_web_only_spec.rb @@ -42,7 +42,7 @@ module QA it 'can trigger pipeline', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/348011' do Page::Project::Pipeline::Index.perform do |index| - expect(index).not_to have_pipeline # should not auto trigger pipeline + expect(index).to have_no_pipeline # should not auto trigger pipeline index.click_run_pipeline_button end diff --git a/qa/qa/specs/features/browser_ui/4_verify/pipeline/run_pipeline_with_manual_jobs_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/pipeline/run_pipeline_with_manual_jobs_spec.rb index 7a2c2b4ae90..fb7e3a8437f 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/pipeline/run_pipeline_with_manual_jobs_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/run_pipeline_with_manual_jobs_spec.rb @@ -1,11 +1,10 @@ # frozen_string_literal: true module QA - RSpec.describe 'Verify', :runner, quarantine: { - type: :flaky, - issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/351994' - } do + RSpec.describe 'Verify', :runner do describe 'Run pipeline with manual jobs' do + let(:executor) { "qa-runner-#{SecureRandom.hex(4)}" } + let(:project) do Resource::Project.fabricate_via_api! do |project| project.name = 'pipeline-with-manual-job' @@ -16,7 +15,8 @@ module QA let!(:runner) do Resource::Runner.fabricate! do |runner| runner.project = project - runner.name = "qa-runner-#{SecureRandom.hex(3)}" + runner.name = executor + runner.tags = [executor] end end @@ -36,22 +36,26 @@ module QA Prep: stage: Stage1 + tags: ["#{executor}"] script: exit 0 when: manual Build: stage: Stage2 + tags: ["#{executor}"] needs: ['Prep'] script: exit 0 parallel: 6 Test: stage: Stage3 + tags: ["#{executor}"] needs: ['Build'] script: exit 0 Deploy: stage: Stage3 + tags: ["#{executor}"] needs: ['Test'] script: exit 0 parallel: 6 @@ -65,15 +69,17 @@ module QA before do Flow::Login.sign_in project.visit! - Flow::Pipeline.visit_latest_pipeline(pipeline_condition: 'skipped') + Flow::Pipeline.visit_latest_pipeline(status: 'skipped') end after do runner&.remove_via_api! - project&.remove_via_api! end - it 'does not leave any job in skipped state', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/349158' do + it( + 'does not leave any job in skipped state', + testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/349158' + ) do Page::Project::Pipeline::Show.perform do |show| show.click_job_action('Prep') # Trigger pipeline manually diff --git a/qa/qa/specs/features/browser_ui/4_verify/pipeline/trigger_child_pipeline_with_manual_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/pipeline/trigger_child_pipeline_with_manual_spec.rb index ed46481d3be..1c75beebb48 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/pipeline/trigger_child_pipeline_with_manual_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/trigger_child_pipeline_with_manual_spec.rb @@ -23,7 +23,7 @@ module QA Flow::Login.sign_in add_ci_files project.visit! - Flow::Pipeline.visit_latest_pipeline(pipeline_condition: 'succeeded') + Flow::Pipeline.visit_latest_pipeline(status: 'passed') end after do diff --git a/qa/qa/specs/features/browser_ui/4_verify/pipeline/trigger_matrix_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/pipeline/trigger_matrix_spec.rb index 94ac857f0fe..205b4d1168a 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/pipeline/trigger_matrix_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/trigger_matrix_spec.rb @@ -23,7 +23,7 @@ module QA Flow::Login.sign_in add_ci_files project.visit! - Flow::Pipeline.visit_latest_pipeline(pipeline_condition: 'succeeded') + Flow::Pipeline.visit_latest_pipeline(status: 'passed') end after do diff --git a/qa/qa/specs/features/browser_ui/4_verify/runner/register_runner_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/runner/register_runner_spec.rb index 8aa01888ae3..f8261bba342 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/runner/register_runner_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/runner/register_runner_spec.rb @@ -22,8 +22,6 @@ module QA Page::Project::Menu.perform(&:go_to_ci_cd_settings) Page::Project::Settings::CiCd.perform do |settings| - sleep 5 # Runner should register within 5 seconds - settings.expand_runners_settings do |page| expect(page).to have_content(executor) expect(page).to have_online_runner diff --git a/qa/qa/specs/features/browser_ui/5_package/container_registry/container_registry_omnibus_spec.rb b/qa/qa/specs/features/browser_ui/5_package/container_registry/container_registry_omnibus_spec.rb index c833aa1a5b8..f570ad335fe 100644 --- a/qa/qa/specs/features/browser_ui/5_package/container_registry/container_registry_omnibus_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/container_registry/container_registry_omnibus_spec.rb @@ -3,6 +3,8 @@ module QA RSpec.describe 'Package', :orchestrated, :skip_live_env do describe 'Self-managed Container Registry' do + include Support::Helpers::MaskToken + let(:project) do Resource::Project.fabricate_via_api! do |project| project.name = 'project-with-registry' @@ -110,9 +112,9 @@ module QA let(:auth_token) do case authentication_token_type when :personal_access_token - "\"#{personal_access_token}\"" + use_ci_variable(name: 'PERSONAL_ACCESS_TOKEN', value: personal_access_token, project: project) when :project_deploy_token - "\"#{project_deploy_token.token}\"" + use_ci_variable(name: 'PROJECT_DEPLOY_TOKEN', value: project_deploy_token.token, project: project) when :ci_job_token '$CI_JOB_TOKEN' end diff --git a/qa/qa/specs/features/browser_ui/5_package/package_registry/composer_registry_spec.rb b/qa/qa/specs/features/browser_ui/5_package/package_registry/composer_registry_spec.rb index 2da0f6a0cf8..d5ef9dce10d 100644 --- a/qa/qa/specs/features/browser_ui/5_package/package_registry/composer_registry_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/package_registry/composer_registry_spec.rb @@ -8,6 +8,7 @@ module QA let(:project) do Resource::Project.fabricate_via_api! do |project| project.name = 'composer-package-project' + project.visibility = :private end end diff --git a/qa/qa/specs/features/browser_ui/5_package/package_registry/conan_repository_spec.rb b/qa/qa/specs/features/browser_ui/5_package/package_registry/conan_repository_spec.rb index 22495796605..1840ae4e7f8 100644 --- a/qa/qa/specs/features/browser_ui/5_package/package_registry/conan_repository_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/package_registry/conan_repository_spec.rb @@ -12,6 +12,7 @@ module QA let(:project) do Resource::Project.fabricate_via_api! do |project| project.name = 'conan-package-project' + project.visibility = :private end end diff --git a/qa/qa/specs/features/browser_ui/5_package/package_registry/generic_repository_spec.rb b/qa/qa/specs/features/browser_ui/5_package/package_registry/generic_repository_spec.rb index 71acc3a8f92..e37102c17f7 100644 --- a/qa/qa/specs/features/browser_ui/5_package/package_registry/generic_repository_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/package_registry/generic_repository_spec.rb @@ -8,6 +8,7 @@ module QA let(:project) do Resource::Project.fabricate_via_api! do |project| project.name = 'generic-package-project' + project.visibility = :private end end diff --git a/qa/qa/specs/features/browser_ui/5_package/package_registry/helm_registry_spec.rb b/qa/qa/specs/features/browser_ui/5_package/package_registry/helm_registry_spec.rb index d2e816f9bf9..078465770c6 100644 --- a/qa/qa/specs/features/browser_ui/5_package/package_registry/helm_registry_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/package_registry/helm_registry_spec.rb @@ -5,6 +5,7 @@ module QA describe 'Helm Registry' do using RSpec::Parameterized::TableSyntax include Runtime::Fixtures + include Support::Helpers::MaskToken include_context 'packages registry qa scenario' let(:package_name) { "gitlab_qa_helm-#{SecureRandom.hex(8)}" } @@ -32,11 +33,13 @@ module QA let(:access_token) do case authentication_token_type when :personal_access_token - personal_access_token + use_ci_variable(name: 'PERSONAL_ACCESS_TOKEN', value: personal_access_token, project: package_project) + use_ci_variable(name: 'PERSONAL_ACCESS_TOKEN', value: personal_access_token, project: client_project) when :ci_job_token '${CI_JOB_TOKEN}' when :project_deploy_token - project_deploy_token.token + use_ci_variable(name: 'PROJECT_DEPLOY_TOKEN', value: project_deploy_token.token, project: package_project) + use_ci_variable(name: 'PROJECT_DEPLOY_TOKEN', value: project_deploy_token.token, project: client_project) end end diff --git a/qa/qa/specs/features/browser_ui/5_package/package_registry/npm/npm_instance_level_spec.rb b/qa/qa/specs/features/browser_ui/5_package/package_registry/npm/npm_instance_level_spec.rb index 04aaefbaf5c..0ee5f1b6a0b 100644 --- a/qa/qa/specs/features/browser_ui/5_package/package_registry/npm/npm_instance_level_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/package_registry/npm/npm_instance_level_spec.rb @@ -5,6 +5,7 @@ module QA describe 'npm instance level endpoint' do using RSpec::Parameterized::TableSyntax include Runtime::Fixtures + include Support::Helpers::MaskToken let!(:registry_scope) { Runtime::Namespace.sandbox_name } let!(:personal_access_token) do @@ -78,11 +79,13 @@ module QA let(:auth_token) do case authentication_token_type when :personal_access_token - "\"#{personal_access_token}\"" + use_ci_variable(name: 'PERSONAL_ACCESS_TOKEN', value: personal_access_token, project: project) + use_ci_variable(name: 'PERSONAL_ACCESS_TOKEN', value: personal_access_token, project: another_project) when :ci_job_token '${CI_JOB_TOKEN}' when :project_deploy_token - "\"#{project_deploy_token.token}\"" + use_ci_variable(name: 'PROJECT_DEPLOY_TOKEN', value: project_deploy_token.token, project: project) + use_ci_variable(name: 'PROJECT_DEPLOY_TOKEN', value: project_deploy_token.token, project: another_project) end end diff --git a/qa/qa/specs/features/browser_ui/5_package/package_registry/npm/npm_project_level_spec.rb b/qa/qa/specs/features/browser_ui/5_package/package_registry/npm/npm_project_level_spec.rb index cad1802f3e9..5ebcb94d0d0 100644 --- a/qa/qa/specs/features/browser_ui/5_package/package_registry/npm/npm_project_level_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/package_registry/npm/npm_project_level_spec.rb @@ -5,6 +5,7 @@ module QA describe 'npm project level endpoint' do using RSpec::Parameterized::TableSyntax include Runtime::Fixtures + include Support::Helpers::MaskToken let!(:registry_scope) { Runtime::Namespace.sandbox_name } let!(:personal_access_token) do @@ -34,6 +35,7 @@ module QA let!(:project) do Resource::Project.fabricate_via_api! do |project| project.name = 'npm-project-level' + project.visibility = :private end end @@ -69,11 +71,11 @@ module QA let(:auth_token) do case authentication_token_type when :personal_access_token - "\"#{personal_access_token}\"" + use_ci_variable(name: 'PERSONAL_ACCESS_TOKEN', value: personal_access_token, project: project) when :ci_job_token '${CI_JOB_TOKEN}' when :project_deploy_token - "\"#{project_deploy_token.token}\"" + use_ci_variable(name: 'PROJECT_DEPLOY_TOKEN', value: project_deploy_token.token, project: project) end end diff --git a/qa/qa/specs/features/browser_ui/5_package/package_registry/nuget/nuget_group_level_spec.rb b/qa/qa/specs/features/browser_ui/5_package/package_registry/nuget/nuget_group_level_spec.rb index b0a6555a16b..0ddb59d6625 100644 --- a/qa/qa/specs/features/browser_ui/5_package/package_registry/nuget/nuget_group_level_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/package_registry/nuget/nuget_group_level_spec.rb @@ -5,6 +5,7 @@ module QA describe 'NuGet group level endpoint' do using RSpec::Parameterized::TableSyntax include Runtime::Fixtures + include Support::Helpers::MaskToken let(:project) do Resource::Project.fabricate_via_api! do |project| @@ -61,6 +62,8 @@ module QA after do runner.remove_via_api! package.remove_via_api! + project.remove_via_api! + another_project.remove_via_api! end where(:case_name, :authentication_token_type, :token_name, :testcase) do @@ -73,11 +76,13 @@ module QA let(:auth_token_password) do case authentication_token_type when :personal_access_token - "\"#{personal_access_token.token}\"" + use_ci_variable(name: 'PERSONAL_ACCESS_TOKEN', value: personal_access_token.token, project: project) + use_ci_variable(name: 'PERSONAL_ACCESS_TOKEN', value: personal_access_token.token, project: another_project) when :ci_job_token '${CI_JOB_TOKEN}' when :group_deploy_token - "\"#{group_deploy_token.token}\"" + use_ci_variable(name: 'GROUP_DEPLOY_TOKEN', value: group_deploy_token.token, project: project) + use_ci_variable(name: 'GROUP_DEPLOY_TOKEN', value: group_deploy_token.token, project: another_project) end end diff --git a/qa/qa/specs/features/browser_ui/5_package/package_registry/nuget/nuget_project_level_spec.rb b/qa/qa/specs/features/browser_ui/5_package/package_registry/nuget/nuget_project_level_spec.rb index 4cac055634e..d5fd78480d2 100644 --- a/qa/qa/specs/features/browser_ui/5_package/package_registry/nuget/nuget_project_level_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/package_registry/nuget/nuget_project_level_spec.rb @@ -3,6 +3,8 @@ module QA RSpec.describe 'Package', :orchestrated, :packages, :object_storage do describe 'NuGet project level endpoint' do + include Support::Helpers::MaskToken + let(:project) do Resource::Project.fabricate_via_api! do |project| project.name = 'nuget-package-project' @@ -77,11 +79,11 @@ module QA let(:auth_token_password) do case authentication_token_type when :personal_access_token - "\"#{personal_access_token.token}\"" + use_ci_variable(name: 'PERSONAL_ACCESS_TOKEN', value: personal_access_token.token, project: project) when :ci_job_token '${CI_JOB_TOKEN}' when :project_deploy_token - "\"#{project_deploy_token.token}\"" + use_ci_variable(name: 'PROJECT_DEPLOY_TOKEN', value: project_deploy_token.token, project: project) end end diff --git a/qa/qa/specs/features/browser_ui/5_package/package_registry/pypi_repository_spec.rb b/qa/qa/specs/features/browser_ui/5_package/package_registry/pypi_repository_spec.rb index a0c2eca5bd2..4614eced300 100644 --- a/qa/qa/specs/features/browser_ui/5_package/package_registry/pypi_repository_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/package_registry/pypi_repository_spec.rb @@ -4,10 +4,12 @@ module QA RSpec.describe 'Package', :orchestrated, :packages, :object_storage do describe 'PyPI Repository' do include Runtime::Fixtures + include Support::Helpers::MaskToken let(:project) do Resource::Project.fabricate_via_api! do |project| project.name = 'pypi-package-project' + project.visibility = :private end end @@ -30,7 +32,7 @@ module QA let(:uri) { URI.parse(Runtime::Scenario.gitlab_address) } let(:gitlab_address_with_port) { "#{uri.scheme}://#{uri.host}:#{uri.port}" } let(:gitlab_host_with_port) { "#{uri.host}:#{uri.port}" } - let(:personal_access_token) { Runtime::Env.personal_access_token } + let(:personal_access_token) { use_ci_variable(name: 'PERSONAL_ACCESS_TOKEN', value: Runtime::Env.personal_access_token, project: project) } before do Flow::Login.sign_in diff --git a/qa/qa/specs/features/browser_ui/5_package/package_registry/rubygems_registry_spec.rb b/qa/qa/specs/features/browser_ui/5_package/package_registry/rubygems_registry_spec.rb index b2208dc644c..409a1c10943 100644 --- a/qa/qa/specs/features/browser_ui/5_package/package_registry/rubygems_registry_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/package_registry/rubygems_registry_spec.rb @@ -1,13 +1,15 @@ # frozen_string_literal: true module QA - RSpec.describe 'Package', :orchestrated, :requires_admin, :packages, :object_storage do + RSpec.describe 'Package', :orchestrated, :packages, :object_storage, + feature_flag: { name: 'rubygem_packages', scope: :project } do describe 'RubyGems Repository' do include Runtime::Fixtures let(:project) do Resource::Project.fabricate_via_api! do |project| project.name = 'rubygems-package-project' + project.visibility = :private end end |