New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[JENKINS-31967] Specifying decimal numbers for JUnit health factor in Pipeline snippets results in invalid code #116
[JENKINS-31967] Specifying decimal numbers for JUnit health factor in Pipeline snippets results in invalid code #116
Conversation
The |
Could probably pick up a snapshot dependency on jenkinsci/structs-plugin#16 to do a proper integration test here. |
Can tell how I should do it? |
if (clazz == Boolean.class || clazz == Integer.class || clazz == Long.class) { | ||
if (clazz == Boolean.class || clazz == Integer.class || clazz == Long.class || | ||
clazz == Float.class || clazz == Double.class || | ||
clazz == Byte.class || clazz == Short.class) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC there is some utility in Commons Lang for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(forget it)
Just change the dependency version on |
@@ -66,6 +66,7 @@ | |||
import org.kohsuke.stapler.QueryParameter; | |||
import org.kohsuke.stapler.Stapler; | |||
import org.kohsuke.stapler.StaplerRequest; | |||
import org.springframework.util.ClassUtils; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mm, rather not use springframework
please. Better just revert this last change.
If you want to do this, you need to not just have a dependency on new |
This reverts commit 51fc587.
pom.xml
Outdated
@@ -103,7 +103,7 @@ | |||
<dependency> | |||
<groupId>org.jenkins-ci.plugins</groupId> | |||
<artifactId>structs</artifactId> | |||
<version>1.6</version> | |||
<version>1.7-20170522.183630-2</version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Released; use 1.7.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you were missing my point here. The patch to structs
already demonstrates theoretical coverage. I was suggesting an integration test to prove that the actual case most commonly reported really works. For example in master
this test
@Issue("JENKINS-31967")
@Test public void junit() throws Exception {
JUnitResultArchiver a = new JUnitResultArchiver("*.xml");
st.assertRoundTrip(new CoreStep(a), "junit '*.xml'");
a.setHealthScaleFactor(0.5);
st.assertRoundTrip(new CoreStep(a), "junit healthScaleFactor: 0.5, testResults: '*.xml'");
}
fails:
org.junit.ComparisonFailure: expected:<... healthScaleFactor: [0.5], testResults: '*.xm...> but was:<... healthScaleFactor: [<object of type java.lang.Double>], testResults: '*.xm...>
and I would expect it to succeed, which would demonstrate both that DescribableModel
correctly handled double
values, and that Snippetizer
correctly rendered them as Groovy source.
…rting-java-standard-types
https://issues.jenkins-ci.org/browse/JENKINS-31967