diff --git a/charts/README.md b/charts/README.md index 1bcd31f34c1..d2527c5215c 100644 --- a/charts/README.md +++ b/charts/README.md @@ -141,10 +141,30 @@ When deploying in GCP, the following steps may be taken to use container-native ## Testing To verify the chart installation is successful, you can run the helm tests. These tests are not automatically executed -by helm on install/upgrade, they have to be executed manually: +by helm on install/upgrade, they have to be executed manually. The tests require the `existingTopicNum`, `operatorId`, +and `operatorKey` properties be set in a local values file in order to execute, as well as `network` if using an environment other +than testnet, and `nodes` if using a custom environment. + +To configure: + +```yaml +test: + config: + hedera: + mirror: + test: + acceptance: + existingTopicNum: + network: + # Do not use use 0.0.2 or 0.0.50 for operator to ensure crypto transfers are not waived + operatorId: + operatorKey: +``` + +To execute: ```shell script -helm test "${RELEASE}" +helm test "${RELEASE} " --timeout 10m ``` ## Using diff --git a/charts/hedera-mirror/templates/tests/pod.yaml b/charts/hedera-mirror/templates/tests/pod.yaml new file mode 100644 index 00000000000..30ab0a80fc7 --- /dev/null +++ b/charts/hedera-mirror/templates/tests/pod.yaml @@ -0,0 +1,34 @@ +{{- if .Values.test.enabled -}} +apiVersion: v1 +kind: Pod +metadata: + labels: {{- include "hedera-mirror.labels" . | nindent 4 }} + name: {{ include "hedera-mirror.fullname" . }}-acceptance-test + namespace: {{ include "hedera-mirror.namespace" . }} + annotations: + helm.sh/hook: test + helm.sh/hook-delete-policy: hook-failed,hook-succeeded +spec: + containers: + - name: acceptance-tests + image: "{{ .Values.test.image.repository }}:{{ .Values.global.image.tag | default .Values.test.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.test.image.pullPolicy }} + command: + - 'sh' + - '-c' + # Copying the contents of the secret to the directory the image reads from without overwriting the existing yml. + - | + cp /etc/secrets/* /usr/etc/hedera-mirror-node/hedera-mirror-test/src/test/resources/ + ./mvnw integration-test --projects hedera-mirror-test/ -P=acceptance-tests -Dcucumber.filter.tags={{ .Values.test.cucumberTags }} + volumeMounts: + - name: acceptance-tests + mountPath: /etc/secrets + readOnly: true + restartPolicy: Never + terminationGracePeriodSeconds: 1 + volumes: + - name: acceptance-tests + secret: + defaultMode: 420 + secretName: {{ include "hedera-mirror.fullname" . }}-acceptance-test +{{- end -}} diff --git a/charts/hedera-mirror/templates/tests/secret.yaml b/charts/hedera-mirror/templates/tests/secret.yaml new file mode 100644 index 00000000000..faa53e271e4 --- /dev/null +++ b/charts/hedera-mirror/templates/tests/secret.yaml @@ -0,0 +1,16 @@ +{{- if .Values.test.enabled -}} +apiVersion: v1 +kind: Secret +metadata: + labels: {{ include "hedera-mirror.labels" . | nindent 4 }} + name: {{ include "hedera-mirror.fullname" . }}-acceptance-test + namespace: {{ include "hedera-mirror.namespace" . }} + annotations: + helm.sh/hook: test + helm.sh/hook-delete-policy: hook-failed,hook-succeeded +type: Opaque +stringData: + # application-default.yml as application.yml will overwrite the existing yml in the hedera-mirror-test image. + application-default.yml: |- + {{- tpl (toYaml .Values.test.config) $ | nindent 4 }} +{{- end -}} diff --git a/charts/hedera-mirror/values.yaml b/charts/hedera-mirror/values.yaml index 5aa4f05d8a2..7e3056b9d41 100644 --- a/charts/hedera-mirror/values.yaml +++ b/charts/hedera-mirror/values.yaml @@ -48,10 +48,6 @@ applicationResource: partnerName: "" solutionId: "" -global: - namespaceOverride: "" - useReleaseForNameLabel: false # Set the name label to the release name for Marketplace - db: host: "{{ .Release.Name }}" name: mirror_node @@ -60,6 +56,11 @@ db: password: "" # Randomly generated if left blank username: mirror_node +global: + image: {} + namespaceOverride: "" + useReleaseForNameLabel: false # Set the name label to the release name for Marketplace + grpc: db: password: "" # Randomly generated if left blank @@ -259,6 +260,29 @@ rest: name: mirror-passwords key: HEDERA_MIRROR_IMPORTER_DB_RESTUSERNAME +test: + config: + hedera: + mirror: + test: + acceptance: + existingTopicNum: + # grpc endpoint + mirrorNodeAddress: "{{ .Release.Name }}-grpc:5600" + network: + # Do not use use 0.0.2 or 0.0.50 for operator to ensure crypto transfers are not waived + operatorId: + operatorKey: + rest: + baseUrl: "http://{{ .Release.Name }}-rest/api/v1" + retrieveAddressBook: false + cucumberTags: "@acceptance" + enabled: false + image: + pullPolicy: IfNotPresent + repository: gcr.io/mirrornode/hedera-mirror-test + tag: "" # Defaults to the chart's app version + timescaledb: enabled: false image: