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 /qa/qa/specs | |
parent | 62f7d5c5b69180e82ae8196b7b429eeffc8e7b4f (diff) | |
download | gitlab-ce-ee664acb356f8123f4f6b00b73c1e1cf0866c7fb.tar.gz |
Add latest changes from gitlab-org/gitlab@15-5-stable-eev15.5.0-rc42
Diffstat (limited to 'qa/qa/specs')
64 files changed, 750 insertions, 702 deletions
diff --git a/qa/qa/specs/features/api/1_manage/group_access_token_spec.rb b/qa/qa/specs/features/api/1_manage/group_access_token_spec.rb index 7d3916641aa..bf95a215c8e 100644 --- a/qa/qa/specs/features/api/1_manage/group_access_token_spec.rb +++ b/qa/qa/specs/features/api/1_manage/group_access_token_spec.rb @@ -40,9 +40,7 @@ module QA commit.branch = "new_branch_#{SecureRandom.hex(8)}" commit.start_branch = project.default_branch commit.commit_message = 'Add new file' - commit.add_files([ - { file_path: "text-#{SecureRandom.hex(8)}.txt", content: 'new file' } - ]) + commit.add_files([{ file_path: "text-#{SecureRandom.hex(8)}.txt", content: 'new file' }]) end end.not_to raise_error end diff --git a/qa/qa/specs/features/api/1_manage/import_github_repo_spec.rb b/qa/qa/specs/features/api/1_manage/import/import_github_repo_spec.rb index df34bf32421..c3e41e9298b 100644 --- a/qa/qa/specs/features/api/1_manage/import_github_repo_spec.rb +++ b/qa/qa/specs/features/api/1_manage/import/import_github_repo_spec.rb @@ -3,7 +3,7 @@ module QA # 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 + RSpec.describe 'Manage', :github, :reliable, :skip_live_env, :requires_admin, product_group: :import 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 } } @@ -20,7 +20,9 @@ module QA project.group = group project.github_personal_access_token = Runtime::Env.github_access_token project.github_repository_path = 'gitlab-qa-github/import-test' - project.api_client = api_client + project.api_client = Runtime::API::Client.new(user: user) + project.issue_events_import = true + project.full_notes_import = true end end @@ -41,6 +43,7 @@ module QA aggregate_failures do verify_status_data verify_repository_import + verify_protected_branches_import verify_commits_import verify_labels_import verify_issues_import @@ -53,7 +56,7 @@ module QA def verify_status_data stats = imported_project.project_import_status.dig(:stats, :imported) expect(stats).to include( - # issue: 2, + issue: 1, label: 9, milestone: 1, note: 3, @@ -69,6 +72,21 @@ module QA expect(imported_project.api_response[:import_error]).to be_nil end + def verify_protected_branches_import + branches = imported_project.protected_branches.map do |branch| + branch.slice(:name, :allow_force_push, :code_owner_approval_required) + end + expect(branches.first).to include( + { + name: 'main' + # TODO: Add validation once https://gitlab.com/groups/gitlab-org/-/epics/8585 is closed + # At the moment both options are always set to false regardless of state in github + # allow_force_push: true, + # code_owner_approval_required: true + } + ) + end + def verify_commits_import expect(imported_project.commits.length).to eq(2) end @@ -122,7 +140,7 @@ module QA mr.iid = merge_requests.first[:iid] mr.api_client = api_client end.reload! - mr_comments = merge_request.comments.map { |comment| comment[:body] } # rubocop:disable Rails/Pluck + mr_comments = merge_request.comments.map { |comment| comment[:body] } expect(merge_requests.length).to eq(1) expect(merge_request.api_resource).to include( 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/import_large_github_repo_spec.rb index e6b60a5b090..5acf15dd2b4 100644 --- a/qa/qa/specs/features/api/1_manage/import_large_github_repo_spec.rb +++ b/qa/qa/specs/features/api/1_manage/import/import_large_github_repo_spec.rb @@ -1,21 +1,82 @@ # frozen_string_literal: true +require "etc" + # Lifesize project import test executed from https://gitlab.com/gitlab-org/manage/import/import-metrics # rubocop:disable Rails/Pluck module QA RSpec.describe 'Manage', :github, requires_admin: 'creates users', only: { job: 'large-github-import' } do - describe 'Project import' do + describe 'Project import', product_group: :import do # rubocop:disable RSpec/MultipleMemoizedHelpers + let(:github_repo) { ENV['QA_LARGE_IMPORT_REPO'] || 'rspec/rspec-core' } + let(:import_max_duration) { ENV['QA_LARGE_IMPORT_DURATION']&.to_i || 7200 } let(:logger) { Runtime::Logger.logger } let(:differ) { RSpec::Support::Differ.new(color: true) } - let(:gitlab_address) { QA::Runtime::Scenario.gitlab_address } + let(:gitlab_address) { QA::Runtime::Scenario.gitlab_address.chomp("/") } let(:dummy_url) { "https://example.com" } + let(:api_request_params) { { auto_paginate: true, attempts: 2 } } let(:created_by_pattern) { /\*Created by: \S+\*\n\n/ } let(:suggestion_pattern) { /suggestion:-\d+\+\d+/ } let(:gh_link_pattern) { %r{https://github.com/#{github_repo}/(issues|pull)} } let(:gl_link_pattern) { %r{#{gitlab_address}/#{imported_project.path_with_namespace}/-/(issues|merge_requests)} } - let(:event_pattern) { %r{(un)?assigned( to)? @\S+|mentioned in (issue|merge request) [!#]\d+|changed title from \*\*.*\*\* to \*\*.*\*\*} } # rubocop:disable Layout/LineLength + # rubocop:disable Lint/MixedRegexpCaptureTypes + let(:event_pattern) do + Regexp.union( + [ + /(?<event>(un)?assigned)( to)? @\S+/, + /(?<event>mentioned) in (issue|merge request) [!#]\d+/, + /(?<event>changed title) from \*\*.*\*\* to \*\*.*\*\*/, + /(?<event>requested review) from @\w+/, + /\*(?<event>Merged) by:/, + /\*\*(Review):\*\*/ + ] + ) + end + # rubocop:enable Lint/MixedRegexpCaptureTypes + + # mapping from gitlab to github names + let(:event_mapping) do + { + "label_add" => "labeled", + "label_remove" => "unlabeled", + "milestone_add" => "milestoned", + "milestone_remove" => "demilestoned", + "assigned" => "assigned", + "unassigned" => "unassigned", + "changed title" => "renamed", + "requested review" => "review_requested", + "Merged" => "merged" + } + end + + # github events that are not migrated or are not correctly mapable in gitlab + let(:unsupported_events) do + [ + "head_ref_deleted", + "head_ref_force_pushed", + "head_ref_restored", + "base_ref_force_pushed", + "base_ref_changed", + "review_request_removed", + "review_dismissed", + "auto_squash_enabled", + "auto_merge_disabled", + "comment_deleted", + "convert_to_draft", + "ready_for_review", + "subscribed", + "unsubscribed", + "transferred", + "locked", + "unlocked", + # mentions are supported but they can be reported differently on gitlab's side + # for example mention of issue creation in pr will be reported in the issue on gitlab side + # or referenced in github will still create a 'mentioned in' comment in gitlab + "referenced", + "mentioned" + ] + end let(:api_client) { Runtime::API::Client.as_admin } @@ -25,79 +86,105 @@ module QA end end - 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_IMPORT_GH_TOKEN'] || Runtime::Env.github_access_token, - auto_paginate: true + auto_paginate: true, + middleware: Faraday::RackBuilder.new do |builder| + builder.use(Faraday::Retry::Middleware, exceptions: [Octokit::InternalServerError, Octokit::ServerError]) + end ) end let(:gh_repo) { github_client.repository(github_repo) } let(:gh_branches) do - logger.debug("= Fetching branches =") + logger.info("= Fetching branches =") github_client.branches(github_repo).map(&:name) end let(:gh_commits) do - logger.debug("= Fetching commits =") + logger.info("= Fetching commits =") github_client.commits(github_repo).map(&:sha) end let(:gh_labels) do - logger.debug("= Fetching labels =") + logger.info("= Fetching labels =") github_client.labels(github_repo).map { |label| { name: label.name, color: "##{label.color}" } } end let(:gh_milestones) do - logger.debug("= Fetching milestones =") + logger.info("= Fetching milestones =") github_client .list_milestones(github_repo, state: 'all') .map { |ms| { title: ms.title, description: ms.description } } end - let(:gh_all_issues) do - logger.debug("= Fetching issues and prs =") - github_client.list_issues(github_repo, state: 'all') - end - let(:gh_prs) do gh_all_issues.select(&:pull_request).each_with_object({}) do |pr, hash| - hash[pr.number] = { + id = pr.number + hash[id] = { url: pr.html_url, title: pr.title, body: pr.body || '', - comments: [*gh_pr_comments[pr.html_url], *gh_issue_comments[pr.html_url]].compact + comments: [*gh_pr_comments[id], *gh_issue_comments[id]].compact, + events: gh_pr_events[id].reject { |event| unsupported_events.include?(event) } } end end let(:gh_issues) do gh_all_issues.reject(&:pull_request).each_with_object({}) do |issue, hash| - hash[issue.number] = { + id = issue.number + hash[id] = { url: issue.html_url, title: issue.title, body: issue.body || '', - comments: gh_issue_comments[issue.html_url] + comments: gh_issue_comments[id], + events: gh_issue_events[id].reject { |event| unsupported_events.include?(event) } } end end + let(:gh_all_issues) do + logger.info("= Fetching issues and prs =") + github_client.list_issues(github_repo, state: 'all') + end + + let(:gh_all_events) do + logger.info("- Fetching issue and pr events -") + github_client.repository_issue_events(github_repo).map do |event| + { name: event[:event], **(event[:issue] || {}) } # some events don't have issue object at all + end + end + + let(:gh_issue_events) do + gh_all_events.each_with_object(Hash.new { |h, k| h[k] = [] }) do |event, hash| + next if event[:pull_request] || !event[:number] + + hash[event[:number]] << event[:name] + end + end + + let(:gh_pr_events) do + gh_all_events.each_with_object(Hash.new { |h, k| h[k] = [] }) do |event, hash| + next unless event[:pull_request] + + hash[event[:number]] << event[:name] + end + end + let(:gh_issue_comments) do - logger.debug("= Fetching issue comments =") + logger.info("- Fetching issue comments -") github_client.issues_comments(github_repo).each_with_object(Hash.new { |h, k| h[k] = [] }) do |c, hash| - # use base html url as key - hash[c.html_url.gsub(/\#\S+/, "")] << c.body&.gsub(gh_link_pattern, dummy_url) + hash[id_from_url(c.html_url)] << c.body&.gsub(gh_link_pattern, dummy_url) end end let(:gh_pr_comments) do - logger.debug("= Fetching pr comments =") + logger.info("- Fetching pr comments -") github_client.pull_requests_comments(github_repo).each_with_object(Hash.new { |h, k| h[k] = [] }) do |c, hash| - # use base html url as key - hash[c.html_url.gsub(/\#\S+/, "")] << c.body + hash[id_from_url(c.html_url)] << c.body # some suggestions can contain extra whitespaces which gitlab will remove &.gsub(/suggestion\s+\r/, "suggestion\r") &.gsub(gh_link_pattern, dummy_url) @@ -111,11 +198,12 @@ module QA project.github_personal_access_token = Runtime::Env.github_access_token project.github_repository_path = github_repo project.personal_namespace = user.username - project.api_client = api_client + project.api_client = Runtime::API::Client.new(user: user) + project.issue_events_import = true + project.full_notes_import = true end end - # rubocop:disable RSpec/InstanceVariable after do |example| next unless defined?(@import_time) @@ -138,8 +226,10 @@ module QA milestones: gh_milestones.length, mrs: gh_prs.length, mr_comments: gh_prs.sum { |_k, v| v[:comments].length }, + mr_events: gh_prs.sum { |_k, v| v[:events].length }, issues: gh_issues.length, - issue_comments: gh_issues.sum { |_k, v| v[:comments].length } + issue_comments: gh_issues.sum { |_k, v| v[:comments].length }, + issue_events: gh_issues.sum { |_k, v| v[:events].length } } }, target: { @@ -153,8 +243,10 @@ module QA milestones: gl_milestones.length, mrs: mrs.length, mr_comments: mrs.sum { |_k, v| v[:comments].length }, + mr_events: mrs.sum { |_k, v| v[:events].length }, issues: gl_issues.length, - issue_comments: gl_issues.sum { |_k, v| v[:comments].length } + issue_comments: gl_issues.sum { |_k, v| v[:comments].length }, + issue_events: gl_issues.sum { |_k, v| v[:events].length } } }, not_imported: { @@ -164,7 +256,6 @@ module QA } ) end - # rubocop:enable RSpec/InstanceVariable it( 'imports large Github repo via api', @@ -172,8 +263,9 @@ module QA ) do start = Time.now - # import the project and log gitlab path - logger.info("== Importing project '#{github_repo}' in to '#{imported_project.reload!.full_path}' ==") + # trigger import and log project paths + logger.info("== Triggering import of project '#{github_repo}' in to '#{imported_project.reload!.full_path}' ==") + # fetch all objects right after import has started fetch_github_objects @@ -182,7 +274,7 @@ module QA @stats = status.dig(:stats, :imported) # fail fast if import explicitly failed - raise "Import of '#{imported_project.name}' failed!" if status[:import_status] == 'failed' + raise "Import of '#{imported_project.full_path}' failed!" if status[:import_status] == 'failed' status[:import_status] end @@ -276,25 +368,26 @@ module QA count_msg = "Expected to contain same amount of #{type}s. Gitlab: #{expected.length}, Github: #{actual.length}" expect(expected.length).to eq(actual.length), count_msg - missing_comments = verify_comments(type, actual, expected) + missing_objects = (actual.keys - expected.keys).map { |it| actual[it].slice(:title, :url) } + missing_content = verify_comments_and_events(type, actual, expected) { - "#{type}s": (actual.keys - expected.keys).map { |it| actual[it].slice(:title, :url) }, - "#{type}_comments": missing_comments - } + "#{type}s": missing_objects.empty? ? nil : missing_objects, + "#{type}_content": missing_content.empty? ? nil : missing_content + }.compact end - # Verify imported comments + # Verify imported comments and events # # @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| + def verify_comments_and_events(type, actual, expected) + actual.each_with_object([]) do |(key, actual_item), missing_content| expected_item = expected[key] title = actual_item[:title] - msg = "expected #{type} with title '#{title}' to have" + msg = "expected #{type} with iid '#{key}' to have" # Print title in the error message to see which object is missing # @@ -320,17 +413,27 @@ module QA expect(expected_comments.length).to eq(actual_comments.length), comment_count_msg expect(expected_comments).to match_array(actual_comments) - # Save missing comments + expected_events = expected_item[:events] + actual_events = actual_item[:events] + event_count_msg = <<~MSG + #{msg} same amount of events. Gitlab: #{expected_events.length}, Github: #{actual_events.length} + MSG + expect(expected_events.length).to eq(actual_events.length), event_count_msg + expect(expected_events).to match_array(actual_events) + + # Save missing comments and events # comment_diff = actual_comments - expected_comments - next if comment_diff.empty? + event_diff = actual_events - expected_events + next if comment_diff.empty? && event_diff.empty? - missing_comments << { + missing_content << { title: title, github_url: actual_item[:url], gitlab_url: expected_item[:url], - missing_comments: comment_diff - } + missing_comments: comment_diff.empty? ? nil : comment_diff, + missing_events: event_diff.empty? ? nil : event_diff + }.compact end end @@ -380,26 +483,27 @@ module QA def mrs @mrs ||= begin logger.debug("= Fetching merge requests =") - imported_mrs = imported_project.merge_requests(auto_paginate: true, attempts: 2) + imported_mrs = imported_project.merge_requests(**api_request_params) logger.debug("= Fetching merge request comments =") - Parallel.map(imported_mrs, in_threads: 4) do |mr| + Parallel.map(imported_mrs, in_threads: Etc.nprocessors) do |mr| resource = Resource::MergeRequest.init do |resource| resource.project = imported_project resource.iid = mr[:iid] resource.api_client = api_client end - logger.debug("Fetching comments for mr '#{mr[:title]}'") - comments = resource - .comments(auto_paginate: true, attempts: 2) - .reject { |c| c[:system] || c[:body].match?(/^(\*\*Review:\*\*)|(\*Merged by:).*/) } + logger.debug("Fetching events and comments for mr '!#{mr[:iid]}'") + comments = resource.comments(**api_request_params) + label_events = resource.label_events(**api_request_params) + state_events = resource.state_events(**api_request_params) + milestone_events = resource.milestone_events(**api_request_params) [mr[:iid], { url: mr[:web_url], title: mr[:title], body: sanitize_description(mr[:description]) || '', - events: events(comments), + events: events(comments, label_events, state_events, milestone_events), comments: non_event_comments(comments) }] end.to_h @@ -412,48 +516,59 @@ module QA def gl_issues @gl_issues ||= begin logger.debug("= Fetching issues =") - imported_issues = imported_project.issues(auto_paginate: true, attempts: 2) + imported_issues = imported_project.issues(**api_request_params) logger.debug("= Fetching issue comments =") - Parallel.map(imported_issues, in_threads: 4) do |issue| + Parallel.map(imported_issues, in_threads: Etc.nprocessors) do |issue| resource = Resource::Issue.init do |issue_resource| issue_resource.project = imported_project issue_resource.iid = issue[:iid] issue_resource.api_client = api_client end - logger.debug("Fetching comments for issue '#{issue[:title]}'") - comments = resource.comments(auto_paginate: true, attempts: 2) + logger.debug("Fetching events and comments for issue '!#{issue[:iid]}'") + comments = resource.comments(**api_request_params) + label_events = resource.label_events(**api_request_params) + state_events = resource.state_events(**api_request_params) + milestone_events = resource.milestone_events(**api_request_params) [issue[:iid], { url: issue[:web_url], title: issue[:title], body: sanitize_description(issue[:description]) || '', - events: events(comments), + events: events(comments, label_events, state_events, milestone_events), comments: non_event_comments(comments) }] end.to_h end end - # Fetch comments without events + # Filter out event comments # # @param [Array] comments # @return [Array] def non_event_comments(comments) comments - .reject { |c| c[:body].match?(event_pattern) } + .reject { |c| c[:system] || c[:body].match?(event_pattern) } .map { |c| sanitize_comment(c[:body]) } end # Events # # @param [Array] comments + # @param [Array] label_events + # @param [Array] state_events + # @param [Array] milestone_events # @return [Array] - def events(comments) - comments - .select { |c| c[:body].match?(event_pattern) } - .map { |c| c[:body] } + def events(comments, label_events, state_events, milestone_events) + mapped_label_events = label_events.map { |event| event_mapping["label_#{event[:action]}"] } + mapped_milestone_events = milestone_events.map { |event| event_mapping["milestone_#{event[:action]}"] } + mapped_state_event = state_events.map { |event| event[:state] } + mapped_comment_events = comments.map do |c| + event_mapping[c[:body].match(event_pattern)&.named_captures&.fetch("event", nil)] + end + + [*mapped_label_events, *mapped_milestone_events, *mapped_state_event, *mapped_comment_events].compact end # Normalize comments and make them directly comparable @@ -489,6 +604,16 @@ module QA def save_json(name, json) File.open("tmp/#{name}.json", "w") { |file| file.write(JSON.pretty_generate(json)) } end + + # Extract id number from web url of issue or pull request + # + # Some endpoints don't return object id as separate parameter so web url can be used as a workaround + # + # @param [String] url + # @return [Integer] + def id_from_url(url) + url.match(%r{(?<type>issues|pull)/(?<id>\d+)})&.named_captures&.fetch("id", nil).to_i + end end end end diff --git a/qa/qa/specs/features/api/3_create/integrations/webhook_events_spec.rb b/qa/qa/specs/features/api/1_manage/integrations/webhook_events_spec.rb index aae0329003b..a2d66ffe8d3 100644 --- a/qa/qa/specs/features/api/3_create/integrations/webhook_events_spec.rb +++ b/qa/qa/specs/features/api/1_manage/integrations/webhook_events_spec.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true module QA - RSpec.describe 'Create' do - describe 'WebHooks integration', :requires_admin, :integrations, :orchestrated do + RSpec.describe 'Manage' do + describe 'WebHooks integration', :requires_admin, :integrations, :orchestrated, product_group: :integrations do before(:context) do toggle_local_requests(true) end @@ -70,7 +70,8 @@ module QA end end - it 'sends an issues and note event', testcase: '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/1_manage/migration/gitlab_migration_group_spec.rb b/qa/qa/specs/features/api/1_manage/migration/gitlab_migration_group_spec.rb index f721b3326a0..e17e12cdaf3 100644 --- a/qa/qa/specs/features/api/1_manage/migration/gitlab_migration_group_spec.rb +++ b/qa/qa/specs/features/api/1_manage/migration/gitlab_migration_group_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - RSpec.describe 'Manage', :reliable, :requires_admin do + RSpec.describe 'Manage', :reliable, :requires_admin, product_group: :import do describe 'Gitlab migration' do 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/1_manage/migration/gitlab_migration_issue_spec.rb b/qa/qa/specs/features/api/1_manage/migration/gitlab_migration_issue_spec.rb index 74a00e1c74c..c1f11b15068 100644 --- a/qa/qa/specs/features/api/1_manage/migration/gitlab_migration_issue_spec.rb +++ b/qa/qa/specs/features/api/1_manage/migration/gitlab_migration_issue_spec.rb @@ -4,7 +4,7 @@ require_relative 'gitlab_project_migration_common' module QA RSpec.describe 'Manage' do - describe 'Gitlab migration' do + describe 'Gitlab migration', product_group: :import do include_context 'with gitlab project migration' let!(:source_issue) do 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 index 83cc44f9958..5689fa169ce 100644 --- 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 @@ -5,7 +5,7 @@ # rubocop:disable Rails/Pluck, Layout/LineLength, RSpec/MultipleMemoizedHelpers module QA RSpec.describe "Manage", requires_admin: 'creates users', only: { job: 'large-gitlab-import' } do - describe "Gitlab migration" do + describe "Gitlab migration", product_group: :import do let(:logger) { Runtime::Logger.logger } let(:differ) { RSpec::Support::Differ.new(color: true) } let(:gitlab_group) { ENV['QA_LARGE_IMPORT_GROUP'] || 'gitlab-migration' } diff --git a/qa/qa/specs/features/api/1_manage/migration/gitlab_migration_members_spec.rb b/qa/qa/specs/features/api/1_manage/migration/gitlab_migration_members_spec.rb index 704325d9235..aa4d3becbe7 100644 --- a/qa/qa/specs/features/api/1_manage/migration/gitlab_migration_members_spec.rb +++ b/qa/qa/specs/features/api/1_manage/migration/gitlab_migration_members_spec.rb @@ -4,7 +4,7 @@ require_relative 'gitlab_project_migration_common' module QA RSpec.describe 'Manage' do - describe 'Gitlab migration' do + describe 'Gitlab migration', product_group: :import do include_context 'with gitlab project migration' let(:member) do diff --git a/qa/qa/specs/features/api/1_manage/migration/gitlab_migration_mr_spec.rb b/qa/qa/specs/features/api/1_manage/migration/gitlab_migration_mr_spec.rb index d656ea4dea5..92cba005832 100644 --- a/qa/qa/specs/features/api/1_manage/migration/gitlab_migration_mr_spec.rb +++ b/qa/qa/specs/features/api/1_manage/migration/gitlab_migration_mr_spec.rb @@ -4,7 +4,7 @@ require_relative 'gitlab_project_migration_common' module QA RSpec.describe 'Manage' do - describe 'Gitlab migration' do + describe 'Gitlab migration', product_group: :import do include_context 'with gitlab project migration' context 'with merge request' do diff --git a/qa/qa/specs/features/api/1_manage/migration/gitlab_migration_pipeline_spec.rb b/qa/qa/specs/features/api/1_manage/migration/gitlab_migration_pipeline_spec.rb index 484c32956e3..3db4ff4351e 100644 --- a/qa/qa/specs/features/api/1_manage/migration/gitlab_migration_pipeline_spec.rb +++ b/qa/qa/specs/features/api/1_manage/migration/gitlab_migration_pipeline_spec.rb @@ -4,7 +4,7 @@ require_relative 'gitlab_project_migration_common' module QA RSpec.describe 'Manage' do - describe 'Gitlab migration' do + describe 'Gitlab migration', product_group: :import do include_context 'with gitlab project migration' context 'with ci pipeline' do diff --git a/qa/qa/specs/features/api/1_manage/migration/gitlab_migration_project_spec.rb b/qa/qa/specs/features/api/1_manage/migration/gitlab_migration_project_spec.rb index 421dbe56a99..3e0df3d1e13 100644 --- a/qa/qa/specs/features/api/1_manage/migration/gitlab_migration_project_spec.rb +++ b/qa/qa/specs/features/api/1_manage/migration/gitlab_migration_project_spec.rb @@ -4,7 +4,7 @@ require_relative 'gitlab_project_migration_common' module QA RSpec.describe 'Manage' do - describe 'Gitlab migration' do + describe 'Gitlab migration', product_group: :import do include_context 'with gitlab project migration' context 'with uninitialized project' do diff --git a/qa/qa/specs/features/api/1_manage/migration/gitlab_migration_release_spec.rb b/qa/qa/specs/features/api/1_manage/migration/gitlab_migration_release_spec.rb index 6910b6a7fa2..91dcfe6a1a3 100644 --- a/qa/qa/specs/features/api/1_manage/migration/gitlab_migration_release_spec.rb +++ b/qa/qa/specs/features/api/1_manage/migration/gitlab_migration_release_spec.rb @@ -4,7 +4,7 @@ require_relative 'gitlab_project_migration_common' module QA RSpec.describe 'Manage' do - describe 'Gitlab migration' do + describe 'Gitlab migration', product_group: :import do include_context 'with gitlab project migration' context 'with release' do 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 3581ad3d207..9c80c088917 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 @@ -1,9 +1,11 @@ # frozen_string_literal: true 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: 'creates a user via API', + quarantine: { + type: :flaky, + issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/364839' + }, feature_flag: { name: 'bulk_import_projects', scope: :global diff --git a/qa/qa/specs/features/api/1_manage/project_access_token_spec.rb b/qa/qa/specs/features/api/1_manage/project_access_token_spec.rb index 539da92f471..c4be90d3759 100644 --- a/qa/qa/specs/features/api/1_manage/project_access_token_spec.rb +++ b/qa/qa/specs/features/api/1_manage/project_access_token_spec.rb @@ -33,9 +33,7 @@ module QA commit.branch = "new_branch_#{SecureRandom.hex(8)}" commit.start_branch = @project_access_token.project.default_branch commit.commit_message = 'Add new file' - commit.add_files([ - { file_path: "text-#{SecureRandom.hex(8)}.txt", content: 'new file' } - ]) + commit.add_files([{ file_path: "text-#{SecureRandom.hex(8)}.txt", content: 'new file' }]) end end.not_to raise_error end @@ -67,9 +65,7 @@ module QA commit.branch = "new_branch_#{SecureRandom.hex(8)}" commit.start_branch = @different_project.default_branch commit.commit_message = 'Add new file' - commit.add_files([ - { file_path: "text-#{SecureRandom.hex(8)}.txt", content: 'new file' } - ]) + commit.add_files([{ file_path: "text-#{SecureRandom.hex(8)}.txt", content: 'new file' }]) end end.to raise_error(Resource::ApiFabricator::ResourceFabricationFailedError, /403 Forbidden - You are not allowed to push into this branch/) end diff --git a/qa/qa/specs/features/api/1_manage/rate_limits_spec.rb b/qa/qa/specs/features/api/1_manage/rate_limits_spec.rb index 874626e01f1..24088057abc 100644 --- a/qa/qa/specs/features/api/1_manage/rate_limits_spec.rb +++ b/qa/qa/specs/features/api/1_manage/rate_limits_spec.rb @@ -2,7 +2,7 @@ module QA RSpec.describe 'Manage', :requires_admin, :skip_live_env, except: { job: 'review-qa-*' } do - describe 'rate limits', :reliable do + describe 'rate limits', :reliable, product_group: :integrations do let(:rate_limited_user) { Resource::User.fabricate_via_api! } let(:api_client) { Runtime::API::Client.new(:gitlab, user: rate_limited_user) } let!(:request) { Runtime::API::Request.new(api_client, '/users') } diff --git a/qa/qa/specs/features/api/1_manage/user_access_termination_spec.rb b/qa/qa/specs/features/api/1_manage/user_access_termination_spec.rb index e518bbfc6f7..28c20344b29 100644 --- a/qa/qa/specs/features/api/1_manage/user_access_termination_spec.rb +++ b/qa/qa/specs/features/api/1_manage/user_access_termination_spec.rb @@ -69,9 +69,7 @@ module QA commit.branch = "new_branch_#{SecureRandom.hex(8)}" commit.start_branch = @project.default_branch commit.commit_message = 'Add new file' - commit.add_files([ - { file_path: 'test.txt', content: 'new file' } - ]) + commit.add_files([{ file_path: 'test.txt', content: 'new file' }]) end end.to raise_error(Resource::ApiFabricator::ResourceFabricationFailedError, /403 Forbidden - You are not allowed to push into this branch/) end diff --git a/qa/qa/specs/features/api/1_manage/user_inherited_access_spec.rb b/qa/qa/specs/features/api/1_manage/user_inherited_access_spec.rb index 9f0e2664213..16d4fd35b69 100644 --- a/qa/qa/specs/features/api/1_manage/user_inherited_access_spec.rb +++ b/qa/qa/specs/features/api/1_manage/user_inherited_access_spec.rb @@ -2,7 +2,7 @@ module QA RSpec.describe 'Manage' do - describe 'User', :requires_admin do + describe 'User', :requires_admin, product_group: :workspace do let(:admin_api_client) { Runtime::API::Client.as_admin } let!(:sub_group) do @@ -85,9 +85,7 @@ module QA commit.branch = "new_branch_#{SecureRandom.hex(8)}" commit.start_branch = sub_group_project.default_branch commit.commit_message = 'Add new file' - commit.add_files([ - { file_path: 'test.txt', content: 'new file' } - ]) + commit.add_files([{ file_path: 'test.txt', content: 'new file' }]) end end.not_to raise_error end @@ -167,9 +165,7 @@ module QA commit.branch = "new_branch_#{SecureRandom.hex(8)}" commit.start_branch = parent_group_project.default_branch commit.commit_message = 'Add new file' - commit.add_files([ - { file_path: 'test.txt', content: 'new file' } - ]) + commit.add_files([{ file_path: 'test.txt', content: 'new file' }]) end end.to raise_error(Resource::ApiFabricator::ResourceFabricationFailedError, /403 Forbidden - You are not allowed to push into this branch/) diff --git a/qa/qa/specs/features/api/1_manage/users_spec.rb b/qa/qa/specs/features/api/1_manage/users_spec.rb index 531419e8d0f..ff036c18671 100644 --- a/qa/qa/specs/features/api/1_manage/users_spec.rb +++ b/qa/qa/specs/features/api/1_manage/users_spec.rb @@ -4,7 +4,7 @@ require 'airborne' module QA RSpec.describe 'Manage' do - describe 'Users API', :reliable do + describe 'Users API', :reliable, product_group: :workspace do let(:api_client) { Runtime::API::Client.new(:gitlab) } let(:request) { Runtime::API::Request.new(api_client, '/users') } 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 index 9d47872a774..4ee436a597a 100644 --- 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 @@ -16,18 +16,18 @@ module QA commit.project = project commit.update_files( [ - { - file_path: '.gitlab-ci.yml', - content: 'script' - } + { + file_path: '.gitlab-ci.yml', + content: 'script' + } ] ) commit.add_files( [ - { - file_path: 'foo', - content: 'bar' - } + { + file_path: 'foo', + content: 'bar' + } ] ) end diff --git a/qa/qa/specs/features/browser_ui/1_manage/group/gitlab_migration_group_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/group/gitlab_migration_group_spec.rb index a1b9e232e3d..c690202f091 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/group/gitlab_migration_group_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/group/gitlab_migration_group_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - describe 'Manage', :requires_admin, :reliable do + describe 'Manage', :requires_admin, :reliable, product_group: :import do describe 'Gitlab migration' do let!(:admin_api_client) { Runtime::API::Client.as_admin } let!(:user) do diff --git a/qa/qa/specs/features/browser_ui/1_manage/group/transfer_project_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/group/transfer_project_spec.rb index 2c331584cf7..d684eabe644 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/group/transfer_project_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/group/transfer_project_spec.rb @@ -2,7 +2,7 @@ module QA RSpec.describe 'Manage' do - describe 'Project transfer between groups', :reliable do + describe 'Project transfer between groups', :reliable, product_group: :workspace do let(:source_group) do Resource::Group.fabricate_via_api! do |group| group.path = "source-group-#{SecureRandom.hex(8)}" @@ -27,9 +27,7 @@ module QA before do Resource::Repository::Commit.fabricate_via_api! do |commit| commit.project = project - commit.add_files([ - { file_path: 'README.md', content: readme_content } - ]) + commit.add_files([{ file_path: 'README.md', content: readme_content }]) end Flow::Login.sign_in diff --git a/qa/qa/specs/features/browser_ui/3_create/jenkins/jenkins_build_status_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/integrations/jenkins/jenkins_build_status_spec.rb index 4bfd253c992..b8d00c2faee 100644 --- a/qa/qa/specs/features/browser_ui/3_create/jenkins/jenkins_build_status_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/integrations/jenkins/jenkins_build_status_spec.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true module QA - RSpec.describe 'Create', :requires_admin, :skip_live_env, except: { job: 'review-qa-*' } do - describe 'Jenkins integration' do + RSpec.describe 'Manage', :requires_admin, :skip_live_env, except: { job: 'review-qa-*' } do + describe 'Jenkins integration', product_group: :integrations do let(:jenkins_server) { Service::DockerRun::Jenkins.new } let(:jenkins_client) do @@ -48,7 +48,8 @@ module QA toggle_local_requests(false) end - it 'integrates and displays build status for MR pipeline in GitLab', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347788' do + it 'integrates and displays build status for MR pipeline in GitLab', + testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347788' do setup_project_integration jenkins_integration = project.find_integration('jenkins') @@ -133,7 +134,8 @@ module QA def patch_host_name(host_name, container_name) return host_name unless host_name.include?('localhost') - ip_address = `docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' #{container_name}`.strip + ip_address = `docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' #{container_name}` + .strip host_name.gsub('localhost', ip_address) end diff --git a/qa/qa/specs/features/browser_ui/3_create/jira/jira_basic_integration_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/integrations/jira/jira_basic_integration_spec.rb index 088556a3981..5a4031b4305 100644 --- a/qa/qa/specs/features/browser_ui/3_create/jira/jira_basic_integration_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/integrations/jira/jira_basic_integration_spec.rb @@ -1,10 +1,10 @@ # frozen_string_literal: true module QA - RSpec.describe 'Create' do + RSpec.describe 'Manage' do include Support::API - describe 'Jira integration', :jira, :orchestrated, :requires_admin do + describe 'Jira integration', :jira, :orchestrated, :requires_admin, product_group: :integrations do let(:jira_project_key) { 'JITP' } let(:project) do Resource::Project.fabricate_via_api! do |project| @@ -15,7 +15,8 @@ module QA before do page.visit Vendor::Jira::JiraAPI.perform(&:base_url) - QA::Support::Retrier.retry_until(sleep_interval: 3, reload_page: page, max_attempts: 20, raise_on_failure: true) do + QA::Support::Retrier + .retry_until(sleep_interval: 3, reload_page: page, max_attempts: 20, raise_on_failure: true) do page.has_text? 'Welcome to Jira' end @@ -33,10 +34,11 @@ module QA jira.setup_service_with(url: Vendor::Jira::JiraAPI.perform(&:base_url)) end - expect(page).not_to have_text("Requests to the local network are not allowed") + expect(page).not_to have_text("Requests to the local network are not allowed") # rubocop:disable RSpec/ExpectInHook end - it 'closes an issue via pushing a commit', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347794' do + it 'closes an issue via pushing a commit', + testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347794' do issue_key = Vendor::Jira::JiraAPI.perform do |jira_api| jira_api.create_issue(jira_project_key) end @@ -46,7 +48,8 @@ module QA expect_issue_done(issue_key) end - it 'closes an issue via a merge request', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347795' do + it 'closes an issue via a merge request', + testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347795' do issue_key = Vendor::Jira::JiraAPI.perform do |jira_api| jira_api.create_issue(jira_project_key) end diff --git a/qa/qa/specs/features/browser_ui/2_plan/issue/jira_issue_import_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/integrations/jira/jira_issue_import_spec.rb index d8435407296..7e46276be92 100644 --- a/qa/qa/specs/features/browser_ui/2_plan/issue/jira_issue_import_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/integrations/jira/jira_issue_import_spec.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true module QA - RSpec.describe 'Plan', :reliable do - describe 'Jira issue import', :jira, :orchestrated, :requires_admin do + RSpec.describe 'Manage', :reliable do + describe 'Jira issue import', :jira, :orchestrated, :requires_admin, product_group: :integrations do let(:jira_project_key) { "JITD" } let(:jira_issue_title) { "[#{jira_project_key}-1] Jira to GitLab Test Issue" } let(:jira_issue_description) { "This issue is for testing importing Jira issues to GitLab." } diff --git a/qa/qa/specs/features/browser_ui/4_verify/pipeline/pipeline_status_emails_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/integrations/pipeline_status_emails_spec.rb index f4794b3a904..4495d83f336 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/pipeline/pipeline_status_emails_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/integrations/pipeline_status_emails_spec.rb @@ -24,7 +24,7 @@ module QA end end - RSpec.describe 'Verify', :orchestrated, :runner, :requires_admin, :smtp do + RSpec.describe 'Manage', :orchestrated, :runner, :requires_admin, :smtp, product_group: :integrations do describe 'Pipeline status emails' do let(:executor) { "qa-runner-#{Time.now.to_i}" } let(:emails) { %w[foo@bar.com baz@buzz.com] } diff --git a/qa/qa/specs/features/browser_ui/1_manage/login/log_in_with_2fa_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/login/log_in_with_2fa_spec.rb index ad90df4b90d..56883917153 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/login/log_in_with_2fa_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/login/log_in_with_2fa_spec.rb @@ -3,8 +3,12 @@ module QA RSpec.describe 'Manage', :requires_admin, :skip_live_env do describe '2FA' do + let(:admin_api_client) { Runtime::API::Client.as_admin } + let(:owner_api_client) { Runtime::API::Client.new(:gitlab, user: owner_user) } + let!(:owner_user) do Resource::User.fabricate_via_api! do |usr| + usr.username = "owner_user_#{SecureRandom.hex(4)}" usr.api_client = admin_api_client end end @@ -26,6 +30,7 @@ module QA let(:developer_user) do Resource::User.fabricate_via_api! do |resource| + resource.username = "developer_user_#{SecureRandom.hex(4)}" resource.api_client = admin_api_client end end @@ -38,8 +43,7 @@ module QA it( 'allows enforcing 2FA via UI and logging in with 2FA', - testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347931', - quarantine: { type: :flaky, issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/369516' } + testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347931' ) do enforce_two_factor_authentication_on_group(group) @@ -70,14 +74,6 @@ module QA developer_user.remove_via_api! end - def admin_api_client - @admin_api_client ||= Runtime::API::Client.as_admin - end - - def owner_api_client - @owner_api_client ||= Runtime::API::Client.new(:gitlab, user: owner_user) - end - # We are intentionally using the UI to enforce 2FA to exercise the flow with UI. # Any future tests should use the API for this purpose. def enforce_two_factor_authentication_on_group(group) @@ -87,7 +83,9 @@ module QA Page::Group::Menu.perform(&:click_group_general_settings_item) Page::Group::Settings::General.perform(&:set_require_2fa_enabled) - expect(page).to have_text(two_fa_expected_text) + QA::Support::Retrier.retry_on_exception(reload_page: page) do + expect(page).to have_text(two_fa_expected_text) + end Page::Profile::TwoFactorAuth.perform(&:click_configure_it_later_button) diff --git a/qa/qa/specs/features/browser_ui/1_manage/project/add_project_member_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/project/add_project_member_spec.rb index 90fbff3261e..3f461e9247f 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/project/add_project_member_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/project/add_project_member_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - RSpec.describe 'Manage', :reliable do + RSpec.describe 'Manage', :reliable, product_group: :workspace do describe 'Add project member' do it 'user adds project member', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347887' do Flow::Login.sign_in 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 f624f2fb44f..b251b3075dd 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', :reliable do + describe 'Create project badge', :reliable, product_group: :workspace 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/create_project_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/project/create_project_spec.rb index d07fff80b19..7c6b0d77219 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/project/create_project_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/project/create_project_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - RSpec.describe 'Manage', :smoke do + RSpec.describe 'Manage', :smoke, product_group: :workspace do describe 'Project' do shared_examples 'successful project creation' do it 'creates a new project' do diff --git a/qa/qa/specs/features/browser_ui/1_manage/project/dashboard_images_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/project/dashboard_images_spec.rb index d299997dd3c..2abbb6ca73c 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/project/dashboard_images_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/project/dashboard_images_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - RSpec.describe 'Manage' do + RSpec.describe 'Manage', product_group: :workspace do shared_examples 'loads all images' do |admin| let(:api_client) { Runtime::API::Client.as_admin } 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 0477a9b8a1f..6ac11fea7e1 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 @@ -3,7 +3,7 @@ module QA # 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 + RSpec.describe 'Manage', :github, :reliable, :skip_live_env, :requires_admin, product_group: :import 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/invite_group_to_project_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/project/invite_group_to_project_spec.rb index dbfb114dc82..164f86bffce 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/project/invite_group_to_project_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/project/invite_group_to_project_spec.rb @@ -2,7 +2,7 @@ module QA RSpec.describe 'Manage' do - describe 'Invite group', :reliable do + describe 'Invite group', :reliable, product_group: :workspace do shared_examples 'invites group to project' do it 'verifies group is added and members can access project with correct access level' do Page::Project::Menu.perform(&:click_members) diff --git a/qa/qa/specs/features/browser_ui/1_manage/project/project_owner_permissions_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/project/project_owner_permissions_spec.rb index 29e590976d2..98a08dd0d9a 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/project/project_owner_permissions_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/project/project_owner_permissions_spec.rb @@ -2,7 +2,7 @@ module QA RSpec.describe 'Manage' do - describe 'Project owner permissions', :reliable do + describe 'Project owner permissions', :reliable, product_group: :workspace do let!(:owner) do Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_1, Runtime::Env.gitlab_qa_password_1) end diff --git a/qa/qa/specs/features/browser_ui/1_manage/project/view_project_activity_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/project/view_project_activity_spec.rb index 88f4996ff03..33ca5f6009c 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/project/view_project_activity_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/project/view_project_activity_spec.rb @@ -2,7 +2,7 @@ module QA RSpec.describe 'Manage' do - describe 'Project activity', :reliable do + describe 'Project activity', :reliable, product_group: :workspace do it 'user creates an event in the activity page upon Git push', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347879' do Flow::Login.sign_in diff --git a/qa/qa/specs/features/browser_ui/1_manage/user/follow_user_activity_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/user/follow_user_activity_spec.rb index a384dc16064..b9b82baa6f1 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/user/follow_user_activity_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/user/follow_user_activity_spec.rb @@ -2,7 +2,7 @@ module QA RSpec.describe 'Manage' do - describe 'User', :requires_admin do + describe 'User', :requires_admin, product_group: :workspace do let(:admin_api_client) { Runtime::API::Client.as_admin } let(:followed_user_api_client) { Runtime::API::Client.new(:gitlab, user: followed_user) } diff --git a/qa/qa/specs/features/browser_ui/1_manage/user/user_access_termination_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/user/parent_group_access_termination_spec.rb index 8462f5db30b..54f05f84dca 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/user/user_access_termination_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/user/parent_group_access_termination_spec.rb @@ -2,7 +2,7 @@ module QA RSpec.describe 'Manage' do - describe 'User', :requires_admin, :reliable do + describe 'User', :requires_admin, :reliable, product_group: :workspace do let(:admin_api_client) { Runtime::API::Client.as_admin } let!(:user) do @@ -27,7 +27,7 @@ module QA end end - context 'after parent group membership termination' do + context 'for after parent group membership termination' do before do Flow::Login.while_signed_in_as_admin do group.sandbox.visit! @@ -39,7 +39,14 @@ module QA end end - it 'is not allowed to edit the project files', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347866' do + after do + user.remove_via_api! + project.remove_via_api! + group.remove_via_api! + end + + it 'is not allowed to edit the project files', + testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347866' do Flow::Login.sign_in(as: user) project.visit! @@ -51,12 +58,6 @@ module QA expect(page).to have_text("You can’t edit files directly in this project.") end - - after do - user.remove_via_api! - project.remove_via_api! - group.remove_via_api! - end end end end diff --git a/qa/qa/specs/features/browser_ui/1_manage/user/user_inherited_access_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/user/user_inherited_access_spec.rb index 8de9d7c2049..b7585f00630 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/user/user_inherited_access_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/user/user_inherited_access_spec.rb @@ -2,7 +2,7 @@ module QA RSpec.describe 'Manage' do - describe 'User', :requires_admin do + describe 'User', :requires_admin, product_group: :workspace do let(:admin_api_client) { Runtime::API::Client.as_admin } let!(:sub_group) do diff --git a/qa/qa/specs/features/browser_ui/2_plan/issue/custom_issue_template_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/issue/custom_issue_template_spec.rb index 206e6b8a456..b2c612d38fe 100644 --- a/qa/qa/specs/features/browser_ui/2_plan/issue/custom_issue_template_spec.rb +++ b/qa/qa/specs/features/browser_ui/2_plan/issue/custom_issue_template_spec.rb @@ -19,12 +19,13 @@ module QA Resource::Repository::Commit.fabricate_via_api! do |commit| commit.project = template_project commit.commit_message = 'Add custom issue template' - commit.add_files([ - { - file_path: ".gitlab/issue_templates/#{template_name}.md", - content: template_content - } - ]) + commit.add_files( + [ + { + file_path: ".gitlab/issue_templates/#{template_name}.md", + content: template_content + } + ]) end end diff --git a/qa/qa/specs/features/browser_ui/3_create/merge_request/cherry_pick/cherry_pick_commit_spec.rb b/qa/qa/specs/features/browser_ui/3_create/merge_request/cherry_pick/cherry_pick_commit_spec.rb index a1d8b495129..d6e9c1a13df 100644 --- a/qa/qa/specs/features/browser_ui/3_create/merge_request/cherry_pick/cherry_pick_commit_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/merge_request/cherry_pick/cherry_pick_commit_spec.rb @@ -18,9 +18,7 @@ module QA commit.branch = "development" commit.start_branch = project.default_branch commit.commit_message = 'Add new file' - commit.add_files([ - { file_path: file_name, content: 'pssst!' } - ]) + commit.add_files([{ file_path: file_name, content: 'pssst!' }]) end end 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 6ce4217f8ac..d975e18e962 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 @@ -20,12 +20,13 @@ module QA Resource::Repository::Commit.fabricate_via_api! do |commit| commit.project = template_project commit.commit_message = 'Add custom merge request template' - commit.add_files([ - { - file_path: ".gitlab/merge_request_templates/#{template_name}.md", - content: template_content - } - ]) + commit.add_files( + [ + { + file_path: ".gitlab/merge_request_templates/#{template_name}.md", + content: template_content + } + ]) end end 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 8885163b5e3..205ff12ff03 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 @@ -16,9 +16,7 @@ module QA Resource::Repository::Commit.fabricate_via_api! do |commit| commit.project = project commit.commit_message = 'Add new file' - commit.add_files([ - { file_path: file_name, content: 'pssst!' } - ]) + commit.add_files([{ file_path: file_name, content: 'pssst!' }]) end end diff --git a/qa/qa/specs/features/browser_ui/3_create/project_wiki/project_based_content_creation_spec.rb b/qa/qa/specs/features/browser_ui/3_create/project_wiki/project_based_content_creation_spec.rb new file mode 100644 index 00000000000..37e737a4f84 --- /dev/null +++ b/qa/qa/specs/features/browser_ui/3_create/project_wiki/project_based_content_creation_spec.rb @@ -0,0 +1,95 @@ +# frozen_string_literal: true + +module QA + RSpec.describe 'Create' do + describe 'Testing wiki content creation inside a project' do + let(:new_wiki_title) { "just_another_wiki_page" } + let(:new_wiki_content) { "this content is changed or added" } + let(:commit_message) { "this is a new addition to the wiki" } + + let(:project) { Resource::Project.fabricate_via_api! } + let(:wiki) { Resource::Wiki::ProjectPage.fabricate_via_api! } + + before do + Flow::Login.sign_in + end + + it 'by adding a home page to the wiki', +testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347809' do + project.visit! + + Page::Project::Menu.perform(&:click_wiki) + Page::Project::Wiki::Show.perform(&:click_create_your_first_page) + + Page::Project::Wiki::Edit.perform do |edit| + edit.set_title new_wiki_title + edit.set_content new_wiki_content + edit.set_message commit_message + end + + Page::Project::Wiki::Edit.perform(&:click_submit) + + Page::Project::Wiki::Show.perform do |wiki| + expect(wiki).to have_title new_wiki_title + expect(wiki).to have_content new_wiki_content + end + end + + it 'by adding a second page to the wiki', +testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347808' do + wiki.visit! + + Page::Project::Wiki::Show.perform(&:click_new_page) + + Page::Project::Wiki::Edit.perform do |edit| + edit.set_title new_wiki_title + edit.set_content new_wiki_content + edit.set_message commit_message + end + + Page::Project::Wiki::Edit.perform(&:click_submit) + + Page::Project::Wiki::Show.perform do |wiki| + expect(wiki).to have_title new_wiki_title + expect(wiki).to have_content new_wiki_content + end + end + + it 'by adding a home page to the wiki using git push', +testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347806' do + empty_wiki = Resource::Wiki::ProjectPage.new do |empty_wiki| + empty_wiki.project = project + end + + Resource::Repository::WikiPush.fabricate! do |push| + push.file_name = "#{new_wiki_title}.md" + push.file_content = new_wiki_content + push.commit_message = commit_message + push.wiki = empty_wiki + push.new_branch = true + end.visit! + + Page::Project::Wiki::Show.perform do |wiki| + expect(wiki).to have_title new_wiki_title + expect(wiki).to have_content new_wiki_content + end + end + + it 'by adding a second page to the wiki using git push', +testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347807' do + Resource::Repository::WikiPush.fabricate! do |push| + push.file_name = "#{new_wiki_title}.md" + push.file_content = new_wiki_content + push.commit_message = commit_message + push.wiki = wiki + push.new_branch = false + end.visit! + + Page::Project::Wiki::Show.perform do |wiki| + expect(wiki).to have_title new_wiki_title + expect(wiki).to have_content new_wiki_content + end + end + end + end +end diff --git a/qa/qa/specs/features/browser_ui/3_create/project_wiki/project_based_content_manipulation_spec.rb b/qa/qa/specs/features/browser_ui/3_create/project_wiki/project_based_content_manipulation_spec.rb new file mode 100644 index 00000000000..a4bdb0193dd --- /dev/null +++ b/qa/qa/specs/features/browser_ui/3_create/project_wiki/project_based_content_manipulation_spec.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +module QA + RSpec.describe 'Create' do + describe 'Testing wiki content manipulation inside a project' do + let(:new_wiki_title) { "just_another_wiki_page" } + let(:new_wiki_content) { "this content is changed or added" } + let(:commit_message) { "this is a new addition to the wiki" } + + let(:wiki) { Resource::Wiki::ProjectPage.fabricate_via_api! } + + before do + Flow::Login.sign_in + end + + it 'by manipulating content on the page', +testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347810' do + wiki.visit! + + Page::Project::Wiki::Show.perform(&:click_edit) + + Page::Project::Wiki::Edit.perform do |edit| + edit.set_title new_wiki_title + edit.set_content new_wiki_content + edit.set_message commit_message + end + + Page::Project::Wiki::Edit.perform(&:click_submit) + + Page::Project::Wiki::Show.perform do |wiki| + expect(wiki).to have_title new_wiki_title + expect(wiki).to have_content new_wiki_content + end + end + + it 'by manipulating content on the page using git push', +testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347811' do + Resource::Repository::WikiPush.fabricate! do |push| + push.file_content = new_wiki_content + push.commit_message = commit_message + push.wiki = wiki + push.new_branch = false + end.visit! + + Page::Project::Wiki::Show.perform do |wiki| + expect(wiki).to have_content new_wiki_content + end + end + end + end +end diff --git a/qa/qa/specs/features/browser_ui/3_create/wiki/project_based_directory_management_spec.rb b/qa/qa/specs/features/browser_ui/3_create/project_wiki/project_based_directory_management_spec.rb index 2d24f69c883..0af964fc4bf 100644 --- a/qa/qa/specs/features/browser_ui/3_create/wiki/project_based_directory_management_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/project_wiki/project_based_directory_management_spec.rb @@ -2,7 +2,7 @@ module QA RSpec.describe 'Create' do - context 'Wiki' do + describe 'A project wiki' do let(:initial_wiki) { Resource::Wiki::ProjectPage.fabricate_via_api! } let(:new_path) { "a/new/path-with-spaces" } @@ -10,7 +10,8 @@ module QA Flow::Login.sign_in end - it 'has changed the directory', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347821' do + it 'can change the directory path of a page', +testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347821' do initial_wiki.visit! Page::Project::Wiki::Show.perform(&:click_edit) diff --git a/qa/qa/specs/features/browser_ui/3_create/wiki/content_editor_spec.rb b/qa/qa/specs/features/browser_ui/3_create/project_wiki/project_based_file_upload_spec.rb index 4b8edf8b792..361fc459d54 100644 --- a/qa/qa/specs/features/browser_ui/3_create/wiki/content_editor_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/project_wiki/project_based_file_upload_spec.rb @@ -2,7 +2,7 @@ module QA RSpec.describe 'Create', :reliable do - context 'Content Editor' do + describe 'Testing project wiki file upload' do let(:initial_wiki) { Resource::Wiki::ProjectPage.fabricate_via_api! } let(:page_title) { 'Content Editor Page' } let(:heading_text) { 'My New Heading' } @@ -16,7 +16,8 @@ module QA initial_wiki.project.remove_via_api! end - it 'creates a formatted Wiki page with an image uploaded', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347640' do + it 'by creating a formatted page with an image uploaded', + testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347640' do initial_wiki.visit! Page::Project::Wiki::Show.perform(&:click_new_page) diff --git a/qa/qa/specs/features/browser_ui/3_create/wiki/project_based_list_spec.rb b/qa/qa/specs/features/browser_ui/3_create/project_wiki/project_based_list_spec.rb index 703d425079d..5c9b97659a7 100644 --- a/qa/qa/specs/features/browser_ui/3_create/wiki/project_based_list_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/project_wiki/project_based_list_spec.rb @@ -2,7 +2,7 @@ module QA RSpec.describe 'Create' do - context 'Wiki' do + describe 'Project Wiki' do let(:small_number_of_pages) { 5 } let(:large_number_of_pages) { 15 } let(:random_page) { "bulk_#{rand(0..4)}" } @@ -14,8 +14,9 @@ module QA Flow::Login.sign_in end - context 'Sidebar' do - it 'has all expected links that work', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347814' do + context 'with Wiki Sidebar' do + it 'has all expected links that work', + testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347814' do small_wiki.visit! small_number_of_pages.times do |index| @@ -34,8 +35,9 @@ module QA end end - context 'Page List' do - it 'has all expected links that work', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347813' do + context 'with Wiki Page List' do + it 'has all expected links that work', + testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347813' do large_wiki.visit! Page::Project::Wiki::Show.perform(&:click_view_all_pages) diff --git a/qa/qa/specs/features/browser_ui/3_create/project_wiki/project_based_page_deletion_spec.rb b/qa/qa/specs/features/browser_ui/3_create/project_wiki/project_based_page_deletion_spec.rb new file mode 100644 index 00000000000..13e04180ab5 --- /dev/null +++ b/qa/qa/specs/features/browser_ui/3_create/project_wiki/project_based_page_deletion_spec.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +module QA + RSpec.describe 'Create' do + describe 'Testing project wiki' + let(:initial_wiki) { Resource::Wiki::ProjectPage.fabricate_via_api! } + + before do + Flow::Login.sign_in + end + + it 'can delete a page', + testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347815' do + initial_wiki.visit! + + Page::Project::Wiki::Show.perform(&:click_edit) + Page::Project::Wiki::Edit.perform(&:delete_page) + + Page::Project::Wiki::Show.perform do |wiki| + expect(wiki).to have_no_page + end + end + end +end diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/branch_with_unusual_name_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/branch_with_unusual_name_spec.rb index aa332a76c94..0503b1b3761 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/branch_with_unusual_name_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/branch_with_unusual_name_spec.rb @@ -22,9 +22,7 @@ module QA commit.branch = branch_name commit.start_branch = project.default_branch commit.commit_message = 'Add new file' - commit.add_files([ - { file_path: 'test-folder/test-file.md', content: 'new content' } - ]) + commit.add_files([{ file_path: 'test-folder/test-file.md', content: 'new content' }]) end project.visit! diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/license_detecton_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/license_detection_spec.rb index 1ae1dd87c07..50df8afafaf 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/license_detecton_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/license_detection_spec.rb @@ -33,11 +33,11 @@ module QA end end - context 'on a project with a less commonly used LICENSE', + context 'on a project with an unrecognized LICENSE', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/366843' do it_behaves_like 'project license detection' do - let(:license_file_name) { 'GFDL-1.2-only' } - let(:rendered_license_name) { 'Other' } + let(:license_file_name) { 'other' } + let(:rendered_license_name) { 'LICENSE' } end end end diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/protected_tags_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/protected_tags_spec.rb index 65a15ce96a5..f4ca7955a0f 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/protected_tags_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/protected_tags_spec.rb @@ -31,7 +31,6 @@ module QA Page::Project::Tag::Show.perform do |show| expect(show).to have_tag_name(tag_name) expect(show).to have_tag_message(tag_message) - expect(show).to have_tag_release_notes(tag_release_notes) expect(show).not_to have_element(:create_tag_button) end end @@ -83,7 +82,6 @@ module QA Page::Project::Tag::New.perform do |new_tag| new_tag.fill_tag_name(name) new_tag.fill_tag_message(message) - new_tag.fill_release_notes(release_notes) new_tag.click_create_tag_button end end diff --git a/qa/qa/specs/features/browser_ui/3_create/web_ide/add_new_directory_in_web_ide_spec.rb b/qa/qa/specs/features/browser_ui/3_create/web_ide/add_new_directory_in_web_ide_spec.rb index 9735aa7959a..561a5a2cc1c 100644 --- a/qa/qa/specs/features/browser_ui/3_create/web_ide/add_new_directory_in_web_ide_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/web_ide/add_new_directory_in_web_ide_spec.rb @@ -22,12 +22,13 @@ module QA before do Resource::Repository::Commit.fabricate_via_api! do |commit| commit.project = project - commit.add_files([ - { - file_path: 'first_directory/test_file.txt', - content: "Test file content" - } - ]) + commit.add_files( + [ + { + file_path: 'first_directory/test_file.txt', + content: "Test file content" + } + ]) end project.visit! diff --git a/qa/qa/specs/features/browser_ui/3_create/web_ide/open_web_ide_from_diff_tab_spec.rb b/qa/qa/specs/features/browser_ui/3_create/web_ide/open_web_ide_from_diff_tab_spec.rb index fc5754e2c7a..f03c651992c 100644 --- a/qa/qa/specs/features/browser_ui/3_create/web_ide/open_web_ide_from_diff_tab_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/web_ide/open_web_ide_from_diff_tab_spec.rb @@ -4,18 +4,18 @@ module QA RSpec.describe 'Create' do describe 'Open Web IDE from Diff Tab' do files = [ - { - file_path: 'file1', - content: 'test1' - }, - { - file_path: 'file2', - content: 'test2' - }, - { - file_path: 'file3', - content: 'test3' - } + { + file_path: 'file1', + content: 'test1' + }, + { + file_path: 'file2', + content: 'test2' + }, + { + file_path: 'file3', + content: 'test3' + } ] let(:project) do diff --git a/qa/qa/specs/features/browser_ui/3_create/wiki/project_based_content_creation_spec.rb b/qa/qa/specs/features/browser_ui/3_create/wiki/project_based_content_creation_spec.rb deleted file mode 100644 index 648ef513e12..00000000000 --- a/qa/qa/specs/features/browser_ui/3_create/wiki/project_based_content_creation_spec.rb +++ /dev/null @@ -1,93 +0,0 @@ -# frozen_string_literal: true - -module QA - RSpec.describe 'Create' do - context 'Wiki' do - describe 'testing wiki content creation inside a project' do - let(:new_wiki_title) { "just_another_wiki_page" } - let(:new_wiki_content) { "this content is changed or added" } - let(:commit_message) { "this is a new addition to the wiki" } - - let(:project) { Resource::Project.fabricate_via_api! } - let(:wiki) { Resource::Wiki::ProjectPage.fabricate_via_api! } - - before do - Flow::Login.sign_in - end - - it 'by adding a home page to the wiki', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347809' do - project.visit! - - Page::Project::Menu.perform(&:click_wiki) - Page::Project::Wiki::Show.perform(&:click_create_your_first_page) - - Page::Project::Wiki::Edit.perform do |edit| - edit.set_title new_wiki_title - edit.set_content new_wiki_content - edit.set_message commit_message - end - - Page::Project::Wiki::Edit.perform(&:click_submit) - - Page::Project::Wiki::Show.perform do |wiki| - expect(wiki).to have_title new_wiki_title - expect(wiki).to have_content new_wiki_content - end - end - - it 'by adding a second page to the wiki', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347808' do - wiki.visit! - - Page::Project::Wiki::Show.perform(&:click_new_page) - - Page::Project::Wiki::Edit.perform do |edit| - edit.set_title new_wiki_title - edit.set_content new_wiki_content - edit.set_message commit_message - end - - Page::Project::Wiki::Edit.perform(&:click_submit) - - Page::Project::Wiki::Show.perform do |wiki| - expect(wiki).to have_title new_wiki_title - expect(wiki).to have_content new_wiki_content - end - end - - it 'by adding a home page to the wiki using git push', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347806' do - empty_wiki = Resource::Wiki::ProjectPage.new do |empty_wiki| - empty_wiki.project = project - end - - Resource::Repository::WikiPush.fabricate! do |push| - push.file_name = "#{new_wiki_title}.md" - push.file_content = new_wiki_content - push.commit_message = commit_message - push.wiki = empty_wiki - push.new_branch = true - end.visit! - - Page::Project::Wiki::Show.perform do |wiki| - expect(wiki).to have_title new_wiki_title - expect(wiki).to have_content new_wiki_content - end - end - - it 'by adding a second page to the wiki using git push', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347807' do - Resource::Repository::WikiPush.fabricate! do |push| - push.file_name = "#{new_wiki_title}.md" - push.file_content = new_wiki_content - push.commit_message = commit_message - push.wiki = wiki - push.new_branch = false - end.visit! - - Page::Project::Wiki::Show.perform do |wiki| - expect(wiki).to have_title new_wiki_title - expect(wiki).to have_content new_wiki_content - end - end - end - end - end -end diff --git a/qa/qa/specs/features/browser_ui/3_create/wiki/project_based_content_manipulation_spec.rb b/qa/qa/specs/features/browser_ui/3_create/wiki/project_based_content_manipulation_spec.rb deleted file mode 100644 index 251728c149f..00000000000 --- a/qa/qa/specs/features/browser_ui/3_create/wiki/project_based_content_manipulation_spec.rb +++ /dev/null @@ -1,51 +0,0 @@ -# frozen_string_literal: true - -module QA - RSpec.describe 'Create' do - context 'Wiki' do - describe 'testing wiki content manipulation inside a project' do - let(:new_wiki_title) { "just_another_wiki_page" } - let(:new_wiki_content) { "this content is changed or added" } - let(:commit_message) { "this is a new addition to the wiki" } - - let(:wiki) { Resource::Wiki::ProjectPage.fabricate_via_api! } - - before do - Flow::Login.sign_in - end - - it 'by manipulating content on the page', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347810' do - wiki.visit! - - Page::Project::Wiki::Show.perform(&:click_edit) - - Page::Project::Wiki::Edit.perform do |edit| - edit.set_title new_wiki_title - edit.set_content new_wiki_content - edit.set_message commit_message - end - - Page::Project::Wiki::Edit.perform(&:click_submit) - - Page::Project::Wiki::Show.perform do |wiki| - expect(wiki).to have_title new_wiki_title - expect(wiki).to have_content new_wiki_content - end - end - - it 'by manipulating content on the page using git push', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347811' do - Resource::Repository::WikiPush.fabricate! do |push| - push.file_content = new_wiki_content - push.commit_message = commit_message - push.wiki = wiki - push.new_branch = false - end.visit! - - Page::Project::Wiki::Show.perform do |wiki| - expect(wiki).to have_content new_wiki_content - end - end - end - end - end -end diff --git a/qa/qa/specs/features/browser_ui/3_create/wiki/project_based_page_deletion_spec.rb b/qa/qa/specs/features/browser_ui/3_create/wiki/project_based_page_deletion_spec.rb deleted file mode 100644 index 78d6d51f260..00000000000 --- a/qa/qa/specs/features/browser_ui/3_create/wiki/project_based_page_deletion_spec.rb +++ /dev/null @@ -1,26 +0,0 @@ -# frozen_string_literal: true - -module QA - RSpec.describe 'Create' do - context 'Wiki' do - let(:initial_wiki) { Resource::Wiki::ProjectPage.fabricate_via_api! } - - before do - Flow::Login.sign_in - end - - context 'Page deletion' do - it 'has removed the deleted page correctly', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347815' do - initial_wiki.visit! - - Page::Project::Wiki::Show.perform(&:click_edit) - Page::Project::Wiki::Edit.perform(&:delete_page) - - Page::Project::Wiki::Show.perform do |wiki| - expect(wiki).to have_no_page - end - end - end - end - 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 078465770c6..222d1993bf4 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 @@ -51,16 +51,11 @@ module QA commit.project = package_project commit.commit_message = 'Add .gitlab-ci.yml' - commit.add_files([ - { - file_path: '.gitlab-ci.yml', - content: helm_upload_yaml - }, - { - file_path: 'Chart.yaml', - content: helm_chart_yaml - } - ]) + commit.add_files( + [ + { file_path: '.gitlab-ci.yml', content: helm_upload_yaml }, + { file_path: 'Chart.yaml', content: helm_chart_yaml } + ]) end end @@ -94,12 +89,7 @@ module QA commit.project = client_project commit.commit_message = 'Add .gitlab-ci.yml' - commit.add_files([ - { - file_path: '.gitlab-ci.yml', - content: helm_install_yaml - } - ]) + commit.add_files([{ file_path: '.gitlab-ci.yml', content: helm_install_yaml }]) end end diff --git a/qa/qa/specs/features/browser_ui/5_package/package_registry/maven/maven_group_level_spec.rb b/qa/qa/specs/features/browser_ui/5_package/package_registry/maven/maven_group_level_spec.rb index 921b36b34af..690451f6147 100644 --- a/qa/qa/specs/features/browser_ui/5_package/package_registry/maven/maven_group_level_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/package_registry/maven/maven_group_level_spec.rb @@ -48,26 +48,18 @@ module QA it 'pushes and pulls a maven package', testcase: params[:testcase] do Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do Resource::Repository::Commit.fabricate_via_api! do |commit| - maven_upload_package_yaml = ERB.new(read_fixture('package_managers/maven', 'maven_upload_package.yaml.erb')).result(binding) - package_pom_xml = ERB.new(read_fixture('package_managers/maven', 'package_pom.xml.erb')).result(binding) - settings_xml = ERB.new(read_fixture('package_managers/maven', 'settings.xml.erb')).result(binding) + gitlab_ci_yaml = ERB.new(read_fixture('package_managers/maven/group/producer', 'gitlab_ci.yaml.erb')).result(binding) + pom_xml = ERB.new(read_fixture('package_managers/maven/group/producer', 'pom.xml.erb')).result(binding) + settings_xml = ERB.new(read_fixture('package_managers/maven/group/producer', 'settings.xml.erb')).result(binding) commit.project = package_project commit.commit_message = 'Add files' - commit.add_files([ - { - file_path: '.gitlab-ci.yml', - content: maven_upload_package_yaml - }, - { - file_path: 'pom.xml', - content: package_pom_xml - }, - { - file_path: 'settings.xml', - content: settings_xml - } - ]) + commit.add_files( + [ + { file_path: '.gitlab-ci.yml', content: gitlab_ci_yaml }, + { file_path: 'pom.xml', content: pom_xml }, + { file_path: 'settings.xml', content: settings_xml } + ]) end end @@ -97,26 +89,18 @@ module QA Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do Resource::Repository::Commit.fabricate_via_api! do |commit| - maven_install_package_yaml = ERB.new(read_fixture('package_managers/maven', 'maven_install_package.yaml.erb')).result(binding) - client_pom_xml = ERB.new(read_fixture('package_managers/maven', 'client_pom.xml.erb')).result(binding) - settings_xml = ERB.new(read_fixture('package_managers/maven', 'settings.xml.erb')).result(binding) + gitlab_ci_yaml = ERB.new(read_fixture('package_managers/maven/group/consumer', 'gitlab_ci.yaml.erb')).result(binding) + pom_xml = ERB.new(read_fixture('package_managers/maven/group/consumer', 'pom.xml.erb')).result(binding) + settings_xml = ERB.new(read_fixture('package_managers/maven/group/consumer', 'settings.xml.erb')).result(binding) commit.project = client_project commit.commit_message = 'Add files' - commit.add_files([ - { - file_path: '.gitlab-ci.yml', - content: maven_install_package_yaml - }, - { - file_path: 'pom.xml', - content: client_pom_xml - }, - { - file_path: 'settings.xml', - content: settings_xml - } - ]) + commit.add_files( + [ + { file_path: '.gitlab-ci.yml', content: gitlab_ci_yaml }, + { file_path: 'pom.xml', content: pom_xml }, + { file_path: 'settings.xml', content: settings_xml } + ]) end end @@ -143,123 +127,57 @@ module QA end context 'when disabled' do - where do - { - 'using a personal access token' => { - authentication_token_type: :personal_access_token, - maven_header_name: 'Private-Token', - testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347581' - }, - 'using a project deploy token' => { - authentication_token_type: :project_deploy_token, - maven_header_name: 'Deploy-Token', - testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347584' - }, - 'using a ci job token' => { - authentication_token_type: :ci_job_token, - maven_header_name: 'Job-Token', - testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347578' - } - } + before do + Page::Group::Settings::PackageRegistries.perform(&:set_allow_duplicates_disabled) end - with_them do - let(:token) do - case authentication_token_type - when :personal_access_token - personal_access_token - when :ci_job_token - '${env.CI_JOB_TOKEN}' - when :project_deploy_token - project_deploy_token.token - end - end + it 'prevents users from publishing duplicates' do + create_duplicated_package - before do - Page::Group::Settings::PackageRegistries.perform(&:set_allow_duplicates_disabled) - end + push_duplicated_package - it 'prevents users from publishing group level Maven packages duplicates', testcase: params[:testcase] do - create_duplicated_package - - push_duplicated_package - - client_project.visit! + client_project.visit! - show_latest_deploy_job + show_latest_deploy_job - Page::Project::Job::Show.perform do |job| - expect(job).not_to be_successful(timeout: 800) - end + Page::Project::Job::Show.perform do |job| + expect(job).not_to be_successful(timeout: 800) end end end context 'when enabled' do - where do - { - 'using a personal access token' => { - authentication_token_type: :personal_access_token, - maven_header_name: 'Private-Token', - testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347580' - }, - 'using a project deploy token' => { - authentication_token_type: :project_deploy_token, - maven_header_name: 'Deploy-Token', - testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347583' - }, - 'using a ci job token' => { - authentication_token_type: :ci_job_token, - maven_header_name: 'Job-Token', - testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347577' - } - } + before do + Page::Group::Settings::PackageRegistries.perform(&:set_allow_duplicates_enabled) end - with_them do - let(:token) do - case authentication_token_type - when :personal_access_token - personal_access_token - when :ci_job_token - '${env.CI_JOB_TOKEN}' - when :project_deploy_token - project_deploy_token.token - end - end - - before do - Page::Group::Settings::PackageRegistries.perform(&:set_allow_duplicates_enabled) - end - - it 'allows users to publish group level Maven packages duplicates', testcase: params[:testcase] do - create_duplicated_package + it 'allows users to publish duplicates' do + create_duplicated_package - push_duplicated_package + push_duplicated_package - show_latest_deploy_job + show_latest_deploy_job - Page::Project::Job::Show.perform do |job| - expect(job).to be_successful(timeout: 800) - end + Page::Project::Job::Show.perform do |job| + expect(job).to be_successful(timeout: 800) end end end def create_duplicated_package - settings_xml_with_pat = ERB.new(read_fixture('package_managers/maven', 'settings_with_pat.xml.erb')).result(binding) - package_pom_xml = ERB.new(read_fixture('package_managers/maven', 'package_pom.xml.erb')).result(binding) + settings_xml_with_pat = ERB.new(read_fixture('package_managers/maven/group', 'settings_with_pat.xml.erb')).result(binding) + pom_xml = ERB.new(read_fixture('package_managers/maven/group/producer', 'pom.xml.erb')).result(binding) with_fixtures([ - { - file_path: 'pom.xml', - content: package_pom_xml - }, - { - file_path: 'settings.xml', - content: settings_xml_with_pat - } - ]) do |dir| + { + file_path: 'pom.xml', + content: pom_xml + }, + { + file_path: 'settings.xml', + content: settings_xml_with_pat + } + ]) do |dir| Service::DockerRun::Maven.new(dir).publish! end @@ -275,26 +193,18 @@ module QA def push_duplicated_package Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do Resource::Repository::Commit.fabricate_via_api! do |commit| - maven_upload_package_yaml = ERB.new(read_fixture('package_managers/maven', 'maven_upload_package.yaml.erb')).result(binding) - package_pom_xml = ERB.new(read_fixture('package_managers/maven', 'package_pom.xml.erb')).result(binding) - settings_xml = ERB.new(read_fixture('package_managers/maven', 'settings.xml.erb')).result(binding) + gitlab_ci_yaml = ERB.new(read_fixture('package_managers/maven/group/producer', 'gitlab_ci.yaml.erb')).result(binding) + pom_xml = ERB.new(read_fixture('package_managers/maven/group/producer', 'pom.xml.erb')).result(binding) + settings_xml_with_pat = ERB.new(read_fixture('package_managers/maven/group', 'settings_with_pat.xml.erb')).result(binding) commit.project = client_project commit.commit_message = 'Add .gitlab-ci.yml' - commit.add_files([ - { - file_path: '.gitlab-ci.yml', - content: maven_upload_package_yaml - }, - { - file_path: 'pom.xml', - content: package_pom_xml - }, - { - file_path: 'settings.xml', - content: settings_xml - } - ]) + commit.add_files( + [ + { file_path: '.gitlab-ci.yml', content: gitlab_ci_yaml }, + { file_path: 'pom.xml', content: pom_xml }, + { file_path: 'settings.xml', content: settings_xml_with_pat } + ]) end end end diff --git a/qa/qa/specs/features/browser_ui/5_package/package_registry/maven/maven_project_level_spec.rb b/qa/qa/specs/features/browser_ui/5_package/package_registry/maven/maven_project_level_spec.rb index 13607ba1b41..324e881f160 100644 --- a/qa/qa/specs/features/browser_ui/5_package/package_registry/maven/maven_project_level_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/package_registry/maven/maven_project_level_spec.rb @@ -1,8 +1,14 @@ # frozen_string_literal: true module QA - RSpec.describe 'Package', :orchestrated, :packages, :object_storage, :reliable do + RSpec.describe 'Package', :orchestrated, :packages, :object_storage, :reliable, + feature_flag: { + name: 'maven_central_request_forwarding', + scope: :global + } do describe 'Maven project level endpoint' do + include Runtime::Fixtures + let(:group_id) { 'com.gitlab.qa' } let(:artifact_id) { "maven-#{SecureRandom.hex(8)}" } let(:package_name) { "#{group_id}/#{artifact_id}".tr('.', '/') } @@ -51,54 +57,6 @@ module QA end end - let(:gitlab_ci_file) do - { - file_path: '.gitlab-ci.yml', - content: - <<~YAML - deploy-and-install: - image: maven:3.6-jdk-11 - script: - - 'mvn deploy -s settings.xml' - - 'mvn install -s settings.xml' - only: - - "#{package_project.default_branch}" - tags: - - "runner-for-#{package_project.name}" - YAML - } - end - - let(:pom_file) do - { - file_path: 'pom.xml', - content: <<~XML - <project> - <groupId>#{group_id}</groupId> - <artifactId>#{artifact_id}</artifactId> - <version>#{package_version}</version> - <modelVersion>4.0.0</modelVersion> - <repositories> - <repository> - <id>#{package_project.name}</id> - <url>#{gitlab_address_with_port}/api/v4/projects/#{package_project.id}/-/packages/maven</url> - </repository> - </repositories> - <distributionManagement> - <repository> - <id>#{package_project.name}</id> - <url>#{gitlab_address_with_port}/api/v4/projects/#{package_project.id}/packages/maven</url> - </repository> - <snapshotRepository> - <id>#{package_project.name}</id> - <url>#{gitlab_address_with_port}/api/v4/projects/#{package_project.id}/packages/maven</url> - </snapshotRepository> - </distributionManagement> - </project> - XML - } - end - before do Flow::Login.sign_in_unless_signed_in runner @@ -142,40 +100,24 @@ module QA end end - let(:settings_xml) do - { - file_path: 'settings.xml', - content: <<~XML - <settings xmlns="http://maven.apache.org/SETTINGS/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd"> - <servers> - <server> - <id>#{package_project.name}</id> - <configuration> - <httpHeaders> - <property> - <name>#{maven_header_name}</name> - <value>#{token}</value> - </property> - </httpHeaders> - </configuration> - </server> - </servers> - </settings> - XML - } - end - it 'pushes and pulls a maven package via maven', testcase: params[:testcase] do Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do Resource::Repository::Commit.fabricate_via_api! do |commit| + gitlab_ci_yaml = ERB.new(read_fixture('package_managers/maven/project', 'gitlab_ci.yaml.erb')) + .result(binding) + pom_xml = ERB.new(read_fixture('package_managers/maven/project', 'pom.xml.erb')) + .result(binding) + settings_xml = ERB.new(read_fixture('package_managers/maven/project', 'settings.xml.erb')) + .result(binding) + commit.project = package_project - commit.commit_message = 'Add .gitlab-ci.yml' - commit.add_files([ - gitlab_ci_file, - pom_file, - settings_xml - ]) + commit.commit_message = 'Add files' + commit.add_files( + [ + { file_path: '.gitlab-ci.yml', content: gitlab_ci_yaml }, + { file_path: 'pom.xml', content: pom_xml }, + { file_path: 'settings.xml', content: settings_xml } + ]) end end @@ -184,17 +126,7 @@ module QA Flow::Pipeline.visit_latest_pipeline Page::Project::Pipeline::Show.perform do |pipeline| - pipeline.click_job('deploy') - end - - Page::Project::Job::Show.perform do |job| - expect(job).to be_successful(timeout: 800) - - job.click_element(:pipeline_path) - end - - Page::Project::Pipeline::Show.perform do |pipeline| - pipeline.click_job('install') + pipeline.click_job('deploy-and-install') end Page::Project::Job::Show.perform do |job| @@ -215,5 +147,107 @@ module QA end end end + + describe 'Maven request forwarding' do + include Runtime::Fixtures + + let(:group_id) { 'com.gitlab.qa' } + let(:artifact_id) { "maven-#{SecureRandom.hex(8)}" } + let(:package_name) { "#{group_id}/#{artifact_id}".tr('.', '/') } + let(:package_version) { '1.3.7' } + let(:package_type) { 'maven' } + let(:personal_access_token) { Runtime::Env.personal_access_token } + let(:group) { Resource::Group.fabricate_via_api! } + + let(:gitlab_address_with_port) do + uri = URI.parse(Runtime::Scenario.gitlab_address) + "#{uri.scheme}://#{uri.host}:#{uri.port}" + end + + let(:package) do + Resource::Package.init do |package| + package.name = package_name + package.project = imported_project + end + end + + let(:runner) do + Resource::Runner.fabricate! do |runner| + runner.name = "qa-runner-#{Time.now.to_i}" + runner.tags = ["runner-for-#{imported_project.name}"] + runner.executor = :docker + runner.token = group.reload!.runners_token + end + end + + let(:imported_project) do + Resource::ProjectImportedFromURL.fabricate_via_browser_ui! do |project| + project.name = "#{package_type}_imported_project" + project.group = group + project.gitlab_repository_path = 'https://gitlab.com/gitlab-org/quality/imported-projects/maven.git' + end + end + + before do + Runtime::Feature.enable(:maven_central_request_forwarding) + Flow::Login.sign_in_unless_signed_in + + imported_project + runner + end + + after do + Runtime::Feature.disable(:maven_central_request_forwarding) + + runner.remove_via_api! + package.remove_via_api! + imported_project.remove_via_api! + end + + it( + 'uses GitLab as a mirror of the central proxy', + :skip_live_env, + quarantine: { + issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/378221', + type: :investigating + }, + testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/375767' + ) do + Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do + Resource::Repository::Commit.fabricate_via_api! do |commit| + gitlab_ci_yaml = ERB.new(read_fixture('package_managers/maven/project/request_forwarding', + 'gitlab_ci.yaml.erb' + ) + ) + .result(binding) + settings_xml = ERB.new(read_fixture('package_managers/maven/project/request_forwarding', + 'settings.xml.erb' + ) + ) + .result(binding) + + commit.project = imported_project + commit.commit_message = 'Add files' + commit.add_files( + [ + { file_path: '.gitlab-ci.yml', content: gitlab_ci_yaml }, + { file_path: 'settings.xml', content: settings_xml } + ]) + end + end + + imported_project.visit! + + Flow::Pipeline.visit_latest_pipeline + + Page::Project::Pipeline::Show.perform do |pipeline| + pipeline.click_job('install') + end + + Page::Project::Job::Show.perform do |job| + expect(job).to be_successful(timeout: 800) + end + end + end end end diff --git a/qa/qa/specs/features/browser_ui/5_package/package_registry/maven_gradle_repository_spec.rb b/qa/qa/specs/features/browser_ui/5_package/package_registry/maven_gradle_repository_spec.rb index 45693ecee41..22052aa4110 100644 --- a/qa/qa/specs/features/browser_ui/5_package/package_registry/maven_gradle_repository_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/package_registry/maven_gradle_repository_spec.rb @@ -34,20 +34,15 @@ module QA it 'pushes and pulls a maven package via gradle', testcase: params[:testcase] do Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do Resource::Repository::Commit.fabricate_via_api! do |commit| - gradle_upload_yaml = ERB.new(read_fixture('package_managers/maven', 'gradle_upload_package.yaml.erb')).result(binding) - build_upload_gradle = ERB.new(read_fixture('package_managers/maven', 'build_upload.gradle.erb')).result(binding) + gradle_upload_yaml = ERB.new(read_fixture('package_managers/maven/gradle', 'gradle_upload_package.yaml.erb')).result(binding) + build_upload_gradle = ERB.new(read_fixture('package_managers/maven/gradle', 'build_upload.gradle.erb')).result(binding) commit.project = package_project commit.commit_message = 'Add .gitlab-ci.yml' - commit.add_files([ - { - file_path: '.gitlab-ci.yml', - content: gradle_upload_yaml - }, - { - file_path: 'build.gradle', - content: build_upload_gradle - } + commit.add_files( + [ + { file_path: '.gitlab-ci.yml', content: gradle_upload_yaml }, + { file_path: 'build.gradle', content: build_upload_gradle } ]) end end @@ -78,21 +73,16 @@ module QA Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do Resource::Repository::Commit.fabricate_via_api! do |commit| - gradle_install_yaml = ERB.new(read_fixture('package_managers/maven', 'gradle_install_package.yaml.erb')).result(binding) - build_install_gradle = ERB.new(read_fixture('package_managers/maven', 'build_install.gradle.erb')).result(binding) + gradle_install_yaml = ERB.new(read_fixture('package_managers/maven/gradle', 'gradle_install_package.yaml.erb')).result(binding) + build_install_gradle = ERB.new(read_fixture('package_managers/maven/gradle', 'build_install.gradle.erb')).result(binding) commit.project = client_project commit.commit_message = 'Add files' - commit.add_files([ - { - file_path: '.gitlab-ci.yml', - content: gradle_install_yaml - }, - { - file_path: 'build.gradle', - content: build_install_gradle - } - ]) + commit.add_files( + [ + { file_path: '.gitlab-ci.yml', content: gradle_install_yaml }, + { file_path: 'build.gradle', content: build_install_gradle } + ]) 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 f229f30facc..e2a7006249d 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 @@ -105,14 +105,7 @@ module QA nuget_upload_yaml = ERB.new(read_fixture('package_managers/nuget', 'nuget_upload_package.yaml.erb')).result(binding) commit.project = project commit.commit_message = 'Add .gitlab-ci.yml' - commit.update_files( - [ - { - file_path: '.gitlab-ci.yml', - content: nuget_upload_yaml - } - ] - ) + commit.update_files([{ file_path: '.gitlab-ci.yml', content: nuget_upload_yaml }]) end end @@ -137,9 +130,9 @@ module QA commit.commit_message = 'Add new csproj file' commit.add_files( [ - { - file_path: 'otherdotnet.csproj', - content: <<~EOF + { + file_path: 'otherdotnet.csproj', + content: <<~EOF <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> @@ -148,18 +141,11 @@ module QA </PropertyGroup> </Project> - EOF - } - ] - ) - commit.update_files( - [ - { - file_path: '.gitlab-ci.yml', - content: nuget_install_yaml - } + EOF + } ] ) + commit.update_files([{ file_path: '.gitlab-ci.yml', content: nuget_install_yaml }]) 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 e70b95db1a5..620bb7e4988 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 @@ -101,9 +101,9 @@ module QA commit.commit_message = 'Add files' commit.update_files( [ - { - file_path: '.gitlab-ci.yml', - content: <<~YAML + { + file_path: '.gitlab-ci.yml', + content: <<~YAML stages: - deploy - install @@ -132,11 +132,11 @@ module QA - if: '$CI_COMMIT_BRANCH == "#{project.default_branch}"' tags: - "runner-for-#{project.name}" - YAML - }, - { - file_path: 'dotnetcore.csproj', - content: <<~EOF + YAML + }, + { + file_path: 'dotnetcore.csproj', + content: <<~EOF <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> @@ -145,8 +145,8 @@ module QA </PropertyGroup> </Project> - EOF - } + EOF + } ] ) end diff --git a/qa/qa/specs/features/sanity/framework_spec.rb b/qa/qa/specs/features/sanity/framework_spec.rb index feec56478c0..fa34f525a85 100644 --- a/qa/qa/specs/features/sanity/framework_spec.rb +++ b/qa/qa/specs/features/sanity/framework_spec.rb @@ -6,7 +6,7 @@ module QA it 'succeeds' do Runtime::Browser.visit(:gitlab, Page::Main::Login) - expect(page).to have_text('A complete DevOps platform') + expect(page).to have_text('GitLab') end end diff --git a/qa/qa/specs/qa_deprecation_toolkit_env.rb b/qa/qa/specs/qa_deprecation_toolkit_env.rb index 21ef5a6f229..5224a2e9ae0 100644 --- a/qa/qa/specs/qa_deprecation_toolkit_env.rb +++ b/qa/qa/specs/qa_deprecation_toolkit_env.rb @@ -5,20 +5,24 @@ require 'deprecation_toolkit/rspec' require 'concurrent/utility/monotonic_time' require 'active_support/gem_version' -module QaDeprecationToolkitEnv - # Taken from https://github.com/jeremyevans/ruby-warning/blob/1.1.0/lib/warning.rb#L18 - # rubocop:disable Layout/LineLength - def self.kwargs_warning - %r{warning: (?:Using the last argument (?:for `.+' )?as keyword parameters is deprecated; maybe \*\* should be added to the call|Passing the keyword argument (?:for `.+' )?as the last hash parameter is deprecated|Splitting the last argument (?:for `.+' )?into positional and keyword parameters is deprecated|The called method (?:`.+' )?is defined here)\n\z} - end - # rubocop:enable Layout/LineLength +module QA + module Specs + class QaDeprecationToolkitEnv + # Taken from https://github.com/jeremyevans/ruby-warning/blob/1.1.0/lib/warning.rb#L18 + # rubocop:disable Layout/LineLength + def self.kwargs_warning + %r{warning: (?:Using the last argument (?:for `.+' )?as keyword parameters is deprecated; maybe \*\* should be added to the call|Passing the keyword argument (?:for `.+' )?as the last hash parameter is deprecated|Splitting the last argument (?:for `.+' )?into positional and keyword parameters is deprecated|The called method (?:`.+' )?is defined here)\n\z} + end + # rubocop:enable Layout/LineLength - def self.configure! - # Enable ruby deprecations for keywords, it's suppressed by default in Ruby 2.7 - Warning[:deprecated] = true + def self.configure! + # Enable ruby deprecations for keywords, it's suppressed by default in Ruby 2.7 + Warning[:deprecated] = true - DeprecationToolkit::Configuration.test_runner = :rspec - DeprecationToolkit::Configuration.deprecation_path = 'deprecations' - DeprecationToolkit::Configuration.warnings_treated_as_deprecation = [kwargs_warning] + DeprecationToolkit::Configuration.test_runner = :rspec + DeprecationToolkit::Configuration.deprecation_path = 'deprecations' + DeprecationToolkit::Configuration.warnings_treated_as_deprecation = [kwargs_warning] + end + end end end diff --git a/qa/qa/specs/spec_helper.rb b/qa/qa/specs/spec_helper.rb index b9e67c2fa72..97901042883 100644 --- a/qa/qa/specs/spec_helper.rb +++ b/qa/qa/specs/spec_helper.rb @@ -2,8 +2,7 @@ require_relative '../../qa' -require_relative 'qa_deprecation_toolkit_env' -QaDeprecationToolkitEnv.configure! +QA::Specs::QaDeprecationToolkitEnv.configure! Knapsack::Adapters::RSpecAdapter.bind if QA::Runtime::Env.knapsack? |