It is also possible you keep the test execution as part of the Maven process/build. In that case Exec Maven Plugin ( https://www.mojohaus.org/exec-maven-plugin/usage.html) will be a good friend of yours. There are some plugins that help you deploy to Kubernetes easily (Jkube and some others). Once the services are up, you can run the test the way you want (Surefire, Robot Framework whatever) And after the tests tear down the services.
Maven actually has more lifecycles phases than most know ( https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html) Important for you might be the pre-integration-test (setup Kubernetest here) and post-integration-test (tear down resources here). Just make sure the test script itself will not fail the build and that the build failing is done in verify phase after tear down. Otherwise it becomes costly quickly. ma 6. kesäk. 2022 klo 7.57 David Karr (davidmichaelk...@gmail.com) kirjoitti: > Along the lines of Bernd's response, I would (as we have done in our own > builds) use Maven to build the artifacts that we deploy to our intranet > repositories, but we do everything else in Jenkins pipeline script. We just > call "kubectl" for k8s configuration steps, and when it comes down to > integration tests, we do stil use Maven Failsafe, but we supply the > host:port of the service in the cluster on the maven command line. > > On Sun, Jun 5, 2022 at 8:55 PM Bernd Eckenfels <e...@zusammenkunft.net> > wrote: > > > do you need to test K8s or just have some external containers to set up, > > maybe using Testcontainers with Docker APi is an alternative? (Advantage > is > > you can simpler test it locally) > > > > Another alternative is to use a CI pipeline script/system instead of > > orchestrating it in maven - at least if there is no plugin which does > what > > you need, instead from junit/testng (IT) test cases, using the kubernetes > > or f8 client might also be an option. > > > > Gruss > > Bernd > > > > > > -- > > http://bernd.eckenfels.net > > ________________________________ > > Von: Philipp Kraus <philipp.kr...@tu-clausthal.de> > > Gesendet: Monday, June 6, 2022 5:38:58 AM > > An: users@maven.apache.org <users@maven.apache.org> > > Betreff: Kubernetes Build Environment > > > > Hello, > > > > I need some idea how to solve this issue. I have got a MultiMaven > project, > > which has got multiple web services. Each service will be run later in a > > container in Kubernetes. > > I have found this plugin > > https://www.eclipse.org/jkube/docs/kubernetes-maven-plugin to build > > everything, but I would like to get integration testing within the > > Kubernetes environment, > > Because all services has got a Kafka connection and I would like to run > > some complex integration test directly from the Maven build. > > > > Can you give me some ideas how to do it? > > > > Thanks a lot > > >