diff options
author | Robert Speicher <rspeicher@gmail.com> | 2021-01-20 13:34:23 -0600 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2021-01-20 13:34:23 -0600 |
commit | 6438df3a1e0fb944485cebf07976160184697d72 (patch) | |
tree | 00b09bfd170e77ae9391b1a2f5a93ef6839f2597 /qa/qa/specs/features/browser_ui/5_package/maven_repository_spec.rb | |
parent | 42bcd54d971da7ef2854b896a7b34f4ef8601067 (diff) | |
download | gitlab-ce-6438df3a1e0fb944485cebf07976160184697d72.tar.gz |
Add latest changes from gitlab-org/gitlab@13-8-stable-eev13.8.0-rc42
Diffstat (limited to 'qa/qa/specs/features/browser_ui/5_package/maven_repository_spec.rb')
-rw-r--r-- | qa/qa/specs/features/browser_ui/5_package/maven_repository_spec.rb | 94 |
1 files changed, 74 insertions, 20 deletions
diff --git a/qa/qa/specs/features/browser_ui/5_package/maven_repository_spec.rb b/qa/qa/specs/features/browser_ui/5_package/maven_repository_spec.rb index 5410b5023d9..605248e33f7 100644 --- a/qa/qa/specs/features/browser_ui/5_package/maven_repository_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/maven_repository_spec.rb @@ -22,10 +22,22 @@ module QA end end - it 'publishes a maven package and deletes it', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/943' do + let!(:runner) do + Resource::Runner.fabricate! do |runner| + runner.name = "qa-runner-#{Time.now.to_i}" + runner.tags = ["runner-for-#{project.name}"] + runner.executor = :docker + runner.project = project + end + end + + let!(:gitlab_address_with_port) do uri = URI.parse(Runtime::Scenario.gitlab_address) - gitlab_address_with_port = "#{uri.scheme}://#{uri.host}:#{uri.port}" - pom_xml = { + "#{uri.scheme}://#{uri.host}:#{uri.port}" + end + + let(:pom_xml) do + { file_path: 'pom.xml', content: <<~XML <project> @@ -52,28 +64,33 @@ module QA </project> XML } - settings_xml = { + 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>#{project.name}</id> - <configuration> - <httpHeaders> - <property> - <name>Private-Token</name> - <value>#{auth_token}</value> - </property> - </httpHeaders> - </configuration> - </server> - </servers> - </settings> + <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>#{project.name}</id> + <configuration> + <httpHeaders> + <property> + <name>Private-Token</name> + <value>#{auth_token}</value> + </property> + </httpHeaders> + </configuration> + </server> + </servers> + </settings> XML } + end + it 'publishes a maven package and deletes it', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/943' do # Use a maven docker container to deploy the package with_fixtures([pom_xml, settings_xml]) do |dir| Service::DockerRun::Maven.new(dir).publish! @@ -99,6 +116,43 @@ module QA expect(index).not_to have_package(package_name) end end + + it 'publishes and downloads a maven package via CI', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1115' do + Resource::Repository::Commit.fabricate_via_api! do |commit| + commit.project = project + commit.commit_message = 'Add .gitlab-ci.yml' + commit.add_files([ + { + file_path: '.gitlab-ci.yml', + content: + <<~YAML + deploy: + image: maven:3.6-jdk-11 + script: + - 'mvn deploy -s settings.xml' + - "mvn dependency:get -Dartifact=#{group_id}:#{artifact_id}:1.0" + only: + - "#{project.default_branch}" + tags: + - "runner-for-#{project.name}" + YAML + }, + settings_xml, + pom_xml + ]) + end + + project.visit! + 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) + end + end end end end |