summaryrefslogtreecommitdiff
path: root/qa
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-02-28 18:14:03 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-02-28 18:14:03 +0000
commite804afddbf68cc6f306bc4aa9aaea88be774ebe4 (patch)
tree0ecb2ebf35e16b866b16da375920eb58f6353ef7 /qa
parent8188ca655a7437381491e565406869c747c1b40a (diff)
downloadgitlab-ce-e804afddbf68cc6f306bc4aa9aaea88be774ebe4.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'qa')
-rw-r--r--qa/qa/git/location.rb1
-rw-r--r--qa/qa/specs/features/browser_ui/5_package/package_registry/maven_repository_spec.rb364
-rw-r--r--qa/qa/specs/runner.rb1
3 files changed, 225 insertions, 141 deletions
diff --git a/qa/qa/git/location.rb b/qa/qa/git/location.rb
index 032c6837db1..c3733572e70 100644
--- a/qa/qa/git/location.rb
+++ b/qa/qa/git/location.rb
@@ -9,6 +9,7 @@ module QA
extend Forwardable
attr_reader :git_uri, :uri
+
def_delegators :@uri, :user, :host, :path
# See: config/initializers/1_settings.rb
diff --git a/qa/qa/specs/features/browser_ui/5_package/package_registry/maven_repository_spec.rb b/qa/qa/specs/features/browser_ui/5_package/package_registry/maven_repository_spec.rb
index b4ebb9dd475..ed038c36324 100644
--- a/qa/qa/specs/features/browser_ui/5_package/package_registry/maven_repository_spec.rb
+++ b/qa/qa/specs/features/browser_ui/5_package/package_registry/maven_repository_spec.rb
@@ -13,125 +13,174 @@ module QA
let(:package_version) { '1.3.7' }
let(:package_type) { 'maven' }
- where(:authentication_token_type, :maven_header_name) do
- :personal_access_token | 'Private-Token'
- :ci_job_token | 'Job-Token'
- :project_deploy_token | 'Deploy-Token'
- end
+ context 'via maven' 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/347582'
+ },
+ '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/347585'
+ },
+ '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/347579'
+ }
+ }
+ 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
+ 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
- end
- it "pushes and pulls a maven package via maven using #{params[:authentication_token_type]}" 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)
+ 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)
- 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.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
+ }
+ ])
+ end
end
- end
- package_project.visit!
+ package_project.visit!
- Flow::Pipeline.visit_latest_pipeline
+ Flow::Pipeline.visit_latest_pipeline
- Page::Project::Pipeline::Show.perform do |pipeline|
- pipeline.click_job('deploy')
- end
+ 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)
- end
+ Page::Project::Job::Show.perform do |job|
+ expect(job).to be_successful(timeout: 800)
+ end
- Page::Project::Menu.perform(&:click_packages_link)
+ Page::Project::Menu.perform(&:click_packages_link)
- Page::Project::Packages::Index.perform do |index|
- expect(index).to have_package(package_name)
+ Page::Project::Packages::Index.perform do |index|
+ expect(index).to have_package(package_name)
- index.click_package(package_name)
- end
+ index.click_package(package_name)
+ end
- Page::Project::Packages::Show.perform do |show|
- expect(show).to have_package_info(package_name, package_version)
- end
+ Page::Project::Packages::Show.perform do |show|
+ expect(show).to have_package_info(package_name, package_version)
+ end
- 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)
+ 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)
- 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.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
+ }
+ ])
+ end
end
- end
- client_project.visit!
+ client_project.visit!
- Flow::Pipeline.visit_latest_pipeline
+ Flow::Pipeline.visit_latest_pipeline
- Page::Project::Pipeline::Show.perform do |pipeline|
- pipeline.click_job('install')
- end
+ 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)
+ Page::Project::Job::Show.perform do |job|
+ expect(job).to be_successful(timeout: 800)
+ end
end
end
+ end
- context 'duplication setting' do
- before do
- package_project.group.visit!
+ context 'duplication setting' do
+ before do
+ package_project.group.visit!
- Page::Group::Menu.perform(&:go_to_package_settings)
+ Page::Group::Menu.perform(&:go_to_package_settings)
+ 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'
+ }
+ }
end
- context 'when disabled' do
+ 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_disabled)
end
- it "prevents users from publishing group level Maven packages duplicates using #{params[:authentication_token_type]}" do
+ it 'prevents users from publishing group level Maven packages duplicates', testcase: params[:testcase] do
create_duplicated_package
push_duplicated_package
@@ -145,13 +194,46 @@ module QA
end
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'
+ }
+ }
+ 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
- context 'when enabled' do
before do
Page::Group::Settings::PackageRegistries.perform(&:set_allow_duplicates_enabled)
end
- it "allows users to publish group level Maven packages duplicates using #{params[:authentication_token_type]}" do
+ it 'allows users to publish group level Maven packages duplicates', testcase: params[:testcase] do
create_duplicated_package
push_duplicated_package
@@ -163,68 +245,68 @@ module QA
end
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)
-
- with_fixtures([
- {
- file_path: 'pom.xml',
- content: package_pom_xml
- },
- {
- file_path: 'settings.xml',
- content: settings_xml_with_pat
- }
- ]) do |dir|
- Service::DockerRun::Maven.new(dir).publish!
- 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)
+
+ with_fixtures([
+ {
+ file_path: 'pom.xml',
+ content: package_pom_xml
+ },
+ {
+ file_path: 'settings.xml',
+ content: settings_xml_with_pat
+ }
+ ]) do |dir|
+ Service::DockerRun::Maven.new(dir).publish!
+ end
- package_project.visit!
+ package_project.visit!
- Page::Project::Menu.perform(&:click_packages_link)
+ Page::Project::Menu.perform(&:click_packages_link)
- Page::Project::Packages::Index.perform do |index|
- expect(index).to have_package(package_name)
- end
+ Page::Project::Packages::Index.perform do |index|
+ expect(index).to have_package(package_name)
end
+ end
- 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)
+ 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)
- 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
- }
- ])
- end
+ 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
+ }
+ ])
end
end
+ end
- def show_latest_deploy_job
- client_project.visit!
+ def show_latest_deploy_job
+ client_project.visit!
- Flow::Pipeline.visit_latest_pipeline
+ Flow::Pipeline.visit_latest_pipeline
- Page::Project::Pipeline::Show.perform do |pipeline|
- pipeline.click_job('deploy')
- end
+ Page::Project::Pipeline::Show.perform do |pipeline|
+ pipeline.click_job('deploy')
end
end
end
diff --git a/qa/qa/specs/runner.rb b/qa/qa/specs/runner.rb
index a861c13a44c..026b0ddcd04 100644
--- a/qa/qa/specs/runner.rb
+++ b/qa/qa/specs/runner.rb
@@ -7,6 +7,7 @@ module QA
module Specs
class Runner < Scenario::Template
attr_accessor :tty, :tags, :options
+
RegexMismatchError = Class.new(StandardError)
DEFAULT_TEST_PATH_ARGS = ['--', File.expand_path('./features', __dir__)].freeze