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
See this line: def target = new jenkinsci.plugins.influxdb.models.Target().
Because local gradle project does not define any dependency on this influxdb-plugin, this class is undefined. When I attempt to load my shared library, I get an error
file:/C:/W/jenkins_shared_library/test/resources/ReportTest_WhenUnstable.Jenkinsfile: 1: Error on loading library LuCI@master : startup failed:
C:\W\jenkins_shared_library\vars\dashboard.groovy: 101: unable to resolve class jenkinsci.plugins.influxdb.models.Target
@ line 101, column 22.
def target = new jenkinsci.plugins.influxdb.models.Target()
I'd like to instantiate a mock here.
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:
Hi @Warchant . I know it is a bit outdated but I stumbled upon the same issue in my testing. I resolved it by adding testImplementation dependency on the plugin. Like this:
Describe your use-case which is not covered by existing documentation.
Documentation lacks an example which shows how to mock object creation in the pipeline.
Specifically, my jenkins controller has this plugin installed: https://plugins.jenkins.io/influxdb/
And in my shared library I have a file:
/vars/dashboard.groovy
with a function that is similar to this: https://github.com/jenkinsci/influxdb-plugin#via-jenkins-pipelineSee this line:
def target = new jenkinsci.plugins.influxdb.models.Target()
.Because local gradle project does not define any dependency on this influxdb-plugin, this class is undefined. When I attempt to load my shared library, I get an error
I'd like to instantiate a mock here.
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: