Commit 69a3cc7d authored by Andrejs Cunskis's avatar Andrejs Cunskis

Merge branch 'qa-add-tescase-links-to-maven-repository-spec' into 'master'

Add test case links to maven repository e2e spec

See merge request gitlab-org/gitlab!81315
parents 73d90bcf 73881418
......@@ -13,10 +13,25 @@ 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'
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
......@@ -31,7 +46,7 @@ module QA
end
end
it "pushes and pulls a maven package via maven using #{params[:authentication_token_type]}" do
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)
......@@ -118,6 +133,8 @@ module QA
expect(job).to be_successful(timeout: 800)
end
end
end
end
context 'duplication setting' do
before do
......@@ -127,11 +144,43 @@ 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'
}
}
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_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
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,6 +245,7 @@ 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)
......@@ -229,5 +312,4 @@ module QA
end
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment