From 0e1b708ad565e60bdc5163a9fee1000b6d6fb043 Mon Sep 17 00:00:00 2001 From: Vsevolod Fedorov Date: Thu, 18 Aug 2022 11:02:33 +0300 Subject: [PATCH] Yaml parser tests: Add test for job parameters precedence Change-Id: I6ebc93425b44a7981b3befc931486e0a7a5d253b --- .../fixtures/job-parameter-precedence.xml | 90 +++++++++++++++++++ .../fixtures/job-parameter-precedence.yaml | 50 +++++++++++ 2 files changed, 140 insertions(+) create mode 100644 tests/yamlparser/fixtures/job-parameter-precedence.xml create mode 100644 tests/yamlparser/fixtures/job-parameter-precedence.yaml diff --git a/tests/yamlparser/fixtures/job-parameter-precedence.xml b/tests/yamlparser/fixtures/job-parameter-precedence.xml new file mode 100644 index 000000000..3c1887941 --- /dev/null +++ b/tests/yamlparser/fixtures/job-parameter-precedence.xml @@ -0,0 +1,90 @@ + + + + Job N1<!-- Managed by Jenkins Job Builder --> + false + false + false + false + true + + + + + echo job=1 +# job*:1-project +echo param_1=1-project +# job1:2-job-param, job2:2-group-param, job3:2-group-param +echo param_2=2-job-param +# job1:3-project, job2: 3-group-param, job3: 3-group +echo param_3=3-project +# job*: 4-template +echo param_4=4-template +# job*: 5-defaults +echo param_5=5-defaults + + + + + + + + + + Job N2<!-- Managed by Jenkins Job Builder --> + false + false + false + false + true + + + + + echo job=2 +# job*:1-project +echo param_1=1-project +# job1:2-job-param, job2:2-group-param, job3:2-group-param +echo param_2=2-group-param +# job1:3-project, job2: 3-group-param, job3: 3-group +echo param_3=3-group-param +# job*: 4-template +echo param_4=4-template +# job*: 5-defaults +echo param_5=5-defaults + + + + + + + + + + Job N3<!-- Managed by Jenkins Job Builder --> + false + false + false + false + true + + + + + echo job=3 +# job*:1-project +echo param_1=1-project +# job1:2-job-param, job2:2-group-param, job3:2-group-param +echo param_2=2-group-param +# job1:3-project, job2: 3-group-param, job3: 3-group +echo param_3=3-group +# job*: 4-template +echo param_4=4-template +# job*: 5-defaults +echo param_5=5-defaults + + + + + + diff --git a/tests/yamlparser/fixtures/job-parameter-precedence.yaml b/tests/yamlparser/fixtures/job-parameter-precedence.yaml new file mode 100644 index 000000000..5729a1e52 --- /dev/null +++ b/tests/yamlparser/fixtures/job-parameter-precedence.yaml @@ -0,0 +1,50 @@ +- defaults: + name: global + param_1: '1-defaults' + param_2: '2-defaults' + param_3: '3-defaults' + param_4: '4-defaults' + param_5: '5-defaults' # Should be used. + +- job-template: + name: my-job-{num} + param_1: '1-template' + param_2: '2-template' + param_3: '3-template' + param_4: '4-template' # Should be used. + description: 'Job N{num}' + builders: + - shell: | + echo job={num} + # job*:1-project + echo param_1={param_1} + # job1:2-job-param, job2:2-group-param, job3:2-group-param + echo param_2={param_2} + # job1:3-project, job2: 3-group-param, job3: 3-group + echo param_3={param_3} + # job*: 4-template + echo param_4={param_4} + # job*: 5-defaults + echo param_5={param_5} + +- job-group: + name: my-job-group + jobs: + - my-job-{num}: + num: 2 + - my-job-{num}: + num: 3 + param_3: '3-group' # Should be used. + +- project: + name: test-project + param_1: '1-project' # Should be used. + param_2: '2-project' + param_3: '3-project' + jobs: + - my-job-{num}: + num: 1 + param_2: '2-job-param' # Should be used. + - my-job-group: + param_2: '2-group-param' # Should be used. + param_3: '3-group-param'