From 8784d916a6d61ecf5320448bd0912cb4aa5a2066 Mon Sep 17 00:00:00 2001 From: Vsevolod Fedorov Date: Mon, 13 Feb 2023 11:15:02 +0300 Subject: [PATCH] Tests: Add tests for including a list of files There were no tests for !include: and !include-jinja2: with a list of files. Change-Id: Id786e0306ec0279e98ac3b3cb7da62e688bcb12e --- .../job_fixtures/include002-list.xml | 20 +++++++++++++++++ .../job_fixtures/include002-list.yaml | 14 ++++++++++++ .../job_fixtures/include002-list.yaml.shell-1 | 1 + .../job_fixtures/include002-list.yaml.shell-2 | 2 ++ .../yamlparser/job_fixtures/jinja04-list.xml | 22 +++++++++++++++++++ .../yamlparser/job_fixtures/jinja04-list.yaml | 12 ++++++++++ 6 files changed, 71 insertions(+) create mode 100644 tests/yamlparser/job_fixtures/include002-list.xml create mode 100644 tests/yamlparser/job_fixtures/include002-list.yaml create mode 100644 tests/yamlparser/job_fixtures/include002-list.yaml.shell-1 create mode 100644 tests/yamlparser/job_fixtures/include002-list.yaml.shell-2 create mode 100644 tests/yamlparser/job_fixtures/jinja04-list.xml create mode 100644 tests/yamlparser/job_fixtures/jinja04-list.yaml diff --git a/tests/yamlparser/job_fixtures/include002-list.xml b/tests/yamlparser/job_fixtures/include002-list.xml new file mode 100644 index 000000000..a56ef83f0 --- /dev/null +++ b/tests/yamlparser/job_fixtures/include002-list.xml @@ -0,0 +1,20 @@ + + + + <!-- Managed by Jenkins Job Builder --> + false + false + false + false + true + + + + + echo include-1 +echo include-2 echo var=12345 + + + + + diff --git a/tests/yamlparser/job_fixtures/include002-list.yaml b/tests/yamlparser/job_fixtures/include002-list.yaml new file mode 100644 index 000000000..1ea00045a --- /dev/null +++ b/tests/yamlparser/job_fixtures/include002-list.yaml @@ -0,0 +1,14 @@ +# Check including a list of files, with variable expansion. + +- job-template: + name: sample-job + var: 12345 + builders: + - shell: !include: + - include002-list.yaml.shell-1 + - include002-list.yaml.shell-2 + +- project: + name: sample-project + jobs: + - sample-job diff --git a/tests/yamlparser/job_fixtures/include002-list.yaml.shell-1 b/tests/yamlparser/job_fixtures/include002-list.yaml.shell-1 new file mode 100644 index 000000000..559b97b97 --- /dev/null +++ b/tests/yamlparser/job_fixtures/include002-list.yaml.shell-1 @@ -0,0 +1 @@ +echo include-1 diff --git a/tests/yamlparser/job_fixtures/include002-list.yaml.shell-2 b/tests/yamlparser/job_fixtures/include002-list.yaml.shell-2 new file mode 100644 index 000000000..82c9420cf --- /dev/null +++ b/tests/yamlparser/job_fixtures/include002-list.yaml.shell-2 @@ -0,0 +1,2 @@ +echo include-2 +echo var={var} diff --git a/tests/yamlparser/job_fixtures/jinja04-list.xml b/tests/yamlparser/job_fixtures/jinja04-list.xml new file mode 100644 index 000000000..b2ca95fd6 --- /dev/null +++ b/tests/yamlparser/job_fixtures/jinja04-list.xml @@ -0,0 +1,22 @@ + + + + <!-- Managed by Jenkins Job Builder --> + false + false + false + false + true + + + + + +1 +2 +3 + + + + + diff --git a/tests/yamlparser/job_fixtures/jinja04-list.yaml b/tests/yamlparser/job_fixtures/jinja04-list.yaml new file mode 100644 index 000000000..8b0dae7fc --- /dev/null +++ b/tests/yamlparser/job_fixtures/jinja04-list.yaml @@ -0,0 +1,12 @@ +# Check jinja-including a list of files. + +- job-template: + name: sample-job + builders: + - shell: !include-jinja2: + - jinja03.yaml.inc + +- project: + name: sample-project + jobs: + - sample-job