On Mon, Jun 27, 2022 at 4:37 PM steven...@gmail.com <steventerr...@gmail.com>
wrote:

> Does anyone know if it's possible to configure the Jenkins Test Harness to
> forego standing up an ephemeral Jenkins instance and instead use a
> controller at a given URL with authentication?
>

No, it is not designed for that.

I'm interested in writing integration tests for pipeline libraries.
>

You can do that with `JenkinsRule` if you set up the library definition and
any associated context & infrastructure.
https://github.com/jenkinsci/pipeline-groovy-lib-plugin/blob/aafc25d520e96733e3cfa4b46d1bfdcd015a350e/src/test/java/org/jenkinsci/plugins/workflow/libs/LibraryAdderTest.java#L327-L343
for example.

nothing beats the real thing when testing
>

If by *real thing *you mean an existing server whose configuration you have
somehow managed and presume is stable enough, because you cannot readily
mock out everything you interact with, then there is another way:
https://github.com/jenkinsci/pipeline-groovy-lib-plugin/blob/8fb8c55868cc91791f7e5bc39c40594597329128/src/test/java/org/jenkinsci/plugins/workflow/libs/SCMRetrieverTest.java#L58-L98
The key bit is to create a `Jenkinsfile` in the library which loads itself
via the near-magical `retriever: legacySCM(scm)` idiom and then runs some
smoke tests by way of either passing or failing the build. If you create a
multibranch project on your real controller based on this repo, you can
file a PR refactoring the library and check whether it works in the real
context.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr3Dq0kmpT5Eg8TjL8KJiaAvx_G-CNsx5Kno5APj7MCCBQ%40mail.gmail.com.

Reply via email to