JenkinsRule and docker

13 views
Skip to first unread message

Ullrich Hafner

unread,
Apr 25, 2019, 7:06:03 PM4/25/19
to Jenkins Developers
I’m currently trying to write some integration tests with Jenkins test harness (i.e. JenkinsRule) that were previously part of ATH. For some of the ATH concepts I did not yet find a counterpart in our integration tests.

Is someone already writing integration tests that use agents that are provided by a docker container and has an example to share?

Since my plugins interact with Git I want to create a Git Repository in the test setup with fake data. Do we have a kind of API to fill a Git repository (like GitRepo in ATH)?

Message has been deleted

Joseph P

unread,
Apr 25, 2019, 9:14:45 PM4/25/19
to Jenkins Developers
We have some integrations tests for Vault, I would imagine it could be very similar to a git docker container.

Mark Waite

unread,
Apr 25, 2019, 9:54:56 PM4/25/19
to jenkinsci-dev
If you already depend on the git plugin, you could consider using TestGtiRepo from the git plugin tests as somewhat of a convenience class for a git repository.  If you already depend on the git client plugin, you could consider using CliGitCommand as a convenience method to perform calls to command line git.

--
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-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/8dcc3860-231b-4367-8a3f-46c475f7cbaa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Thanks!
Mark Waite

Jesse Glick

unread,
Apr 25, 2019, 10:27:09 PM4/25/19
to Jenkins Dev
On Thu, Apr 25, 2019 at 7:06 PM Ullrich Hafner <ullrich...@gmail.com> wrote:
> Is someone already writing integration tests that use agents that are provided by a docker container and has an example to share?

Various plugins use the `docker-fixtures` library for this. For
example, with `DockerClassRule<JavaContainer>` it is straightforward
to start a simple SSH agent in a container. Of course you can create a
subclass with specialized tools installed in the image. This is the
same library ATH uses, by the way.

> Since my plugins interact with Git I want to create a Git Repository in the test setup with fake data. Do we have a kind of API to fill a Git repository (like GitRepo in ATH)?

`GitSampleRepoRule` is available with a dep on the `tests` classifier
of the `git` plugin. This is used widely in Pipeline-related plugins.

It does not look like either this nor `TestGitRepo` are currently set
up to handle remote repositories (in a Docker container) like
`GitRepo.transferToDockerContainer` does, so that would be an obstacle
if you had a single test which needed to run an agent in a container
_and_ have that agent access a sample Git repository.
Reply all
Reply to author
Forward
0 new messages