Skip to content

Commit

Permalink
Improve error message readability
Browse files Browse the repository at this point in the history
  • Loading branch information
afalhambra-hivemq committed Dec 3, 2024
1 parent 9907229 commit 6cfc234
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions charts/hivemq-platform/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ Usage: {{ include "hivemq-platform.validate-hivemq-listener-name-services" . }}
{{- $services := .Values.services }}
{{- range $service := $services }}
{{- if and ($service.exposed) (hasKey $service "hivemqListenerName") (and (not (eq $service.type "mqtt")) (not (eq $service.type "websocket"))) }}
{{- fail (printf "Service type `%s` with container port `%d` is using `hivemqListenerName` value. HiveMQ listener names are only supported by MQTT and WebSocket services" $service.type (int64 $service.containerPort)) }}
{{- fail (printf "\nService type `%s` with container port `%d` is using `hivemqListenerName` value. HiveMQ listener names are only supported by MQTT and WebSocket services" $service.type (int64 $service.containerPort)) }}
{{- end }}
{{- end }}
{{- end -}}
Expand All @@ -512,10 +512,10 @@ Usage: {{ include "hivemq-platform.validate-external-traffic-policy" . }}
{{- $services := .Values.services }}
{{- range $service := $services }}
{{- if and ($service.exposed) (hasKey $service "externalTrafficPolicy") (not (hasKey $service "serviceType")) }}
{{- fail (printf "Service type `%s` with container port `%d` is using `externalTrafficPolicy` value but `serviceType` value is not defined. Service type value is mandatory when using external traffic policy" $service.type (int64 $service.containerPort)) }}
{{- fail (printf "\nService type `%s` with container port `%d` is using `externalTrafficPolicy` value but `serviceType` value is not defined. Service type value is mandatory when using external traffic policy" $service.type (int64 $service.containerPort)) }}
{{- end }}
{{- if and ($service.exposed) (hasKey $service "externalTrafficPolicy") (hasKey $service "serviceType") (and (not (eq $service.serviceType "NodePort")) (not (eq $service.serviceType "LoadBalancer")) ) }}
{{- fail (printf "Service type `%s` with container port `%d` is using `externalTrafficPolicy` value. External traffic policy is only supported by NodePort and LoadBalancer service types" $service.serviceType (int64 $service.containerPort)) }}
{{- fail (printf "\nService type `%s` with container port `%d` is using `externalTrafficPolicy` value. External traffic policy is only supported by NodePort and LoadBalancer service types" $service.serviceType (int64 $service.containerPort)) }}
{{- end }}
{{- end }}
{{- end -}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ tests:
hivemqListenerName: foobar
asserts:
- failedTemplate:
errorMessage: Service type `control-center` with container port `8081` is using `hivemqListenerName` value. HiveMQ listener names are only supported by MQTT and WebSocket services
errorPattern: Service type `control-center` with container port `8081` is using `hivemqListenerName` value. HiveMQ listener names are only supported by MQTT and WebSocket services

- it: with a Control Center service disabled and HiveMQ listener name enabled, validation succeeds
set:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,7 @@ tests:
hivemqListenerName: foobar
asserts:
- failedTemplate:
errorMessage: Service type `metrics` with container port `9399` is using `hivemqListenerName` value. HiveMQ listener names are only supported by MQTT and WebSocket services
errorPattern: Service type `metrics` with container port `9399` is using `hivemqListenerName` value. HiveMQ listener names are only supported by MQTT and WebSocket services

- it: with a Metrics service disabled and HiveMQ listener name enabled, validation succeeds
set:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ tests:
hivemqListenerName: foobar
asserts:
- failedTemplate:
errorMessage: Service type `rest-api` with container port `8888` is using `hivemqListenerName` value. HiveMQ listener names are only supported by MQTT and WebSocket services
errorPattern: Service type `rest-api` with container port `8888` is using `hivemqListenerName` value. HiveMQ listener names are only supported by MQTT and WebSocket services

- it: with a REST API service disabled and HiveMQ listener name enabled, validation succeeds
set:
Expand Down

0 comments on commit 6cfc234

Please sign in to comment.