Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NodePorts are still there after test execution #8

Open
andraspatka opened this issue Sep 9, 2021 · 1 comment
Open

NodePorts are still there after test execution #8

andraspatka opened this issue Sep 9, 2021 · 1 comment

Comments

@andraspatka
Copy link

andraspatka commented Sep 9, 2021

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

@JeanBaptisteWATENBERG
Copy link
Owner

Hello,

Thanks for reporting this detailed issue 👍 .
I will look into it next week.

I'm indeed aware of the issue of pods and services remaining in case of tests process execution interruption but not yet have a viable solution for it, something to come in the upcoming version for sure.

Thanks and regards,
Jean-Baptiste

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants