Skip to content

Commit

Permalink
fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gionn committed Feb 14, 2024
1 parent ba9db84 commit f5de67c
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ data:
{{- $search_url = printf "http://%s/solr" (include "alfresco-search-service.deployment.name" .) }}
{{- else if eq "elasticsearch" $search_flavor }}
{{- with .Values.elasticsearch }}
{{- if .enabled }}
{{- $esProto := .protocol | default "http" }}
{{- $esHost := printf "%s-%s" (.clusterName | default "elasticsearch") (.nodeGroup | default "master") }}
{{- $esPort := .port | default 9200 }}
{{- $search_url = coalesce $.Values.global.search.url (printf "%s://%s:%v" $esProto $esHost $esPort) }}
{{- else }}
{{- fail "Chart is configured to use Alfresco Search Enterprise but no index backend has been provided. Set one using either global.search.url or elasticsearch.enabled" }}
{{- end }}
{{- if .enabled }}
{{- $esProto := .protocol | default "http" }}
{{- $esHost := printf "%s-%s" (.clusterName | default "elasticsearch") (.nodeGroup | default "master") }}
{{- $esPort := .port | default 9200 }}
{{- $search_url = coalesce $.Values.global.search.url (printf "%s://%s:%v" $esProto $esHost $esPort) }}
{{- else }}
{{- fail "Chart is configured to use Alfresco Search Enterprise but no index backend has been provided. Set one using either global.search.url or elasticsearch.enabled" }}
{{- end }}
{{- end }}
{{- $search_comms := "" }}
{{- if hasPrefix "https://" $search_url }}
Expand Down
7 changes: 6 additions & 1 deletion helm/alfresco-content-services/tests/config-infra_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ tests:

- it: should render the default infra (solr)
values: *testvalues
set:
alfresco-search.enabled: true
alfresco-search-enterprise.enabled: false
alfresco-repository.configuration.search.flavor: solr6
asserts:
- equal:
path: data.BROKER_URL
Expand Down Expand Up @@ -128,10 +132,11 @@ tests:
- failedTemplate:
errorMEssage: >-
Alfresco Search Enterprise has been enabled but Transformation service is not available
- it: should fail rendering charts for enterprise components without ATS enterprise
values: *testvalues
set:
elasticsearch.enabled: true
alfresco-search-enterprise.enabled: false
alfresco-ai-transformer.enabled: true
alfresco-transform-service.filestore.enabled: false
asserts:
Expand Down
51 changes: 46 additions & 5 deletions helm/alfresco-content-services/tests/search_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,18 @@ templates:
- config-infrastructure.yaml
- secret-search.yaml
tests:
- it: should render default config (solr6 with secret)
- it: should render solr6 with secret
values: &testvalues
- values/test_values.yaml
set:
alfresco-search:
enabled: true
alfresco-search-enterprise:
enabled: false
alfresco-repository:
configuration:
search:
flavor: solr6
template: config-infrastructure.yaml
asserts:
- equal:
Expand All @@ -31,13 +40,21 @@ tests:
- equal:
path: data.SOLR_BASE_URL
value: /solr
- it: should render an external config
- it: should render an external config with solr
values: *testvalues
set:
global:
search:
url: https://mysearch.domain.tld:8984/search
sharedSecret: supersecret
alfresco-search:
enabled: true
alfresco-search-enterprise:
enabled: false
alfresco-repository:
configuration:
search:
flavor: solr6
template: config-infrastructure.yaml
asserts:
- equal:
Expand Down Expand Up @@ -102,14 +119,38 @@ tests:
- it: Should complain on missing search index
values: *testvalues
set:
alfresco-search:
elasticsearch:
enabled: false
alfresco-search-enterprise:
enabled: true
template: config-infrastructure.yaml
asserts:
- failedTemplate:
errorMessage: >-
Chart is configured to use Alfresco Search Enterprise but no index
backend has been provided. Set one using either global.search.url
or elasticsearch.enabled
- it: Should complain on search flavour mismatch
values: *testvalues
set:
alfresco-search:
enabled: true
alfresco-search-enterprise:
enabled: false
asserts:
- failedTemplate:
errorMessage: >-
.Values.alfresco-repository.search.flavor must be set to solr6
template: secret-search.yaml

- it: Should complain on search flavour mismatch (elasticsearch)
values: *testvalues
set:
alfresco-repository:
configuration:
search:
flavor: solr6
asserts:
- failedTemplate:
errorMessage: >-
.Values.alfresco-repository.search.flavor must be set to elasticsearch
template: secret-search.yaml

0 comments on commit f5de67c

Please sign in to comment.