简体   繁体   中英

Jenkins + Docker Compose + Integration Tests

I have a crazy idea to run integration tests (xUnit in .Net) in the Jenkins pipeline by using Docker Compose. The goal is to create testing environment ad-hoc and run integration tests form Jenkins (and Visual Studio) wthout using DBs etc. on physical server. In my previous project sometimes there was a case, when two builds override test data from the second build and I would like to avoid it.

The plan is the following:

  1. Add dockerfile for each test project
  2. Add references in the docker compose file (with creation of DBs on docker)
  3. Add step in the Jenkins that will run integration tests

I have no long experience with contenerization, so I cannot predict what problems can appear.

The questions are:

  1. Does it have any sence?
  2. Is it possible?
  3. Can it be done simpler?
  4. I suppose that Visual Sutio test runner won't be able to get results from the docker images. I am right?
  5. It looks that development of tests will be more difficult, because test will be run on the docker. I am right?

Thanks for all your suggestions.

  1. Depends very much on the details. In a small project - no, in a big project with multiple micro services and many devs - sure.
  2. Absolutely. Anything that can be done with shell commands can be automated with Jenkins
  3. Yes, just have a test DB running somewhere. Or just run it locally with a simple script. Automation and containerization is the opposite of simple, you would only do it if the overhead is worth it in the long run
  4. Normally it wouldn't even run on the same machine, so that could be tricky. I am no VS Code expert though
  5. The goal of containers is to make it simpler because the environment does not change, but they add configuration overhead. Most days it shouldn't make a difference but whenever you make a big change it will cost some time.

I'd say running a Jenkins on your local machine is rarelly worth it, you could just use docker locally with scripts (bash or WSL).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM