diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-19 08:27:35 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-19 08:27:35 +0000 |
commit | 7e9c479f7de77702622631cff2628a9c8dcbc627 (patch) | |
tree | c8f718a08e110ad7e1894510980d2155a6549197 /qa/qa/specs/features/browser_ui/4_verify/pipeline | |
parent | e852b0ae16db4052c1c567d9efa4facc81146e88 (diff) | |
download | gitlab-ce-7e9c479f7de77702622631cff2628a9c8dcbc627.tar.gz |
Add latest changes from gitlab-org/gitlab@13-6-stable-eev13.6.0-rc42
Diffstat (limited to 'qa/qa/specs/features/browser_ui/4_verify/pipeline')
6 files changed, 346 insertions, 29 deletions
diff --git a/qa/qa/specs/features/browser_ui/4_verify/pipeline/create_and_process_pipeline_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/pipeline/create_and_process_pipeline_spec.rb index 8de739f1559..1e6cb4047f9 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/pipeline/create_and_process_pipeline_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/create_and_process_pipeline_spec.rb @@ -65,8 +65,7 @@ module QA ) end.project.visit! - Page::Project::Menu.perform(&:click_ci_cd_pipelines) - Page::Project::Pipeline::Index.perform(&:click_on_latest_pipeline) + Flow::Pipeline.visit_latest_pipeline { 'test-success': :passed, diff --git a/qa/qa/specs/features/browser_ui/4_verify/pipeline/include_multiple_files_from_a_project_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/pipeline/include_multiple_files_from_a_project_spec.rb new file mode 100644 index 00000000000..cedc2db2a1a --- /dev/null +++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/include_multiple_files_from_a_project_spec.rb @@ -0,0 +1,138 @@ +# frozen_string_literal: true + +require 'faker' + +module QA + RSpec.describe 'Verify', :runner, :requires_admin, :skip_live_env do + describe "Include multiple files from a project" do + let(:feature_flag) { :ci_include_multiple_files_from_project } + let(:executor) { "qa-runner-#{Faker::Alphanumeric.alphanumeric(8)}" } + let(:expected_text) { Faker::Lorem.sentence } + let(:unexpected_text) { Faker::Lorem.sentence } + + let(:project) do + Resource::Project.fabricate_via_api! do |project| + project.name = 'project-with-pipeline-1' + end + end + + let(:other_project) do + Resource::Project.fabricate_via_api! do |project| + project.name = 'project-with-pipeline-2' + end + end + + let!(:runner) do + Resource::Runner.fabricate! do |runner| + runner.project = project + runner.name = executor + runner.tags = [executor] + end + end + + before do + Runtime::Feature.enable(feature_flag) + Flow::Login.sign_in + add_included_files + add_main_ci_file + project.visit! + view_the_last_pipeline + end + + after do + Runtime::Feature.disable(feature_flag) + runner.remove_via_api! + end + + it 'runs the pipeline with composed config', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1082' do + Page::Project::Pipeline::Show.perform do |pipeline| + aggregate_failures 'pipeline has all expected jobs' do + expect(pipeline).to have_job('build') + expect(pipeline).to have_job('test') + expect(pipeline).to have_job('deploy') + end + + pipeline.click_job('test') + end + + Page::Project::Job::Show.perform do |job| + aggregate_failures 'main CI is not overridden' do + expect(job.output).to have_no_content("#{unexpected_text}") + expect(job.output).to have_content("#{expected_text}") + end + end + end + + private + + def add_main_ci_file + Resource::Repository::Commit.fabricate_via_api! do |commit| + commit.project = project + commit.commit_message = 'Add config file' + commit.add_files([main_ci_file]) + end + end + + def add_included_files + Resource::Repository::Commit.fabricate_via_api! do |commit| + commit.project = other_project + commit.commit_message = 'Add files' + commit.add_files([included_file_1, included_file_2]) + end + end + + def view_the_last_pipeline + Page::Project::Menu.perform(&:click_ci_cd_pipelines) + Page::Project::Pipeline::Index.perform(&:wait_for_latest_pipeline_success) + Page::Project::Pipeline::Index.perform(&:click_on_latest_pipeline) + end + + def main_ci_file + { + file_path: '.gitlab-ci.yml', + content: <<~YAML + include: + - project: #{other_project.full_path} + file: + - file1.yml + - file2.yml + + build: + stage: build + tags: ["#{executor}"] + script: echo 'build' + + test: + stage: test + tags: ["#{executor}"] + script: echo "#{expected_text}" + YAML + } + end + + def included_file_1 + { + file_path: 'file1.yml', + content: <<~YAML + test: + stage: test + tags: ["#{executor}"] + script: echo "#{unexpected_text}" + YAML + } + end + + def included_file_2 + { + file_path: 'file2.yml', + content: <<~YAML + deploy: + stage: deploy + tags: ["#{executor}"] + script: echo 'deploy' + YAML + } + end + end + end +end diff --git a/qa/qa/specs/features/browser_ui/4_verify/pipeline/merge_mr_when_pipline_is_blocked_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/pipeline/merge_mr_when_pipline_is_blocked_spec.rb new file mode 100644 index 00000000000..c5d73d2fd7d --- /dev/null +++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/merge_mr_when_pipline_is_blocked_spec.rb @@ -0,0 +1,82 @@ +# frozen_string_literal: true + +require 'faker' + +module QA + RSpec.describe 'Verify', :runner do + context 'When pipeline is blocked' do + let(:executor) { "qa-runner-#{Faker::Alphanumeric.alphanumeric(8)}" } + + let(:project) do + Resource::Project.fabricate_via_api! do |project| + project.name = 'project-with-blocked-pipeline' + end + end + + let!(:runner) do + Resource::Runner.fabricate! do |runner| + runner.project = project + runner.name = executor + runner.tags = [executor] + end + end + + let!(:ci_file) 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 + test_blocked_pipeline: + stage: build + tags: [#{executor}] + script: echo 'OK!' + + manual_job: + stage: test + needs: [test_blocked_pipeline] + script: echo do not click me + when: manual + + dummy_job: + stage: deploy + needs: [manual_job] + script: echo nothing + YAML + ] + ) + end + end + + let(:merge_request) do + Resource::MergeRequest.fabricate_via_api! do |merge_request| + merge_request.project = project + merge_request.description = Faker::Lorem.sentence + merge_request.target_new_branch = false + merge_request.file_name = 'custom_file.txt' + merge_request.file_content = Faker::Lorem.sentence + end + end + + before do + Flow::Login.sign_in + merge_request.visit! + end + + after do + runner.remove_via_api! + end + + it 'can still merge MR successfully', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/971' do + Page::MergeRequest::Show.perform do |show| + show.wait_until(reload: false) { show.has_pipeline_status?('running') } + show.merge_immediately! + + expect(show).to be_merged + end + end + end + end +end diff --git a/qa/qa/specs/features/browser_ui/4_verify/pipeline/pass_dotenv_variables_to_downstream_via_bridge_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/pipeline/pass_dotenv_variables_to_downstream_via_bridge_spec.rb new file mode 100644 index 00000000000..eafe28c1ee6 --- /dev/null +++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/pass_dotenv_variables_to_downstream_via_bridge_spec.rb @@ -0,0 +1,111 @@ +# frozen_string_literal: true + +require 'faker' + +module QA + RSpec.describe 'Verify', :runner, :requires_admin do + describe "Pass dotenv variables to downstream via bridge" do + let(:feature_flag) { :ci_bridge_dependency_variables } + let(:executor_1) { "qa-runner-#{Faker::Alphanumeric.alphanumeric(8)}" } + let(:executor_2) { "qa-runner-#{Faker::Alphanumeric.alphanumeric(8)}" } + + let(:upstream_project) do + Resource::Project.fabricate_via_api! do |project| + project.name = 'project-with-pipeline-1' + end + end + + let(:downstream_project) do + Resource::Project.fabricate_via_api! do |project| + project.name = 'project-with-pipeline-2' + end + end + + let!(:runner_1) do + Resource::Runner.fabricate! do |runner| + runner.project = upstream_project + runner.name = executor_1 + runner.tags = [executor_1] + end + end + + let!(:runner_2) do + Resource::Runner.fabricate! do |runner| + runner.project = downstream_project + runner.name = executor_2 + runner.tags = [executor_2] + end + end + + before do + Runtime::Feature.enable(feature_flag) + Flow::Login.sign_in + add_ci_file(downstream_project, downstream_ci_file) + add_ci_file(upstream_project, upstream_ci_file) + upstream_project.visit! + Flow::Pipeline.visit_latest_pipeline(pipeline_condition: 'success') + end + + after do + Runtime::Feature.disable(feature_flag) + runner_1.remove_via_api! + runner_2.remove_via_api! + end + + it 'runs the pipeline with composed config', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1086' do + Page::Project::Pipeline::Show.perform do |parent_pipeline| + Support::Waiter.wait_until { parent_pipeline.has_child_pipeline? } + parent_pipeline.expand_child_pipeline + parent_pipeline.click_job('downstream_test') + end + + Page::Project::Job::Show.perform do |show| + expect(show).to have_passed(timeout: 360) + end + end + + private + + def add_ci_file(project, file) + Resource::Repository::Commit.fabricate_via_api! do |commit| + commit.project = project + commit.commit_message = 'Add config file' + commit.add_files([file]) + end + end + + def upstream_ci_file + { + file_path: '.gitlab-ci.yml', + content: <<~YAML + build: + stage: build + tags: ["#{executor_1}"] + script: echo "MY_VAR=hello" >> variables.env + artifacts: + reports: + dotenv: variables.env + + trigger: + stage: deploy + variables: + PASSED_MY_VAR: $MY_VAR + trigger: #{downstream_project.full_path} + YAML + } + end + + def downstream_ci_file + { + file_path: '.gitlab-ci.yml', + content: <<~YAML + downstream_test: + stage: test + tags: ["#{executor_2}"] + script: '[ "$PASSED_MY_VAR" = hello ]; exit "$?"' + YAML + } + end + end + end +end diff --git a/qa/qa/specs/features/browser_ui/4_verify/pipeline/run_pipeline_via_web_only_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/pipeline/run_pipeline_via_web_only_spec.rb index 153ccafaa20..b79bda108af 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/pipeline/run_pipeline_via_web_only_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/run_pipeline_via_web_only_spec.rb @@ -2,11 +2,8 @@ module QA RSpec.describe 'Verify' do - describe 'Run pipeline', :requires_admin, :skip_live_env do - # [TODO]: Developer to remove :requires_admin and :skip_live_env once FF is removed in https://gitlab.com/gitlab-org/gitlab/-/issues/229632 - + describe 'Run pipeline', only: { subdomain: :staging } do context 'with web only rule' do - let(:feature_flag) { :new_pipeline_form } let(:job_name) { 'test_job' } let(:project) do Resource::Project.fabricate_via_api! do |project| @@ -20,33 +17,29 @@ module QA commit.commit_message = 'Add .gitlab-ci.yml' commit.add_files( [ - { - file_path: '.gitlab-ci.yml', - content: <<~YAML - #{job_name}: - tags: - - #{project.name} - script: echo 'OK' - only: - - web - YAML - } + { + file_path: '.gitlab-ci.yml', + content: <<~YAML + #{job_name}: + tags: + - #{project.name} + script: echo 'OK' + only: + - web + + YAML + } ] ) end end before do - Runtime::Feature.enable(feature_flag) # [TODO]: Developer to remove when feature flag is removed Flow::Login.sign_in project.visit! Page::Project::Menu.perform(&:click_ci_cd_pipelines) end - after do - Runtime::Feature.disable(feature_flag) # [TODO]: Developer to remove when feature flag is removed - end - it 'can trigger pipeline', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/946' do Page::Project::Pipeline::Index.perform do |index| expect(index).not_to have_pipeline # should not auto trigger pipeline diff --git a/qa/qa/specs/features/browser_ui/4_verify/pipeline/trigger_child_pipeline_with_manual_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/pipeline/trigger_child_pipeline_with_manual_spec.rb index 39d5fbaba6b..2f66ed697a3 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/pipeline/trigger_child_pipeline_with_manual_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/trigger_child_pipeline_with_manual_spec.rb @@ -29,7 +29,7 @@ module QA Flow::Login.sign_in add_ci_files project.visit! - view_the_last_pipeline + Flow::Pipeline.visit_latest_pipeline(pipeline_condition: 'success') end after do @@ -64,12 +64,6 @@ module QA end end - def view_the_last_pipeline - Page::Project::Menu.perform(&:click_ci_cd_pipelines) - Page::Project::Pipeline::Index.perform(&:wait_for_latest_pipeline_success) - Page::Project::Pipeline::Index.perform(&:click_on_latest_pipeline) - end - def parent_ci_file { file_path: '.gitlab-ci.yml', |