Skip to content

Commit 88422aa

Browse files
sdaberdakunineinchnick
authored andcommitted
Refactor Trino Gateway test-connection
1 parent 74b9843 commit 88422aa

File tree

1 file changed

+32
-11
lines changed

1 file changed

+32
-11
lines changed

charts/gateway/templates/tests/test-connection.yaml

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ metadata:
1111
spec:
1212
containers:
1313
- name: curl
14-
image: alpine
14+
image: alpine/curl
1515
env:
1616
- name: NODE_IP
1717
valueFrom:
@@ -23,16 +23,37 @@ spec:
2323
- "sh"
2424
- "-c"
2525
- |
26-
apk add curl
27-
{{- if eq .Values.service.type "NodePort" -}}
28-
&& [ "$(curl -k --retry 3 --retry-all-errors --connect-timeout 5 --retry-delay 5 https://${NODE_IP}:30443/entity/GATEWAY_BACKEND )" = "[]" ] && [ "$(curl --retry 3 --retry-all-errors --connect-timeout 5 --retry-delay 5 http://${NODE_IP}:30080/entity/GATEWAY_BACKEND )" = "[]" ]
29-
{{- end }}
30-
{{- if index .Values "config" "serverConfig" "http-server.https.enabled" -}}
31-
&& [ "$(curl -k --retry 3 --retry-all-errors --connect-timeout 5 --retry-delay 5 -v https://{{ .Values.serviceName }}:8443/entity/GATEWAY_BACKEND )" = "[]" ]
32-
{{- end }}
33-
{{- if index .Values "config" "serverConfig" "http-server.http.enabled" -}}
34-
&& [ "$(curl --retry 3 --retry-all-errors --connect-timeout 5 --retry-delay 5 -v http://{{ .Values.serviceName }}:8080/entity/GATEWAY_BACKEND )" = "[]" ]
35-
{{- end }}
26+
{{ $curlOpts := "--fail --retry 5 --retry-all-errors --connect-timeout 10 --retry-delay 10 --verbose" }}
27+
{{- if eq .Values.service.type "NodePort" }}
28+
if curl {{ $curlOpts }} --insecure https://${NODE_IP}:30443/entity/GATEWAY_BACKEND; then
29+
echo "HTTPS connection to NodePort service successful"
30+
else
31+
echo "HTTPS connection to NodePort service failed"
32+
exit 1
33+
fi
34+
if curl {{ $curlOpts }} http://${NODE_IP}:30080/entity/GATEWAY_BACKEND; then
35+
echo "HTTP connection to NodePort service successful"
36+
else
37+
echo "HTTP connection to NodePort service failed"
38+
exit 1
39+
fi
40+
{{- end }}
41+
{{- if index .Values "config" "serverConfig" "http-server.https.enabled" }}
42+
if curl {{ $curlOpts }} --insecure https://{{ .Values.serviceName }}:8443/entity/GATEWAY_BACKEND; then
43+
echo "HTTPS connection to service successful"
44+
else
45+
echo "HTTPS connection to service failed"
46+
exit 1
47+
fi
48+
{{- end }}
49+
{{- if index .Values "config" "serverConfig" "http-server.http.enabled" }}
50+
if curl {{ $curlOpts }} http://{{ .Values.serviceName }}:8080/entity/GATEWAY_BACKEND; then
51+
echo "HTTP connection to service successful"
52+
else
53+
echo "HTTP connection to service failed"
54+
exit 1
55+
fi
56+
{{- end }}
3657
volumes:
3758
- name: persistence-sql
3859
emptyDir:

0 commit comments

Comments
 (0)