Skip to content
Snippets Groups Projects
Commit 2df6ed22 authored by Bastian Heppener's avatar Bastian Heppener
Browse files

Merge branch 'ozg-8071-zufi-search-uri' into 'main'

ozg-8071 adjust zufi search url

See merge request !15
parents b20946e0 40fbcfc4
No related branches found
No related tags found
1 merge request!15ozg-8071 adjust zufi search url
...@@ -24,7 +24,11 @@ ...@@ -24,7 +24,11 @@
{{- define "app.baseDomain" -}} {{- define "app.baseDomain" -}}
{{- printf "%s-%s.%s" (.Values.ozgcloud).bezeichner (.Values.ozgcloud).adminDomainSuffix .Values.baseUrl }} {{- printf "%s-%s.%s" (.Values.ozgcloud).bezeichner (.Values.ozgcloud).adminDomainSuffix ( include "app.getBaseUrl" . ) }}
{{- end -}}
{{- define "app.getBaseUrl" -}}
{{- required "baseUrl muss angegeben sein" .Values.baseUrl }}
{{- end -}} {{- end -}}
{{/* Namespace */}} {{/* Namespace */}}
...@@ -101,3 +105,19 @@ app.kubernetes.io/namespace: {{ include "app.namespace" . }} ...@@ -101,3 +105,19 @@ app.kubernetes.io/namespace: {{ include "app.namespace" . }}
{{- define "app.serviceAccountName" -}} {{- define "app.serviceAccountName" -}}
{{ printf "%s" ( (.Values.serviceAccount).name | default "administration-service-account" ) }} {{ printf "%s" ( (.Values.serviceAccount).name | default "administration-service-account" ) }}
{{- end -}} {{- end -}}
{{- define "app.getZufiSearchUri" -}}
{{ if ((.Values.ozgcloud).organisationEinheit).zufiSearchUri }}
{{- printf "%s" .Values.ozgcloud.organisationEinheit.zufiSearchUri }}
{{- else -}}
{{- printf "https://%s/api/organisationseinheits?searchBy={searchBy}" ( include "app.generateAlfaUrl" . ) }}
{{- end -}}
{{- end -}}
{{- define "app.generateAlfaUrl" -}}
{{ if (.Values.ozgcloud).alfaUrl }}
{{- printf "%s" .Values.ozgcloud.alfaUrl }}
{{- else -}}
{{- printf "%s.%s" ( include "app.ozgcloudBezeichner" . ) ( include "app.getBaseUrl" . ) }}
{{- end -}}
{{- end -}}
\ No newline at end of file
...@@ -129,7 +129,7 @@ spec: ...@@ -129,7 +129,7 @@ spec:
{{- end }} {{- end }}
{{- if eq ((.Values.ozgcloud).feature).organisationsEinheiten "true" }} {{- if eq ((.Values.ozgcloud).feature).organisationsEinheiten "true" }}
- name: ozgcloud_organisationeinheit_zufisearchuri - name: ozgcloud_organisationeinheit_zufisearchuri
value: {{ required "ozgcloud.organisationEinheit.zufiSearchUri must be set if feature organisationsEinheiten is activated" ((.Values.ozgcloud).organisationEinheit).zufiSearchUri}} value: {{ include "app.getZufiSearchUri" . }}
{{- end }} {{- end }}
envFrom: envFrom:
{{- if (.Values.database).useExternal }} {{- if (.Values.database).useExternal }}
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
# #
replicaCount: 1 replicaCount: 1
baseUrl: ozg-sh.de baseUrl:
ozgcloud: ozgcloud:
bezeichner: helm bezeichner: helm
......
...@@ -41,8 +41,6 @@ tests: ...@@ -41,8 +41,6 @@ tests:
ozgcloud: ozgcloud:
feature: feature:
organisationsEinheiten: "false" organisationsEinheiten: "false"
organisationEinheit:
zufiSearchUri: alfa/zufi/search/endpoint?searchBy={searchBy}
asserts: asserts:
- notContains: - notContains:
path: spec.template.spec.containers[0].env path: spec.template.spec.containers[0].env
...@@ -50,34 +48,54 @@ tests: ...@@ -50,34 +48,54 @@ tests:
name: ozgcloud_organisationeinheit_zufisearchuri name: ozgcloud_organisationeinheit_zufisearchuri
any: true any: true
- it: should not contain zufi search uri if organisationseinheit feature toggle is disabled - it: should not contain zufi search uri if organisationseinheit feature toggle is disabled
set:
ozgcloud:
organisationEinheit:
zufiSearchUri: alfa/zufi/search/endpoint?searchBy={searchBy}
asserts: asserts:
- notContains: - notContains:
path: spec.template.spec.containers[0].env path: spec.template.spec.containers[0].env
content: content:
name: ozgcloud_organisationeinheit_zufisearchuri name: ozgcloud_organisationeinheit_zufisearchuri
any: true any: true
- it: should generate zufi search uri
set:
ozgcloud:
feature:
organisationsEinheiten: "true"
baseUrl: ozg-sh.de
asserts:
- contains:
path: spec.template.spec.containers[0].env
content:
name: ozgcloud_organisationeinheit_zufisearchuri
value: https://helm.ozg-sh.de/api/organisationseinheits?searchBy={searchBy}
- it: should set zufi search uri - it: should set zufi search uri
set: set:
ozgcloud: ozgcloud:
feature: feature:
organisationsEinheiten: "true" organisationsEinheiten: "true"
organisationEinheit: organisationEinheit:
zufiSearchUri: alfa/zufi/search/endpoint?searchBy={searchBy} zufiSearchUri: "https://company.local/api/organisationseinheits?searchBy={searchBy}"
asserts:
- contains:
path: spec.template.spec.containers[0].env
content:
name: ozgcloud_organisationeinheit_zufisearchuri
value: "https://company.local/api/organisationseinheits?searchBy={searchBy}"
- it: should set alfa url
set:
ozgcloud:
feature:
organisationsEinheiten: "true"
alfaUrl: "alfa.local"
asserts: asserts:
- contains: - contains:
path: spec.template.spec.containers[0].env path: spec.template.spec.containers[0].env
content: content:
name: ozgcloud_organisationeinheit_zufisearchuri name: ozgcloud_organisationeinheit_zufisearchuri
value: alfa/zufi/search/endpoint?searchBy={searchBy} value: "https://alfa.local/api/organisationseinheits?searchBy={searchBy}"
- it: should fail if zufi search uri is not set - it: should fail without baseUrl and alfaUrl and zufiSearchUrl
set: set:
ozgcloud: ozgcloud:
feature: feature:
organisationsEinheiten: "true" organisationsEinheiten: "true"
asserts: asserts:
- failedTemplate: - failedTemplate:
errorMessage: "ozgcloud.organisationEinheit.zufiSearchUri must be set if feature organisationsEinheiten is activated" errorMessage: "baseUrl muss angegeben sein"
\ No newline at end of file
...@@ -33,6 +33,7 @@ set: ...@@ -33,6 +33,7 @@ set:
bundesland: by bundesland: by
bezeichner: helm bezeichner: helm
environment: test environment: test
baseUrl: ozg-sh.de
tests: tests:
- it: should contain header data - it: should contain header data
set: set:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment