Skip to content
Snippets Groups Projects
Commit b409d464 authored by Andrejs Cunskis's avatar Andrejs Cunskis :flag_lv:
Browse files

Merge branch 'follow-up-refactor-variable-inheritance-shared-context' into 'master'

Follow up refactor variable inheritance shared context

See merge request !88193
parents d9bd8ce6 b00c16e7
No related branches found
No related tags found
1 merge request!88193Follow up refactor variable inheritance shared context
Pipeline #548027333 passed
This commit is part of merge request !88633. Comments created here will be created in the context of that merge request.
...@@ -29,20 +29,14 @@ module QA ...@@ -29,20 +29,14 @@ module QA
start_pipeline_via_api_with_variable(i + 1) start_pipeline_via_api_with_variable(i + 1)
wait_for_pipelines wait_for_pipelines
# Is inheritable when true # When forward:pipeline_variables is true
expect(child1_pipeline).to have_variable(key: key, value: value), expect_downstream_pipeline_to_inherit_variable
"Expected to find `{key: 'TEST_VAR', value: 'This is great!'}`" \
" but got #{child1_pipeline.pipeline_variables}"
# Is not inheritable when false # When forward:pipeline_variables is false
expect(child2_pipeline).not_to have_variable(key: key, value: value), expect_downstream_pipeline_not_to_inherit_variable(upstream_project, 'child2_trigger')
"Did not expect to find `{key: 'TEST_VAR', value: 'This is great!'}`" \
" but got #{child2_pipeline.pipeline_variables}"
# Is not inheritable by default # When forward:pipeline_variables is default
expect(downstream1_pipeline).not_to have_variable(key: key, value: value), expect_downstream_pipeline_not_to_inherit_variable(downstream1_project, 'downstream1_trigger')
"Did not expect to find `{key: 'TEST_VAR', value: 'This is great!'}`" \
" but got #{downstream1_pipeline.pipeline_variables}"
end end
end end
...@@ -84,6 +78,20 @@ def upstream_ci_file ...@@ -84,6 +78,20 @@ def upstream_ci_file
YAML YAML
} }
end end
def expect_downstream_pipeline_to_inherit_variable
pipeline = downstream_pipeline(upstream_project, 'child1_trigger')
expect(pipeline).to have_variable(key: key, value: value),
"Expected to find `{key: 'TEST_VAR', value: 'This is great!'}`" \
" but got #{pipeline.pipeline_variables}"
end
def expect_downstream_pipeline_not_to_inherit_variable(project, bridge_name)
pipeline = downstream_pipeline(project, bridge_name)
expect(pipeline).not_to have_variable(key: key, value: value),
"Did not expect to find `{key: 'TEST_VAR', value: 'This is great!'}`" \
" but got #{pipeline.pipeline_variables}"
end
end end
end end
end end
...@@ -66,7 +66,8 @@ def start_pipeline_with_variable ...@@ -66,7 +66,8 @@ def start_pipeline_with_variable
def wait_for_pipelines def wait_for_pipelines
Support::Waiter.wait_until(max_duration: 300, sleep_interval: 10) do Support::Waiter.wait_until(max_duration: 300, sleep_interval: 10) do
upstream_pipeline.status == 'success' && downstream1_pipeline.status == 'success' upstream_pipeline.status == 'success' &&
downstream_pipeline(downstream1_project, 'downstream1_trigger').status == 'success'
end end
end end
...@@ -106,31 +107,10 @@ def upstream_pipeline ...@@ -106,31 +107,10 @@ def upstream_pipeline
end end
end end
def child1_pipeline def downstream_pipeline(project, bridge_name)
Resource::Pipeline.fabricate_via_api! do |pipeline| Resource::Pipeline.fabricate_via_api! do |pipeline|
pipeline.project = upstream_project pipeline.project = project
pipeline.id = upstream_pipeline.downstream_pipeline_id(bridge_name: 'child1_trigger') pipeline.id = upstream_pipeline.downstream_pipeline_id(bridge_name: bridge_name)
end
end
def child2_pipeline
Resource::Pipeline.fabricate_via_api! do |pipeline|
pipeline.project = upstream_project
pipeline.id = upstream_pipeline.downstream_pipeline_id(bridge_name: 'child2_trigger')
end
end
def downstream1_pipeline
Resource::Pipeline.fabricate_via_api! do |pipeline|
pipeline.project = downstream1_project
pipeline.id = upstream_pipeline.downstream_pipeline_id(bridge_name: 'downstream1_trigger')
end
end
def downstream2_pipeline
Resource::Pipeline.fabricate_via_api! do |pipeline|
pipeline.project = downstream2_project
pipeline.id = upstream_pipeline.downstream_pipeline_id(bridge_name: 'downstream2_trigger')
end end
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment