简体   繁体   中英

Options or alternatives to Testcontainers for Spring Boot integration testing in Kubernetes?

I need to setup integration tests in a Spring Boot project using Postgres, Redis and Elasticsearch (at some point later also Kafka will be added). So far I've found two options:

  1. H2 Database and Embedded Redis. This could work but we are using some Postgres specific functions in some of our queries so this would not allow to cover all the cases.
  2. Testcontainers . This looked perfect but apparently it's not possible to run those in pipeline since we are using Kubernetes

Third option requires a bit of manual work. It's definitely possible to make a docker compose file with all the services needed for testing for local usage and let infrastructure team build containers the way they want for running tests in a pipeline. But this way a developer would have to manually start/stop those containers when running tests locally.

Is there a way to automate this process? Or any options similar to Testcontainers that would work in Kubernetes? Or perhaps there is a way to run Testcontainers in Kubernetes?

Thank you in advance.

You can run testcontainers in Kubernetes based builds. You just need a container runtime available in your build (container). This could be rootless docker and is independent of the container runtime used by your kubernetes cluster.

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