You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe your use-case which is not covered by existing documentation.
I am currently trying to dig through the existing docs and issues to get a grasp on how the following case should be handled correctly, but everything I tried seems to fail in the one or the other way.
Let's suppose we have the following files which are running fine in Jenkins itself (this is a very simplified example:
But it seems like the constants are not available inside the corresponding method, as well as I could not get it working to access them from the test class as well:
UtilsTest > testSetValue() FAILED
groovy.lang.MissingPropertyException: No such property: KEY for class: org.codehaus.groovy.runtime.InvokerHelper$2
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:67)
at org.codehaus.groovy.vmplugin.v8.IndyGuardsFiltersAndSignatures.unwrap(IndyGuardsFiltersAndSignatures.java:161)
at org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:321)
at utils.setValue(utils.groovy:7)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:343)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:328)
at groovy.lang.MetaMethod$doMethodInvoke.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
at groovy.lang.MetaMethod$doMethodInvoke.call(Unknown Source)
at com.lesfurets.jenkins.unit.PipelineTestHelper.callMethod(PipelineTestHelper.groovy:323)
at jdk.internal.reflect.GeneratedMethodAccessor48.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:343)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:328)
at groovy.lang.MetaClassImpl.doInvokeMethod(MetaClassImpl.java:1332)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1087)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1006)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:789)
at com.lesfurets.jenkins.unit.PipelineTestHelper.invokeMethod(PipelineTestHelper.groovy)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:70)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:203)
at com.lesfurets.jenkins.unit.PipelineTestHelper$_closure3.doCall(PipelineTestHelper.groovy:310)
at jdk.internal.reflect.GeneratedMethodAccessor40.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:343)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaMethod.invoke(ClosureMetaMethod.java:88)
at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1140)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1006)
at org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:321)
at tests.groovy.vars.UtilsTest.testSetValue(UtilsTest.groovy:34)
What would be the preferred way to grant both the implementation and the tests access to the constants defined inside the Constants class?
Reference any relevant documentation, other materials or issues/pull requests that can be used for inspiration.
No response
The text was updated successfully, but these errors were encountered:
Describe your use-case which is not covered by existing documentation.
I am currently trying to dig through the existing docs and issues to get a grasp on how the following case should be handled correctly, but everything I tried seems to fail in the one or the other way.
Let's suppose we have the following files which are running fine in Jenkins itself (this is a very simplified example:
Now I want to test that setting the value actually works:
But it seems like the constants are not available inside the corresponding method, as well as I could not get it working to access them from the test class as well:
What would be the preferred way to grant both the implementation and the tests access to the constants defined inside the
Constants
class?Reference any relevant documentation, other materials or issues/pull requests that can be used for inspiration.
No response
The text was updated successfully, but these errors were encountered: