jeanbaptistewatenberg / junit5-kubernetes Goto Github PK
View Code? Open in Web Editor NEWUse kubernetes pod from your Junit5 test classes
License: Other
Use kubernetes pod from your Junit5 test classes
License: Other
Hi @JeanBaptisteWATENBERG , currently we experience a problem starting additional Pods in k8s cluster (we get {"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"Internal error occurred: failed to allocate a nodePort: range is full","reason":"InternalError","details":{"causes":[{"message":"failed to allocate a nodePort: range is full"}]},"code":500}
)
A lot of services just stay there after test completion and don't release the ports.
Could it be related to not deleting related services in
The #6 issue addressed this already, and the fix seemed to solve the maven problem, but unfortunately the problem still persists and the services remain there.
The Pod is started as expected:
Sep. 09, 2021 9:21:16 VORM. test.KubernetesIbmMqTestResource
INFO: IBM MQ Pod starting
Sep. 09, 2021 9:21:36 VORM. test.KubernetesPostgresResource
INFO: Postgres-Pod starting
Sep. 09, 2021 9:21:52 VORM. test.KubernetesPostgresResource
INFO: Postgres-Pod URL: jdbc:postgresql://localhost:31533/postgres?currentSchema=public&stringtype=unspecified
Sep. 09, 2021 9:21:52 VORM. test.WireMockResource
INFO: Starting WireMock-Server
But when trying to connect to it, an error is raised:
java.lang.RuntimeException: java.lang.RuntimeException: Failed to start quarkus
Caused by: java.lang.RuntimeException: Failed to start quarkus
Caused by: org.flywaydb.core.internal.exception.FlywaySqlException:
Unable to obtain connection from database: Connection to localhost:31533 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL State : 08001
Error Code : 0
Message : Connection to localhost:31533 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
Caused by: org.postgresql.util.PSQLException: Connection to localhost:31533 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
Caused by: java.net.ConnectException: Connection refused: connect
When running kubectl get svc -n <project-namespace>
the output is the following:
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
junit5-kubernetes-pod-0365a355 NodePort 10.96.57.131 <none> 5432:30856/TCP 59d
junit5-kubernetes-pod-04928e54 NodePort 10.104.40.95 <none> 5432:30251/TCP 59d
junit5-kubernetes-pod-054811ca NodePort 10.108.5.62 <none> 10389:31694/TCP 12d
junit5-kubernetes-pod-0671bb44 NodePort 10.108.97.187 <none> 5432:30751/TCP 59d
junit5-kubernetes-pod-068f3cdb NodePort 10.102.236.237 <none> 5432:31705/TCP 59d
junit5-kubernetes-pod-09111b1f NodePort 10.101.212.136 <none> 1414:32450/TCP 12d
junit5-kubernetes-pod-0dc79bc2 NodePort 10.100.15.123 <none> 10389:30863/TCP 12d
junit5-kubernetes-pod-0f9d5f85 NodePort 10.100.159.48 <none> 5432:30992/TCP 59d
junit5-kubernetes-pod-103fbc7a NodePort 10.100.93.197 <none> 5432:32753/TCP 12d
junit5-kubernetes-pod-183e19aa NodePort 10.96.80.215 <none> 5432:31647/TCP 58d
junit5-kubernetes-pod-1b507e7e NodePort 10.98.109.105 <none> 5432:30662/TCP 59d
junit5-kubernetes-pod-1d55e694 NodePort 10.97.47.177 <none> 5432:32105/TCP 58d
junit5-kubernetes-pod-1daf5660 NodePort 10.103.179.20 <none> 5432:32161/TCP 12d
junit5-kubernetes-pod-202a146d NodePort 10.104.237.15 <none> 5432:32295/TCP 58d
junit5-kubernetes-pod-205e5a10 NodePort 10.108.38.122 <none> 1414:30521/TCP 12d
junit5-kubernetes-pod-229c453e NodePort 10.96.31.11 <none> 1414:30066/TCP 7d
junit5-kubernetes-pod-26753c17 NodePort 10.97.25.2 <none> 5432:30359/TCP 58d
junit5-kubernetes-pod-27229f54 NodePort 10.107.191.235 <none> 5432:31816/TCP 59d
junit5-kubernetes-pod-2abd20db NodePort 10.106.173.152 <none> 1414:30967/TCP 9d
junit5-kubernetes-pod-2afbc2d7 NodePort 10.106.39.122 <none> 5432:32349/TCP 12d
junit5-kubernetes-pod-2cd23058 NodePort 10.97.197.149 <none> 5432:30803/TCP 12d
junit5-kubernetes-pod-2dfe19ea NodePort 10.103.28.46 <none> 5432:32575/TCP 12d
junit5-kubernetes-pod-32868039 NodePort 10.102.104.75 <none> 1414:30284/TCP 9d
junit5-kubernetes-pod-33cc701e NodePort 10.103.150.79 <none> 1414:31566/TCP 9d
junit5-kubernetes-pod-3b118ec1 NodePort 10.97.72.144 <none> 5432:32497/TCP 59d
junit5-kubernetes-pod-3dc8c7fd NodePort 10.99.52.84 <none> 5432:30408/TCP 30d
junit5-kubernetes-pod-3e07f270 NodePort 10.103.177.172 <none> 10389:32590/TCP 12d
junit5-kubernetes-pod-40451997 NodePort 10.107.79.41 <none> 5432:32436/TCP 58d
junit5-kubernetes-pod-40c4b1b9 NodePort 10.102.35.208 <none> 5432:30597/TCP 59d
junit5-kubernetes-pod-42a4bd4f NodePort 10.96.8.44 <none> 5432:32442/TCP 9d
junit5-kubernetes-pod-46b48bc3 NodePort 10.105.216.66 <none> 5432:31171/TCP 59d
junit5-kubernetes-pod-47217823 NodePort 10.108.114.65 <none> 5432:30955/TCP 58d
junit5-kubernetes-pod-4a59792b NodePort 10.107.36.164 <none> 1414:32722/TCP 12d
junit5-kubernetes-pod-4cd8e471 NodePort 10.110.21.116 <none> 5432:31015/TCP 59d
junit5-kubernetes-pod-4da08431 NodePort 10.106.187.234 <none> 5432:31710/TCP 59d
junit5-kubernetes-pod-4e57faf8 NodePort 10.101.208.174 <none> 1414:30560/TCP 9d
junit5-kubernetes-pod-4e60fa0b NodePort 10.99.209.250 <none> 5432:31786/TCP 58d
junit5-kubernetes-pod-4ef5b0b0 NodePort 10.98.149.190 <none> 5432:32656/TCP 59d
junit5-kubernetes-pod-54ae575a NodePort 10.111.148.162 <none> 5432:30057/TCP 2d19h
junit5-kubernetes-pod-54c3e90e NodePort 10.110.60.151 <none> 1414:32737/TCP 12d
... and a lot more
After running kubectl delete --all svc --namespace=<project-namespace>
, the tests will run as expected.
Could you please take a look at it? It seems like the services still stick around, despite the pods being deleted.
A known problem is, when stopping the mvn test
command with ctrl + c, then the pods don't get deleted and obviously the service will also stick around.
However, I investigated it and saw that the NodePort still sticks around for a pod which gets stopped after test execution.
mvn version: 3.8.2
k8s version: v1.19.7
Docker-desktop K8s is used. Docker-desktop version: 3.5.2
junit5-kubernetes version: 2.3.1-beta
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.