We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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-pipeline-unit 1.16 jenkins-core 2.303.3
tried test with maven
in shared:
def call(Map config = [:]) { String testParam= config.getOrDefault('test', "my defaut param") // code here }
my test ( fake shared url here )
@TestInstance(TestInstance.Lifecycle.PER_CLASS) class JenkinsfileTest extends DeclarativePipelineTest { @Override @BeforeAll void setUp() throws Exception { super.setUp() } @Test void reproducer_1() { Object library = library() .name('shared-libraries') .retriever(gitSource('ssh://git@ssh_url/shared-libraries.git')) .targetPath('/') .defaultVersion("master") .allowOverride(true) .implicit(false) .build() helper.registerSharedLibrary(library) helper.registerAllowedMethod("myMethod",[Object], {Map args -> println "${args}"}) runInlineScript(""" @Library('shared-libraries') _ pipeline { stages { stage("my stage") { steps { myMethod test: 'wololo' } } } } """) assertJobStatusSuccess() } @Test void reproducer_2() { Object library = library() .name('shared-libraries') .retriever(gitSource('ssh://git@ssh_url/shared-libraries.git')) .targetPath('/') .defaultVersion("master") .allowOverride(true) .implicit(false) .build() helper.registerSharedLibrary(library) helper.registerAllowedMethod("myMethod",[Object], {Map args -> println "${args}"}) runInlineScript(""" @Library('shared-libraries') _ pipeline { stages { stage("my stage") { steps { myMethod() } } } } """) assertJobStatusSuccess() } } @Test void reproducer_3() { Object library = library() .name('shared-libraries') .retriever(gitSource('ssh://git@ssh_url/shared-libraries.git')) .targetPath('/') .defaultVersion("master") .allowOverride(true) .implicit(false) .build() helper.registerSharedLibrary(library) helper.registerAllowedMethod("myMethod",[], {}"}) runInlineScript(""" @Library('shared-libraries') _ pipeline { stages { stage("my stage") { steps { myMethod() } } } } """) assertJobStatusSuccess() } }
call the mock if no parameter in the method of shared.
if no parameter the real method is called.
No response
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Jenkins and plugins versions report
jenkins-pipeline-unit 1.16
jenkins-core 2.303.3
What Operating System are you using (both controller, and any agents involved in the problem)?
tried test with maven
Reproduction steps
in shared:
vars/myMethod.groovy
my test ( fake shared url here )
src/test/groovy/jenkinsfileTest.groovy
Expected Results
call the mock if no parameter in the method of shared.
Actual Results
if no parameter the real method is called.
Anything else?
No response
The text was updated successfully, but these errors were encountered: