From b76d4da653ad87a3af7fd5f9468e7e663de9a07f Mon Sep 17 00:00:00 2001 From: tanhengyeow Date: Sun, 19 Aug 2018 14:41:05 +0800 Subject: config-file-provider: Add tests Change-Id: Id8e36d1745bd05527985d5ee9ddfba32c5fa197d Signed-off-by: Tan Heng Yeow --- jenkins_jobs/modules/builders.py | 10 ++++++++-- jenkins_jobs/modules/wrappers.py | 12 ++++++++---- .../builders/fixtures/config-file-provider-full.xml | 15 +++++++++++++++ .../fixtures/config-file-provider-full.yaml | 7 +++++++ .../fixtures/config-file-provider-minimal.xml | 15 +++++++++++++++ .../fixtures/config-file-provider-minimal.yaml | 4 ++++ tests/builders/fixtures/config-file-provider01.xml | 15 --------------- tests/builders/fixtures/config-file-provider01.yaml | 7 ------- .../wrappers/fixtures/config-file-provider-full.xml | 21 +++++++++++++++++++++ .../fixtures/config-file-provider-full.yaml | 8 ++++++++ .../fixtures/config-file-provider-minimal.xml | 15 +++++++++++++++ .../fixtures/config-file-provider-minimal.yaml | 4 ++++ tests/wrappers/fixtures/config-file-provider001.xml | 15 --------------- .../wrappers/fixtures/config-file-provider001.yaml | 7 ------- tests/wrappers/fixtures/config-file-provider002.xml | 15 --------------- .../wrappers/fixtures/config-file-provider002.yaml | 4 ---- tests/wrappers/fixtures/config-file-provider003.xml | 21 --------------------- .../wrappers/fixtures/config-file-provider003.yaml | 8 -------- 18 files changed, 105 insertions(+), 98 deletions(-) create mode 100644 tests/builders/fixtures/config-file-provider-full.xml create mode 100644 tests/builders/fixtures/config-file-provider-full.yaml create mode 100644 tests/builders/fixtures/config-file-provider-minimal.xml create mode 100644 tests/builders/fixtures/config-file-provider-minimal.yaml delete mode 100644 tests/builders/fixtures/config-file-provider01.xml delete mode 100644 tests/builders/fixtures/config-file-provider01.yaml create mode 100644 tests/wrappers/fixtures/config-file-provider-full.xml create mode 100644 tests/wrappers/fixtures/config-file-provider-full.yaml create mode 100644 tests/wrappers/fixtures/config-file-provider-minimal.xml create mode 100644 tests/wrappers/fixtures/config-file-provider-minimal.yaml delete mode 100644 tests/wrappers/fixtures/config-file-provider001.xml delete mode 100644 tests/wrappers/fixtures/config-file-provider001.yaml delete mode 100644 tests/wrappers/fixtures/config-file-provider002.xml delete mode 100644 tests/wrappers/fixtures/config-file-provider002.yaml delete mode 100644 tests/wrappers/fixtures/config-file-provider003.xml delete mode 100644 tests/wrappers/fixtures/config-file-provider003.yaml diff --git a/jenkins_jobs/modules/builders.py b/jenkins_jobs/modules/builders.py index 9cf9bdf2..8a26fbe8 100644 --- a/jenkins_jobs/modules/builders.py +++ b/jenkins_jobs/modules/builders.py @@ -2154,10 +2154,16 @@ def config_file_provider(registry, xml_parent, data): example "password: ${PYPI_JENKINS_PASS}" will be replaced with the global variable configured in Jenkins. - Example: + Full Example: + + .. literalinclude:: + ../../tests/builders/fixtures/config-file-provider-full.yaml + :language: yaml + + Minimal Example: .. literalinclude:: - ../../tests/builders/fixtures/config-file-provider01.yaml + ../../tests/builders/fixtures/config-file-provider-minimal.yaml :language: yaml """ cfp = XML.SubElement(xml_parent, diff --git a/jenkins_jobs/modules/wrappers.py b/jenkins_jobs/modules/wrappers.py index 04635d66..32a89df3 100644 --- a/jenkins_jobs/modules/wrappers.py +++ b/jenkins_jobs/modules/wrappers.py @@ -208,11 +208,15 @@ def config_file_provider(registry, xml_parent, data): For example "password: ${PYPI_JENKINS_PASS}" will be replaced with the global variable configured in Jenkins. - Example: + Full Example: - .. literalinclude:: \ - /../../tests/wrappers/fixtures/config-file-provider003.yaml - :language: yaml + .. literalinclude:: + /../../tests/wrappers/fixtures/config-file-provider-full.yaml + + Minimal Example: + + .. literalinclude:: + /../../tests/wrappers/fixtures/config-file-provider-minimal.yaml """ cfp = XML.SubElement(xml_parent, 'org.jenkinsci.plugins.configfiles.' 'buildwrapper.ConfigFileBuildWrapper') diff --git a/tests/builders/fixtures/config-file-provider-full.xml b/tests/builders/fixtures/config-file-provider-full.xml new file mode 100644 index 00000000..9e8ecad1 --- /dev/null +++ b/tests/builders/fixtures/config-file-provider-full.xml @@ -0,0 +1,15 @@ + + + + + + + org.jenkinsci.plugins.configfiles.maven.MavenSettingsConfig0123456789012 + target + variable + true + + + + + diff --git a/tests/builders/fixtures/config-file-provider-full.yaml b/tests/builders/fixtures/config-file-provider-full.yaml new file mode 100644 index 00000000..aa404270 --- /dev/null +++ b/tests/builders/fixtures/config-file-provider-full.yaml @@ -0,0 +1,7 @@ +builders: + - config-file-provider: + files: + - file-id: org.jenkinsci.plugins.configfiles.maven.MavenSettingsConfig0123456789012 + target: target + variable: variable + replace-tokens: true diff --git a/tests/builders/fixtures/config-file-provider-minimal.xml b/tests/builders/fixtures/config-file-provider-minimal.xml new file mode 100644 index 00000000..1df1859b --- /dev/null +++ b/tests/builders/fixtures/config-file-provider-minimal.xml @@ -0,0 +1,15 @@ + + + + + + + org.jenkinsci.plugins.configfiles.maven.MavenSettingsConfig0123456789012 + + + false + + + + + diff --git a/tests/builders/fixtures/config-file-provider-minimal.yaml b/tests/builders/fixtures/config-file-provider-minimal.yaml new file mode 100644 index 00000000..0b5fe406 --- /dev/null +++ b/tests/builders/fixtures/config-file-provider-minimal.yaml @@ -0,0 +1,4 @@ +builders: + - config-file-provider: + files: + - file-id: org.jenkinsci.plugins.configfiles.maven.MavenSettingsConfig0123456789012 diff --git a/tests/builders/fixtures/config-file-provider01.xml b/tests/builders/fixtures/config-file-provider01.xml deleted file mode 100644 index 9e8ecad1..00000000 --- a/tests/builders/fixtures/config-file-provider01.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - org.jenkinsci.plugins.configfiles.maven.MavenSettingsConfig0123456789012 - target - variable - true - - - - - diff --git a/tests/builders/fixtures/config-file-provider01.yaml b/tests/builders/fixtures/config-file-provider01.yaml deleted file mode 100644 index aa404270..00000000 --- a/tests/builders/fixtures/config-file-provider01.yaml +++ /dev/null @@ -1,7 +0,0 @@ -builders: - - config-file-provider: - files: - - file-id: org.jenkinsci.plugins.configfiles.maven.MavenSettingsConfig0123456789012 - target: target - variable: variable - replace-tokens: true diff --git a/tests/wrappers/fixtures/config-file-provider-full.xml b/tests/wrappers/fixtures/config-file-provider-full.xml new file mode 100644 index 00000000..d8f9a0a5 --- /dev/null +++ b/tests/wrappers/fixtures/config-file-provider-full.xml @@ -0,0 +1,21 @@ + + + + + + + org.jenkinsci.plugins.configfiles.custom.CustomConfig1234 + + + false + + + org.jenkinsci.plugins.configfiles.custom.CustomConfig5678 + /foo.txt + varName + true + + + + + diff --git a/tests/wrappers/fixtures/config-file-provider-full.yaml b/tests/wrappers/fixtures/config-file-provider-full.yaml new file mode 100644 index 00000000..6f65ab56 --- /dev/null +++ b/tests/wrappers/fixtures/config-file-provider-full.yaml @@ -0,0 +1,8 @@ +wrappers: + - config-file-provider: + files: + - file-id: org.jenkinsci.plugins.configfiles.custom.CustomConfig1234 + - file-id: org.jenkinsci.plugins.configfiles.custom.CustomConfig5678 + target: /foo.txt + variable: varName + replace-tokens: true diff --git a/tests/wrappers/fixtures/config-file-provider-minimal.xml b/tests/wrappers/fixtures/config-file-provider-minimal.xml new file mode 100644 index 00000000..d10b964a --- /dev/null +++ b/tests/wrappers/fixtures/config-file-provider-minimal.xml @@ -0,0 +1,15 @@ + + + + + + + org.jenkinsci.plugins.configfiles.custom.CustomConfig1234 + + + false + + + + + diff --git a/tests/wrappers/fixtures/config-file-provider-minimal.yaml b/tests/wrappers/fixtures/config-file-provider-minimal.yaml new file mode 100644 index 00000000..d2b6caea --- /dev/null +++ b/tests/wrappers/fixtures/config-file-provider-minimal.yaml @@ -0,0 +1,4 @@ +wrappers: + - config-file-provider: + files: + - file-id: org.jenkinsci.plugins.configfiles.custom.CustomConfig1234 diff --git a/tests/wrappers/fixtures/config-file-provider001.xml b/tests/wrappers/fixtures/config-file-provider001.xml deleted file mode 100644 index 09d77291..00000000 --- a/tests/wrappers/fixtures/config-file-provider001.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - org.jenkinsci.plugins.configfiles.custom.CustomConfig1409250932722 - tmp/bar.txt - varname - true - - - - - diff --git a/tests/wrappers/fixtures/config-file-provider001.yaml b/tests/wrappers/fixtures/config-file-provider001.yaml deleted file mode 100644 index f02c3142..00000000 --- a/tests/wrappers/fixtures/config-file-provider001.yaml +++ /dev/null @@ -1,7 +0,0 @@ -wrappers: - - config-file-provider: - files: - - file-id: org.jenkinsci.plugins.configfiles.custom.CustomConfig1409250932722 - target: tmp/bar.txt - variable: varname - replace-tokens: true diff --git a/tests/wrappers/fixtures/config-file-provider002.xml b/tests/wrappers/fixtures/config-file-provider002.xml deleted file mode 100644 index d10b964a..00000000 --- a/tests/wrappers/fixtures/config-file-provider002.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - org.jenkinsci.plugins.configfiles.custom.CustomConfig1234 - - - false - - - - - diff --git a/tests/wrappers/fixtures/config-file-provider002.yaml b/tests/wrappers/fixtures/config-file-provider002.yaml deleted file mode 100644 index d2b6caea..00000000 --- a/tests/wrappers/fixtures/config-file-provider002.yaml +++ /dev/null @@ -1,4 +0,0 @@ -wrappers: - - config-file-provider: - files: - - file-id: org.jenkinsci.plugins.configfiles.custom.CustomConfig1234 diff --git a/tests/wrappers/fixtures/config-file-provider003.xml b/tests/wrappers/fixtures/config-file-provider003.xml deleted file mode 100644 index d8f9a0a5..00000000 --- a/tests/wrappers/fixtures/config-file-provider003.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - org.jenkinsci.plugins.configfiles.custom.CustomConfig1234 - - - false - - - org.jenkinsci.plugins.configfiles.custom.CustomConfig5678 - /foo.txt - varName - true - - - - - diff --git a/tests/wrappers/fixtures/config-file-provider003.yaml b/tests/wrappers/fixtures/config-file-provider003.yaml deleted file mode 100644 index 6f65ab56..00000000 --- a/tests/wrappers/fixtures/config-file-provider003.yaml +++ /dev/null @@ -1,8 +0,0 @@ -wrappers: - - config-file-provider: - files: - - file-id: org.jenkinsci.plugins.configfiles.custom.CustomConfig1234 - - file-id: org.jenkinsci.plugins.configfiles.custom.CustomConfig5678 - target: /foo.txt - variable: varName - replace-tokens: true -- cgit