This is an automated email from the ASF dual-hosted git repository.

mchades pushed a commit to branch branch-1.3
in repository https://gitbox.apache.org/repos/asf/gravitino.git


The following commit(s) were added to refs/heads/branch-1.3 by this push:
     new 478c070e64 [Cherry-pick to branch-1.3] [#11090] test(helm): Add unit 
tests for Gravitino chart (#11091) (#11441)
478c070e64 is described below

commit 478c070e64e4ef087bd58b3f1dde87008ae2a7c5
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Fri Jun 5 12:41:30 2026 +0800

    [Cherry-pick to branch-1.3] [#11090] test(helm): Add unit tests for 
Gravitino chart (#11091) (#11441)
    
    **Cherry-pick Information:**
    - Original commit: e485964f77c4ea9888375557c529c268915b9302
    - Target branch: `branch-1.3`
    - Status: ✅ Clean cherry-pick (no conflicts)
    
    Co-authored-by: Xu Bai <[email protected]>
---
 .github/workflows/chart-test.yaml                  |   4 +
 dev/charts/gravitino/templates/_helpers.tpl        |  28 ++-
 dev/charts/gravitino/tests/configmap_test.yaml     | 134 +++++++++++
 dev/charts/gravitino/tests/deployment_test.yaml    | 267 +++++++++++++++++++++
 dev/charts/gravitino/tests/ingress_test.yaml       |  84 +++++++
 .../gravitino/tests/poddisruptionbudget_test.yaml  |  95 ++++++++
 dev/charts/gravitino/tests/service_test.yaml       | 121 ++++++++++
 7 files changed, 730 insertions(+), 3 deletions(-)

diff --git a/.github/workflows/chart-test.yaml 
b/.github/workflows/chart-test.yaml
index edf1e90dda..cafce12a2a 100644
--- a/.github/workflows/chart-test.yaml
+++ b/.github/workflows/chart-test.yaml
@@ -62,6 +62,10 @@ jobs:
         if: steps.list-changed.outputs.changed == 'true'
         run: helm plugin install 
https://github.com/helm-unittest/helm-unittest.git --version v1.1.0 
--verify=false
 
+      - name: Unit test Gravitino chart
+        if: steps.list-changed.outputs.changed == 'true'
+        run: helm unittest --with-subchart=false dev/charts/gravitino
+
       - name: Unit test Gravitino Iceberg REST Server chart
         if: steps.list-changed.outputs.changed == 'true'
         run: helm unittest --with-subchart=false 
dev/charts/gravitino-iceberg-rest-server
diff --git a/dev/charts/gravitino/templates/_helpers.tpl 
b/dev/charts/gravitino/templates/_helpers.tpl
index 9dc4f0b560..54ca630c48 100644
--- a/dev/charts/gravitino/templates/_helpers.tpl
+++ b/dev/charts/gravitino/templates/_helpers.tpl
@@ -66,11 +66,33 @@ Define the gravitino.namespace
     {{- .Release.Namespace -}}
 {{- end -}}
 
+{{/*
+Return an image reference for the provided image root and global values.
+*/}}
+{{- define "gravitino.imageReference" -}}
+{{- $registry := coalesce .global.imageRegistry .imageRoot.registry -}}
+{{- $repository := required "image repository is required" 
.imageRoot.repository -}}
+{{- if .imageRoot.digest -}}
+{{- if $registry -}}
+{{- printf "%s/%s@%s" $registry $repository .imageRoot.digest -}}
+{{- else -}}
+{{- printf "%s@%s" $repository .imageRoot.digest -}}
+{{- end -}}
+{{- else -}}
+{{- $tag := required "image tag is required" .imageRoot.tag -}}
+{{- if $registry -}}
+{{- printf "%s/%s:%s" $registry $repository $tag -}}
+{{- else -}}
+{{- printf "%s:%s" $repository $tag -}}
+{{- end -}}
+{{- end -}}
+{{- end -}}
+
 {{/*
 Return the proper Gravitino image name
 */}}
 {{- define "gravitino.image" -}}
-  {{- include "common.images.image" (dict "imageRoot" .Values.image "global" 
.Values.global) -}}
+  {{- include "gravitino.imageReference" (dict "imageRoot" .Values.image 
"global" .Values.global) -}}
 {{- end -}}
 
 {{/*
@@ -78,7 +100,7 @@ Return the proper MySQL image name for the init-mysql 
initContainer
 */}}
 {{- define "init-mysql.image" -}}
 {{- if .Values.mysql.enabled -}}
-  {{- include "common.images.image" (dict "imageRoot" .Values.mysql.image 
"global" .Values.global) -}}
+  {{- include "gravitino.imageReference" (dict "imageRoot" .Values.mysql.image 
"global" .Values.global) -}}
 {{- end -}}
 {{- end -}}
 
@@ -87,6 +109,6 @@ Return the proper Postgresql image name for the 
init-postgresql initContainer
 */}}
 {{- define "init-postgresql.image" -}}
 {{- if .Values.postgresql.enabled -}}
-  {{- include "common.images.image" (dict "imageRoot" .Values.postgresql.image 
"global" .Values.global) -}}
+  {{- include "gravitino.imageReference" (dict "imageRoot" 
.Values.postgresql.image "global" .Values.global) -}}
 {{- end -}}
 {{- end -}}
\ No newline at end of file
diff --git a/dev/charts/gravitino/tests/configmap_test.yaml 
b/dev/charts/gravitino/tests/configmap_test.yaml
new file mode 100644
index 0000000000..f82edaca2b
--- /dev/null
+++ b/dev/charts/gravitino/tests/configmap_test.yaml
@@ -0,0 +1,134 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+suite: test gravitino configmap
+templates:
+  - configmap.yaml
+tests:
+  - it: renders default config files
+    release:
+      name: gravitino
+      namespace: gravitino-system
+    asserts:
+      - isKind:
+          of: ConfigMap
+      - equal:
+          path: metadata.namespace
+          value: gravitino-system
+      - exists:
+          path: data["init.sh"]
+      - exists:
+          path: data["gravitino.conf"]
+      - exists:
+          path: data["log4j2.properties"]
+      - matchRegex:
+          path: data["init.sh"]
+          pattern: "start-gravitino\\.sh"
+      - matchRegex:
+          path: data["gravitino.conf"]
+          pattern: "gravitino\\.server\\.webserver\\.httpPort = 8090"
+      - matchRegex:
+          path: data["gravitino.conf"]
+          pattern: "gravitino\\.entity\\.store\\.relational\\.jdbcUrl = 
jdbc:h2"
+      - matchRegex:
+          path: data["log4j2.properties"]
+          pattern: "rootLogger\\.level = info"
+
+  - it: renders customized Gravitino and log4j configuration
+    release:
+      name: custom-gravitino
+    set:
+      webserver:
+        httpPort: 8099
+      visibleConfigs: "gravitino.visible.one"
+      visibleConfigsItems:
+        gravitino.visible.one: "{{ .Release.Name }}"
+      additionalConfigItems:
+        gravitino.custom.setting: "{{ .Values.entity.store }}"
+      log4j2Properties:
+        rootLoggerLevel: debug
+      additionalLog4j2Properties:
+        logger.custom.name: org.apache.gravitino.Custom
+    asserts:
+      - matchRegex:
+          path: data["gravitino.conf"]
+          pattern: "gravitino\\.server\\.webserver\\.httpPort = 8099"
+      - matchRegex:
+          path: data["gravitino.conf"]
+          pattern: "gravitino\\.server\\.visibleConfigs = 
gravitino\\.visible\\.one"
+      - matchRegex:
+          path: data["gravitino.conf"]
+          pattern: "gravitino\\.visible\\.one = custom-gravitino"
+      - matchRegex:
+          path: data["gravitino.conf"]
+          pattern: "gravitino\\.custom\\.setting = relational"
+      - matchRegex:
+          path: data["log4j2.properties"]
+          pattern: "rootLogger\\.level = debug"
+      - matchRegex:
+          path: data["log4j2.properties"]
+          pattern: "logger\\.custom\\.name = org\\.apache\\.gravitino\\.Custom"
+
+  - it: renders MySQL JDBC configuration when MySQL is enabled
+    release:
+      name: gravitino
+    set:
+      mysql:
+        enabled: true
+        auth:
+          database: gravitino_mysql
+          username: mysql_user
+          password: mysql_password
+    asserts:
+      - matchRegex:
+          path: data["gravitino.conf"]
+          pattern: "gravitino\\.entity\\.store\\.relational\\.jdbcUrl = 
jdbc:mysql://gravitino-mysql:3306/gravitino_mysql"
+      - matchRegex:
+          path: data["gravitino.conf"]
+          pattern: "gravitino\\.entity\\.store\\.relational\\.jdbcDriver = 
com\\.mysql\\.cj\\.jdbc\\.Driver"
+      - matchRegex:
+          path: data["gravitino.conf"]
+          pattern: "gravitino\\.entity\\.store\\.relational\\.jdbcUser = 
mysql_user"
+      - matchRegex:
+          path: data["gravitino.conf"]
+          pattern: "gravitino\\.entity\\.store\\.relational\\.jdbcPassword = 
mysql_password"
+
+  - it: renders PostgreSQL JDBC configuration when PostgreSQL is enabled
+    release:
+      name: gravitino
+    set:
+      postgresql:
+        enabled: true
+        auth:
+          database: gravitino_pg
+          username: pg_user
+          password: pg_password
+    asserts:
+      - matchRegex:
+          path: data["gravitino.conf"]
+          pattern: "gravitino\\.entity\\.store\\.relational\\.jdbcUrl = 
jdbc:postgresql://gravitino-postgresql:5432/gravitino_pg"
+      - matchRegex:
+          path: data["gravitino.conf"]
+          pattern: "gravitino\\.entity\\.store\\.relational\\.jdbcDriver = 
org\\.postgresql\\.Driver"
+      - matchRegex:
+          path: data["gravitino.conf"]
+          pattern: "gravitino\\.entity\\.store\\.relational\\.jdbcUser = 
pg_user"
+      - matchRegex:
+          path: data["gravitino.conf"]
+          pattern: "gravitino\\.entity\\.store\\.relational\\.jdbcPassword = 
pg_password"
diff --git a/dev/charts/gravitino/tests/deployment_test.yaml 
b/dev/charts/gravitino/tests/deployment_test.yaml
new file mode 100644
index 0000000000..b23b73f9e1
--- /dev/null
+++ b/dev/charts/gravitino/tests/deployment_test.yaml
@@ -0,0 +1,267 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+suite: test gravitino deployment
+templates:
+  - deployment.yaml
+  - configmap.yaml
+tests:
+  - it: renders the default deployment
+    template: deployment.yaml
+    release:
+      name: gravitino
+      namespace: gravitino-system
+    asserts:
+      - isKind:
+          of: Deployment
+      - equal:
+          path: metadata.namespace
+          value: gravitino-system
+      - equal:
+          path: spec.replicas
+          value: 1
+      - equal:
+          path: spec.selector.matchLabels.release
+          value: gravitino
+      - equal:
+          path: spec.template.spec.serviceAccountName
+          value: default
+      - contains:
+          path: spec.template.spec.initContainers
+          content:
+            name: sqlfile
+          any: true
+      - matchRegex:
+          path: spec.template.spec.containers[0].image
+          pattern: "^docker\\.io/apache/gravitino:.+"
+      - contains:
+          path: spec.template.spec.containers[0].env
+          content:
+            name: GRAVITINO_HOME
+            value: /opt/gravitino
+          any: true
+      - contains:
+          path: spec.template.spec.containers[0].ports
+          content:
+            name: http
+            containerPort: 8090
+            protocol: TCP
+          any: true
+      - contains:
+          path: spec.template.spec.volumes
+          content:
+            name: storage
+            emptyDir: {}
+          any: true
+
+  - it: renders pod customization, templated env, and an existing storage claim
+    release:
+      name: gravitino-custom
+    template: deployment.yaml
+    set:
+      replicas: 2
+      serviceAccountName: gravitino-sa
+      global:
+        imagePullSecrets:
+          - name: registry-secret
+      podLabels:
+        app.kubernetes.io/part-of: gravitino
+      podAnnotations:
+        prometheus.io/scrape: "true"
+      envWithTpl:
+        - name: RELEASE_NAME
+          value: "{{ .Release.Name }}"
+      envFrom:
+        - configMapRef:
+            name: gravitino-env
+      persistence:
+        enabled: true
+        existingClaim: gravitino-data
+      extraVolumes:
+        - name: audit-config
+          configMap:
+            name: audit-config
+      extraVolumeMounts:
+        - name: audit-config
+          mountPath: /opt/gravitino/audit
+    asserts:
+      - equal:
+          path: spec.replicas
+          value: 2
+      - equal:
+          path: spec.template.spec.serviceAccountName
+          value: gravitino-sa
+      - contains:
+          path: spec.template.spec.imagePullSecrets
+          content:
+            name: registry-secret
+      - equal:
+          path: spec.template.metadata.labels["app.kubernetes.io/part-of"]
+          value: gravitino
+      - equal:
+          path: spec.template.metadata.annotations["prometheus.io/scrape"]
+          value: "true"
+      - contains:
+          path: spec.template.spec.containers[0].env
+          content:
+            name: RELEASE_NAME
+            value: gravitino-custom
+          any: true
+      - contains:
+          path: spec.template.spec.containers[0].envFrom
+          content:
+            configMapRef:
+              name: gravitino-env
+      - contains:
+          path: spec.template.spec.volumes
+          content:
+            name: storage
+            persistentVolumeClaim:
+              claimName: gravitino-data
+          any: true
+      - contains:
+          path: spec.template.spec.volumes
+          content:
+            name: audit-config
+            configMap:
+              name: audit-config
+          any: true
+      - contains:
+          path: spec.template.spec.containers[0].volumeMounts
+          content:
+            name: audit-config
+            mountPath: /opt/gravitino/audit
+
+  - it: renders security contexts, resources, and custom probes
+    template: deployment.yaml
+    set:
+      podSecurityContext:
+        fsGroup: 1000
+      initContainerSecurityContext:
+        runAsNonRoot: true
+        runAsUser: 2000
+      containerSecurityContext:
+        runAsNonRoot: true
+        runAsUser: 1000
+        capabilities:
+          drop:
+            - ALL
+      resources:
+        requests:
+          cpu: 500m
+          memory: 1Gi
+        limits:
+          cpu: "2"
+          memory: 2Gi
+      initResources:
+        requests:
+          cpu: 50m
+          memory: 128Mi
+        limits:
+          cpu: 100m
+          memory: 256Mi
+      livenessProbe:
+        httpGet:
+          path: /api/version
+          port: http
+        initialDelaySeconds: 30
+        timeoutSeconds: 3
+      readinessProbe:
+        httpGet:
+          path: /api/health
+          port: http
+        initialDelaySeconds: 10
+        timeoutSeconds: 2
+    asserts:
+      - equal:
+          path: spec.template.spec.securityContext.fsGroup
+          value: 1000
+      - equal:
+          path: spec.template.spec.initContainers[0].securityContext.runAsUser
+          value: 2000
+      - equal:
+          path: spec.template.spec.initContainers[0].resources.requests.cpu
+          value: 50m
+      - equal:
+          path: spec.template.spec.initContainers[0].resources.limits.memory
+          value: 256Mi
+      - equal:
+          path: spec.template.spec.containers[0].securityContext.runAsUser
+          value: 1000
+      - contains:
+          path: 
spec.template.spec.containers[0].securityContext.capabilities.drop
+          content: ALL
+      - equal:
+          path: spec.template.spec.containers[0].resources.requests.memory
+          value: 1Gi
+      - equal:
+          path: spec.template.spec.containers[0].resources.limits.cpu
+          value: "2"
+      - equal:
+          path: spec.template.spec.containers[0].livenessProbe.httpGet.path
+          value: /api/version
+      - equal:
+          path: spec.template.spec.containers[0].readinessProbe.httpGet.path
+          value: /api/health
+
+  - it: renders MySQL initialization when MySQL is enabled
+    template: deployment.yaml
+    release:
+      name: gravitino
+    set:
+      mysql:
+        enabled: true
+    asserts:
+      - contains:
+          path: spec.template.spec.initContainers
+          content:
+            name: init-mysql
+          any: true
+      - matchRegex:
+          path: spec.template.spec.initContainers[?(@.name == 
"init-mysql")].command[2]
+          pattern: "Waiting for MySQL to be ready"
+      - contains:
+          path: spec.template.spec.initContainers[?(@.name == 
"init-mysql")].env
+          content:
+            name: GRAVITINO_DB
+            value: gravitino
+          any: true
+
+  - it: renders PostgreSQL initialization when PostgreSQL is enabled
+    template: deployment.yaml
+    release:
+      name: gravitino
+    set:
+      postgresql:
+        enabled: true
+    asserts:
+      - contains:
+          path: spec.template.spec.initContainers
+          content:
+            name: init-postgresql
+          any: true
+      - matchRegex:
+          path: spec.template.spec.initContainers[?(@.name == 
"init-postgresql")].command[2]
+          pattern: "Waiting for PostgreSQL to be ready"
+      - contains:
+          path: spec.template.spec.initContainers[?(@.name == 
"init-postgresql")].env
+          content:
+            name: GRAVITINO_DB
+            value: gravitino
+          any: true
diff --git a/dev/charts/gravitino/tests/ingress_test.yaml 
b/dev/charts/gravitino/tests/ingress_test.yaml
new file mode 100644
index 0000000000..6591cf535c
--- /dev/null
+++ b/dev/charts/gravitino/tests/ingress_test.yaml
@@ -0,0 +1,84 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+suite: test gravitino ingress
+templates:
+  - ingress.yaml
+tests:
+  - it: does not render ingress by default
+    asserts:
+      - hasDocuments:
+          count: 0
+
+  - it: renders networking v1 ingress for supported Kubernetes versions
+    release:
+      name: gravitino
+    capabilities:
+      majorVersion: 1
+      minorVersion: 29
+    set:
+      ingress:
+        enabled: true
+        className: nginx
+        annotations:
+          nginx.ingress.kubernetes.io/proxy-read-timeout: "3600"
+        hosts:
+          - host: gravitino.example.com
+            paths:
+              - path: /api
+                pathType: Prefix
+        tls:
+          - secretName: gravitino-tls
+            hosts:
+              - gravitino.example.com
+    asserts:
+      - isAPIVersion:
+          of: networking.k8s.io/v1
+      - isKind:
+          of: Ingress
+      - equal:
+          path: metadata.name
+          value: gravitino-gravitino-helm
+      - equal:
+          path: 
metadata.annotations["nginx.ingress.kubernetes.io/proxy-read-timeout"]
+          value: "3600"
+      - equal:
+          path: spec.ingressClassName
+          value: nginx
+      - equal:
+          path: spec.rules[0].host
+          value: gravitino.example.com
+      - equal:
+          path: spec.rules[0].http.paths[0].path
+          value: /api
+      - equal:
+          path: spec.rules[0].http.paths[0].pathType
+          value: Prefix
+      - equal:
+          path: spec.rules[0].http.paths[0].backend.service.name
+          value: gravitino-gravitino-helm
+      - equal:
+          path: spec.rules[0].http.paths[0].backend.service.port.number
+          value: 8090
+      - equal:
+          path: spec.tls[0].secretName
+          value: gravitino-tls
+      - contains:
+          path: spec.tls[0].hosts
+          content: gravitino.example.com
diff --git a/dev/charts/gravitino/tests/poddisruptionbudget_test.yaml 
b/dev/charts/gravitino/tests/poddisruptionbudget_test.yaml
new file mode 100644
index 0000000000..745b86c7bd
--- /dev/null
+++ b/dev/charts/gravitino/tests/poddisruptionbudget_test.yaml
@@ -0,0 +1,95 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+suite: test gravitino pod disruption budget
+templates:
+  - poddisruptionbudget.yaml
+tests:
+  - it: does not render a PodDisruptionBudget by default
+    asserts:
+      - hasDocuments:
+          count: 0
+
+  - it: renders minAvailable when enabled
+    set:
+      podDisruptionBudget:
+        enabled: true
+        minAvailable: 1
+    asserts:
+      - isKind:
+          of: PodDisruptionBudget
+      - equal:
+          path: spec.minAvailable
+          value: 1
+      - notExists:
+          path: spec.maxUnavailable
+
+  - it: renders maxUnavailable when minAvailable is empty
+    set:
+      podDisruptionBudget:
+        enabled: true
+        minAvailable: ""
+        maxUnavailable: 1
+    asserts:
+      - isKind:
+          of: PodDisruptionBudget
+      - equal:
+          path: spec.maxUnavailable
+          value: 1
+      - notExists:
+          path: spec.minAvailable
+
+  - it: renders a percentage minAvailable value
+    set:
+      podDisruptionBudget:
+        enabled: true
+        minAvailable: "50%"
+    asserts:
+      - isKind:
+          of: PodDisruptionBudget
+      - equal:
+          path: spec.minAvailable
+          value: "50%"
+      - notExists:
+          path: spec.maxUnavailable
+
+  - it: renders a percentage maxUnavailable value
+    set:
+      podDisruptionBudget:
+        enabled: true
+        minAvailable: ""
+        maxUnavailable: "25%"
+    asserts:
+      - isKind:
+          of: PodDisruptionBudget
+      - equal:
+          path: spec.maxUnavailable
+          value: "25%"
+      - notExists:
+          path: spec.minAvailable
+
+  - it: fails when minAvailable and maxUnavailable are both specified
+    set:
+      podDisruptionBudget:
+        enabled: true
+        minAvailable: 1
+        maxUnavailable: 1
+    asserts:
+      - failedTemplate:
+          errorMessage: "podDisruptionBudget.minAvailable and 
podDisruptionBudget.maxUnavailable cannot both be specified. Please specify 
only one."
diff --git a/dev/charts/gravitino/tests/service_test.yaml 
b/dev/charts/gravitino/tests/service_test.yaml
new file mode 100644
index 0000000000..c443e88a90
--- /dev/null
+++ b/dev/charts/gravitino/tests/service_test.yaml
@@ -0,0 +1,121 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+suite: test gravitino service
+templates:
+  - service.yaml
+tests:
+  - it: renders the default ClusterIP service
+    release:
+      name: gravitino
+      namespace: gravitino-system
+    asserts:
+      - isKind:
+          of: Service
+      - equal:
+          path: metadata.name
+          value: gravitino
+      - equal:
+          path: metadata.namespace
+          value: gravitino-system
+      - equal:
+          path: spec.type
+          value: ClusterIP
+      - contains:
+          path: spec.ports
+          content:
+            name: http
+            port: 8090
+            protocol: TCP
+            targetPort: 8090
+          any: true
+      - contains:
+          path: spec.ports
+          content:
+            name: http1
+            port: 9001
+            protocol: TCP
+            targetPort: 9001
+          any: true
+      - equal:
+          path: spec.selector.release
+          value: gravitino
+
+  - it: renders NodePort when requested
+    set:
+      service:
+        type: NodePort
+        nodePort: 30090
+    asserts:
+      - equal:
+          path: spec.type
+          value: NodePort
+      - equal:
+          path: spec.ports[0].nodePort
+          value: 30090
+
+  - it: renders LoadBalancer options
+    set:
+      service:
+        type: LoadBalancer
+        loadBalancerIP: 10.0.0.10
+        loadBalancerSourceRanges:
+          - 10.0.0.0/24
+        externalIPs:
+          - 192.168.0.10
+        labels:
+          exposure: public
+        annotations:
+          service.beta.kubernetes.io/aws-load-balancer-type: nlb
+    asserts:
+      - equal:
+          path: spec.type
+          value: LoadBalancer
+      - equal:
+          path: spec.loadBalancerIP
+          value: 10.0.0.10
+      - contains:
+          path: spec.loadBalancerSourceRanges
+          content: 10.0.0.0/24
+      - contains:
+          path: spec.externalIPs
+          content: 192.168.0.10
+      - equal:
+          path: metadata.labels.exposure
+          value: public
+      - equal:
+          path: 
metadata.annotations["service.beta.kubernetes.io/aws-load-balancer-type"]
+          value: nlb
+
+  - it: renders extra exposed ports
+    set:
+      extraExposePorts:
+        - name: metrics
+          port: 9090
+          protocol: TCP
+          targetPort: 9090
+    asserts:
+      - contains:
+          path: spec.ports
+          content:
+            name: metrics
+            port: 9090
+            protocol: TCP
+            targetPort: 9090
+          any: true

Reply via email to