summaryrefslogtreecommitdiff
path: root/qa
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-28 00:07:51 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-28 00:07:51 +0000
commitbba3aae6262b45e5457d0fcaa23e99f815114b4b (patch)
tree9510a08bba9514faf620b4244f382c4fc9599637 /qa
parentf50b93c373428d624cc2cabe98e4022dce846e67 (diff)
downloadgitlab-ce-bba3aae6262b45e5457d0fcaa23e99f815114b4b.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'qa')
-rw-r--r--qa/qa/specs/features/browser_ui/6_release/pipeline/parent_child_pipelines_dependent_relationship_spec.rb122
-rw-r--r--qa/qa/specs/features/browser_ui/6_release/pipeline/parent_child_pipelines_independent_relationship_spec.rb121
2 files changed, 243 insertions, 0 deletions
diff --git a/qa/qa/specs/features/browser_ui/6_release/pipeline/parent_child_pipelines_dependent_relationship_spec.rb b/qa/qa/specs/features/browser_ui/6_release/pipeline/parent_child_pipelines_dependent_relationship_spec.rb
new file mode 100644
index 00000000000..9ff33698b0e
--- /dev/null
+++ b/qa/qa/specs/features/browser_ui/6_release/pipeline/parent_child_pipelines_dependent_relationship_spec.rb
@@ -0,0 +1,122 @@
+# frozen_string_literal: true
+
+module QA
+ context 'Release', :docker, quarantine: { type: :new } do
+ describe 'Parent-child pipelines dependent relationship' do
+ let!(:project) do
+ Resource::Project.fabricate_via_api! do |project|
+ project.name = 'pipelines-dependent-relationship'
+ end
+ end
+ let!(:runner) do
+ Resource::Runner.fabricate_via_api! do |runner|
+ runner.project = project
+ runner.name = project.name
+ runner.tags = ["#{project.name}"]
+ end
+ end
+
+ before do
+ Flow::Login.sign_in
+ end
+
+ after do
+ runner.remove_via_api!
+ end
+
+ it 'parent pipelines passes if child passes' do
+ add_ci_files(success_child_ci_file)
+ view_pipelines
+
+ Page::Project::Pipeline::Show.perform do |parent_pipeline|
+ parent_pipeline.click_linked_job(project.name)
+
+ expect(parent_pipeline).to have_job("child_job")
+ expect(parent_pipeline).to be_passed
+ end
+ end
+
+ it 'parent pipeline fails if child fails' do
+ add_ci_files(fail_child_ci_file)
+ view_pipelines
+
+ Page::Project::Pipeline::Show.perform do |parent_pipeline|
+ parent_pipeline.click_linked_job(project.name)
+
+ expect(parent_pipeline).to have_job("child_job")
+ expect(parent_pipeline).to be_failed
+ end
+ end
+
+ private
+
+ def view_pipelines
+ Page::Project::Menu.perform(&:click_ci_cd_pipelines)
+ Page::Project::Pipeline::Index.perform(&:wait_for_latest_pipeline_completion)
+ Page::Project::Pipeline::Index.perform(&:click_on_latest_pipeline)
+ end
+
+ def success_child_ci_file
+ {
+ file_path: '.child-ci.yml',
+ content: <<~YAML
+ child_job:
+ stage: test
+ tags: ["#{project.name}"]
+ script: echo "Child job done!"
+
+ YAML
+ }
+ end
+
+ def fail_child_ci_file
+ {
+ file_path: '.child-ci.yml',
+ content: <<~YAML
+ child_job:
+ stage: test
+ tags: ["#{project.name}"]
+ script: exit 1
+
+ YAML
+ }
+ end
+
+ def parent_ci_file
+ {
+ file_path: '.gitlab-ci.yml',
+ content: <<~YAML
+ stages:
+ - test
+ - deploy
+
+ job1:
+ stage: test
+ trigger:
+ include: ".child-ci.yml"
+ strategy: depend
+
+ job2:
+ stage: deploy
+ tags: ["#{project.name}"]
+ script: echo "parent deploy done"
+
+ YAML
+ }
+ end
+
+ def add_ci_files(child_ci_file)
+ Resource::Repository::Commit.fabricate_via_api! do |commit|
+ commit.project = project
+ commit.commit_message = 'Add parent and child pipelines CI files.'
+ commit.add_files(
+ [
+ child_ci_file,
+ parent_ci_file
+ ]
+ )
+ end.project.visit!
+ end
+ end
+ end
+end
diff --git a/qa/qa/specs/features/browser_ui/6_release/pipeline/parent_child_pipelines_independent_relationship_spec.rb b/qa/qa/specs/features/browser_ui/6_release/pipeline/parent_child_pipelines_independent_relationship_spec.rb
new file mode 100644
index 00000000000..ec7af809cf6
--- /dev/null
+++ b/qa/qa/specs/features/browser_ui/6_release/pipeline/parent_child_pipelines_independent_relationship_spec.rb
@@ -0,0 +1,121 @@
+# frozen_string_literal: true
+
+module QA
+ context 'Release', :docker, quarantine: { type: :new } do
+ describe 'Parent-child pipelines independent relationship' do
+ let!(:project) do
+ Resource::Project.fabricate_via_api! do |project|
+ project.name = 'pipeline-independent-relationship'
+ end
+ end
+ let!(:runner) do
+ Resource::Runner.fabricate_via_api! do |runner|
+ runner.project = project
+ runner.name = project.name
+ runner.tags = ["#{project.name}"]
+ end
+ end
+
+ before do
+ Flow::Login.sign_in
+ end
+
+ after do
+ runner.remove_via_api!
+ end
+
+ it 'parent pipelines passes if child passes' do
+ add_ci_files(success_child_ci_file)
+ view_pipelines
+
+ Page::Project::Pipeline::Show.perform do |parent_pipeline|
+ parent_pipeline.click_linked_job(project.name)
+
+ expect(parent_pipeline).to have_job("child_job")
+ expect(parent_pipeline).to be_passed
+ end
+ end
+
+ it 'parent pipeline passes even if child fails' do
+ add_ci_files(fail_child_ci_file)
+ view_pipelines
+
+ Page::Project::Pipeline::Show.perform do |parent_pipeline|
+ parent_pipeline.click_linked_job(project.name)
+
+ expect(parent_pipeline).to have_job("child_job")
+ expect(parent_pipeline).to be_passed
+ end
+ end
+
+ private
+
+ def view_pipelines
+ Page::Project::Menu.perform(&:click_ci_cd_pipelines)
+ Page::Project::Pipeline::Index.perform(&:wait_for_latest_pipeline_completion)
+ Page::Project::Pipeline::Index.perform(&:click_on_latest_pipeline)
+ end
+
+ def success_child_ci_file
+ {
+ file_path: '.child-ci.yml',
+ content: <<~YAML
+ child_job:
+ stage: test
+ tags: ["#{project.name}"]
+ script: echo "Child job done!"
+
+ YAML
+ }
+ end
+
+ def fail_child_ci_file
+ {
+ file_path: '.child-ci.yml',
+ content: <<~YAML
+ child_job:
+ stage: test
+ tags: ["#{project.name}"]
+ script: exit 1
+
+ YAML
+ }
+ end
+
+ def parent_ci_file
+ {
+ file_path: '.gitlab-ci.yml',
+ content: <<~YAML
+ stages:
+ - test
+ - deploy
+
+ job1:
+ stage: test
+ trigger:
+ include: ".child-ci.yml"
+
+ job2:
+ stage: deploy
+ tags: ["#{project.name}"]
+ script: echo "parent deploy done"
+
+ YAML
+ }
+ end
+
+ def add_ci_files(child_ci_file)
+ Resource::Repository::Commit.fabricate_via_api! do |commit|
+ commit.project = project
+ commit.commit_message = 'Add parent and child pipelines CI files.'
+ commit.add_files(
+ [
+ child_ci_file,
+ parent_ci_file
+ ]
+ )
+ end.project.visit!
+ end
+ end
+ end
+end