summaryrefslogtreecommitdiffstats
path: root/tests/yamlparser/fixtures
diff options
context:
space:
mode:
authorThanh Ha <zxiiro@linux.com>2018-12-05 15:48:27 +0800
committerThanh Ha <zxiiro@linux.com>2018-12-05 17:59:12 +0800
commit02e85408f027f831ef00cb812ea66ddcdd226170 (patch)
tree1399a1609d53d5be971d6fb6ecba824d3c1ca23e /tests/yamlparser/fixtures
parentd15e57a14a7aa6a9de674479e1dcb904a8c09942 (diff)
downloadpython-jenkins-job-builder-02e85408f027f831ef00cb812ea66ddcdd226170.tar.gz
python-jenkins-job-builder-02e85408f027f831ef00cb812ea66ddcdd226170.tar.xz
python-jenkins-job-builder-02e85408f027f831ef00cb812ea66ddcdd226170.zip
Fix default '0' being ignored
The problem with `if default:` is that it evaluates int 0 to be equivalent to False. If a user is passing in a int 0 then they should be expected to receive int 0 in the case of defaults. Change-Id: Ida1f4c68b6f9d1af5b98d633b552f038c57654cc Signed-off-by: Thanh Ha <zxiiro@linux.com>
Diffstat (limited to 'tests/yamlparser/fixtures')
-rw-r--r--tests/yamlparser/fixtures/variable_default_values.xml50
-rw-r--r--tests/yamlparser/fixtures/variable_default_values.yaml11
2 files changed, 61 insertions, 0 deletions
diff --git a/tests/yamlparser/fixtures/variable_default_values.xml b/tests/yamlparser/fixtures/variable_default_values.xml
index 0346f9e3..a051363d 100644
--- a/tests/yamlparser/fixtures/variable_default_values.xml
+++ b/tests/yamlparser/fixtures/variable_default_values.xml
@@ -8,6 +8,56 @@
<concurrentBuild>false</concurrentBuild>
<canRoam>true</canRoam>
<properties>
+ <hudson.model.ParametersDefinitionProperty>
+ <parameterDefinitions>
+ <hudson.model.StringParameterDefinition>
+ <name>INT_DEFAULT</name>
+ <description/>
+ <defaultValue>0</defaultValue>
+ </hudson.model.StringParameterDefinition>
+ </parameterDefinitions>
+ </hudson.model.ParametersDefinitionProperty>
+ </properties>
+ <scm class="hudson.scm.NullSCM"/>
+ <builders/>
+ <publishers/>
+ <buildWrappers/>
+</project>
+<?xml version="1.0" encoding="utf-8"?>
+<project>
+ <actions/>
+ <description>&lt;!-- Managed by Jenkins Job Builder --&gt;</description>
+ <keepDependencies>false</keepDependencies>
+ <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
+ <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
+ <concurrentBuild>false</concurrentBuild>
+ <canRoam>true</canRoam>
+ <properties>
+ <hudson.model.ParametersDefinitionProperty>
+ <parameterDefinitions>
+ <hudson.model.StringParameterDefinition>
+ <name>INT_DEFAULT</name>
+ <description/>
+ <defaultValue>1</defaultValue>
+ </hudson.model.StringParameterDefinition>
+ </parameterDefinitions>
+ </hudson.model.ParametersDefinitionProperty>
+ </properties>
+ <scm class="hudson.scm.NullSCM"/>
+ <builders/>
+ <publishers/>
+ <buildWrappers/>
+</project>
+<?xml version="1.0" encoding="utf-8"?>
+<project>
+ <actions/>
+ <description>&lt;!-- Managed by Jenkins Job Builder --&gt;</description>
+ <keepDependencies>false</keepDependencies>
+ <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
+ <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
+ <concurrentBuild>false</concurrentBuild>
+ <canRoam>true</canRoam>
+ <properties>
<jenkins.model.BuildDiscarderProperty>
<strategy class="hudson.tasks.LogRotator">
<daysToKeep>+1</daysToKeep>
diff --git a/tests/yamlparser/fixtures/variable_default_values.yaml b/tests/yamlparser/fixtures/variable_default_values.yaml
index 7414cfe8..3f98bec0 100644
--- a/tests/yamlparser/fixtures/variable_default_values.yaml
+++ b/tests/yamlparser/fixtures/variable_default_values.yaml
@@ -3,6 +3,10 @@
jobs:
- 'variable_default_values':
defined_var: '7'
+ - 'test_int_default_{int}':
+ int: 0
+ - 'test_int_default_{int}':
+ int: 1
- job-template:
name: 'variable_default_values'
@@ -18,3 +22,10 @@
echo "{{defined_var|-1}}"
echo "{{undefined_var|+1}}"
echo "{{undefined_var|-1}}"
+
+- job-template:
+ name: 'test_int_default_{int}'
+ parameters:
+ - string:
+ name: INT_DEFAULT
+ default: '{int}'