JenkinsPipelineUnit icon indicating copy to clipboard operation
JenkinsPipelineUnit copied to clipboard

Cannot run inline script when shared library is loaded

Open grzegorzgrzegorz opened this issue 3 years ago • 9 comments

Jenkins and plugins versions report

Environment
Paste the output here

What Operating System are you using (both controller, and any agents involved in the problem)?

Windows

Reproduction steps

Unable to run this test:

import com.lesfurets.jenkins.unit.BasePipelineTest
import org.junit.Before
import org.junit.Test

import static com.lesfurets.jenkins.unit.global.lib.LibraryConfiguration.library
import static com.lesfurets.jenkins.unit.global.lib.ProjectSource.projectSource

class TestingExamplesFromGithub extends BasePipelineTest {

    @Override
    @Before
    void setUp() throws Exception {
        super.setUp()

        def library = library().name('commons')
                .defaultVersion('<notNeeded>')
                .allowOverride(true)
                .implicit(true)
                .targetPath('<notNeeded>')
                .retriever(projectSource())
                .build()
        helper.registerSharedLibrary(library)
    }

    @Test
    void testSomeScript() throws Exception {
        def script = runInlineScript('''
            node {
                stage('Build') {
                    echo 'make'
                }
            }
        ''')


        printCallStack()
        assertJobStatusSuccess()
    }

}

Expected Results

Test is run, stack is displayed, assertion is made.

Actual Results

Test is hanging.

Anything else?

When library is not loaded, the test can be executed successfully.

grzegorzgrzegorz avatar Jan 11 '22 14:01 grzegorzgrzegorz

What is this play with "bug" label about? Should it not be used at all? Could you explain it @nre-ableton ?

grzegorzgrzegorz avatar Feb 04 '22 13:02 grzegorzgrzegorz

I removed all labels except for "dependabot", which gets added automatically by the dependabot service by GitHub and can't be avoided. The labels weren't useful and just cluttered up the backlog.

nre-ableton avatar Feb 04 '22 14:02 nre-ableton