You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@polaris.apache.org by yu...@apache.org on 2025/06/24 00:39:22 UTC
svn commit: r77705 [3/4] - in /dev/incubator/polaris/apache-polaris-1.0.0-incubating: ./ helm-chart/ helm-chart/ci/ helm-chart/ci/fixtures/ helm-chart/templates/ helm-chart/templates/tests/ helm-chart/tests/
Added: dev/incubator/polaris/apache-polaris-1.0.0-incubating/helm-chart/tests/deployment_test.yaml
==============================================================================
--- dev/incubator/polaris/apache-polaris-1.0.0-incubating/helm-chart/tests/deployment_test.yaml (added)
+++ dev/incubator/polaris/apache-polaris-1.0.0-incubating/helm-chart/tests/deployment_test.yaml Tue Jun 24 00:39:22 2025
@@ -0,0 +1,1061 @@
+#
+# 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.
+#
+
+chart:
+ version: 1.2.3
+ appVersion: 4.5.6
+
+release:
+ name: polaris-release
+ namespace: polaris-ns
+
+templates:
+ - deployment.yaml
+
+tests:
+
+ # metadata.name
+ - it: should set deployment name
+ asserts:
+ - equal:
+ path: metadata.name
+ value: polaris-release
+ - it: should set deployment name with override
+ set:
+ nameOverride: polaris-override
+ asserts:
+ - equal:
+ path: metadata.name
+ value: polaris-release-polaris-override
+ - it: should set deployment name with full override
+ set:
+ fullnameOverride: polaris-override
+ asserts:
+ - equal:
+ path: metadata.name
+ value: polaris-override
+
+ # metadata.namespace
+ - it: should set deployment namespace
+ asserts:
+ - equal:
+ path: metadata.namespace
+ value: polaris-ns
+
+ # metadata.labels
+ - it: should set deployment default labels
+ asserts:
+ - isSubset:
+ path: metadata.labels
+ content:
+ app.kubernetes.io/name: polaris
+ app.kubernetes.io/instance: polaris-release
+ app.kubernetes.io/version: 4.5.6
+ app.kubernetes.io/managed-by: Helm
+ helm.sh/chart: polaris-1.2.3
+ - it: should set podLabels in deployment labels
+ set:
+ podLabels:
+ app.kubernetes.io/component: polaris
+ asserts:
+ - isSubset:
+ path: metadata.labels
+ content:
+ app.kubernetes.io/component: polaris
+
+ # spec.replicas
+ - it: should set default replicas
+ asserts:
+ - equal:
+ path: spec.replicas
+ value: 1
+ - it: should set replicas
+ set:
+ replicaCount: 3
+ asserts:
+ - equal:
+ path: spec.replicas
+ value: 3
+ - it: should not set replicas if autoscaling is enabled
+ set:
+ replicaCount: 3
+ autoscaling:
+ enabled: true
+ asserts:
+ - notExists:
+ path: spec.replicas
+
+ # spec.revisionHistoryLimit
+ - it: should not set revisionHistoryLimit by default with null
+ asserts:
+ - notExists:
+ path: spec.revisionHistoryLimit
+ - it: should not set revisionHistoryLimit with quote empty string
+ set:
+ revisionHistoryLimit: ""
+ asserts:
+ - notExists:
+ path: spec.revisionHistoryLimit
+ - it: should not set revisionHistoryLimit with empty string
+ set:
+ revisionHistoryLimit:
+ asserts:
+ - notExists:
+ path: spec.revisionHistoryLimit
+ - it: should set revisionHistoryLimit
+ set:
+ revisionHistoryLimit: 1
+ asserts:
+ - equal:
+ path: spec.revisionHistoryLimit
+ value: 1
+ - it: should set revisionHistoryLimit (disabled revision history)
+ set:
+ revisionHistoryLimit: 0
+ asserts:
+ - equal:
+ path: spec.revisionHistoryLimit
+ value: 0
+
+ # spec.selector.matchLabels + spec.template.metadata.labels
+ - it: should set deployment selector labels
+ asserts:
+ - isSubset:
+ path: spec.selector.matchLabels
+ content:
+ app.kubernetes.io/name: polaris
+ app.kubernetes.io/instance: polaris-release
+ - isSubset:
+ path: spec.template.metadata.labels
+ content:
+ app.kubernetes.io/name: polaris
+ app.kubernetes.io/instance: polaris-release
+ - it: should include podLabels in spec.template.metadata.labels only
+ set:
+ podLabels:
+ app.kubernetes.io/component: polaris
+ asserts:
+ - isNotSubset:
+ path: spec.selector.matchLabels
+ content:
+ app.kubernetes.io/component: polaris
+ - isSubset:
+ path: spec.template.metadata.labels
+ content:
+ app.kubernetes.io/component: polaris
+
+ # spec.template.metadata.annotations
+ - it: should not set pod annotations by default
+ asserts:
+ - notExists:
+ path: spec.template.metadata.annotations
+ - it: should set pod annotations
+ set:
+ podAnnotations:
+ foo: bar
+ asserts:
+ - isSubset:
+ path: spec.template.metadata.annotations
+ content:
+ foo: bar
+
+ # spec.template.spec.imagePullSecrets
+ - it: should not set imagePullSecrets by default
+ asserts:
+ - notExists:
+ path: spec.template.spec.imagePullSecrets
+ - it: should set imagePullSecrets
+ set:
+ imagePullSecrets:
+ - test-secret
+ asserts:
+ - contains:
+ path: spec.template.spec.imagePullSecrets
+ content:
+ name: test-secret
+
+ # spec.template.spec.serviceAccountName
+ - it: should set default service account name
+ asserts:
+ - equal:
+ path: spec.template.spec.serviceAccountName
+ value: polaris-release
+ - it: should set service account name when serviceAccount.create is true
+ set:
+ serviceAccount:
+ create: true
+ asserts:
+ - equal:
+ path: spec.template.spec.serviceAccountName
+ value: polaris-release
+ - it: should set custom service account name when serviceAccount.create is true
+ set:
+ serviceAccount:
+ create: true
+ name: polaris-sa
+ asserts:
+ - equal:
+ path: spec.template.spec.serviceAccountName
+ value: polaris-sa
+ - it: should set service account name to default when serviceAccount.create is false
+ set:
+ serviceAccount:
+ create: false
+ asserts:
+ - equal:
+ path: spec.template.spec.serviceAccountName
+ value: default
+ - it: should set custom service account name when serviceAccount.create is false
+ set:
+ serviceAccount:
+ create: false
+ name: polaris-sa
+ asserts:
+ - equal:
+ path: spec.template.spec.serviceAccountName
+ value: polaris-sa
+
+ # spec.template.spec.securityContext
+ - it: should set securityContext by default
+ asserts:
+ - isSubset:
+ path: spec.template.spec.securityContext
+ content:
+ fsGroup: 10001
+ seccompProfile:
+ type: RuntimeDefault
+ - it: should set custom securityContext
+ set:
+ podSecurityContext:
+ fsGroup: 1234
+ asserts:
+ - isSubset:
+ path: spec.template.spec.securityContext
+ content:
+ fsGroup: 1234
+
+ # spec.template.spec.containers
+ - it: should set container name
+ asserts:
+ - equal:
+ path: spec.template.spec.containers[0].name
+ value: polaris
+
+ # spec.template.spec.containers[0].securityContext
+ - it: should set container securityContext by default
+ asserts:
+ - isSubset:
+ path: spec.template.spec.containers[0].securityContext
+ content:
+ allowPrivilegeEscalation: false
+ runAsNonRoot: true
+ runAsUser: 10000
+ capabilities:
+ drop: [ "ALL" ]
+ seccompProfile:
+ type: RuntimeDefault
+ - it: should set custom container securityContext
+ set:
+ containerSecurityContext:
+ allowPrivilegeEscalation: true
+ runAsNonRoot: false
+ runAsUser: 1234
+ asserts:
+ - isSubset:
+ path: spec.template.spec.containers[0].securityContext
+ content:
+ allowPrivilegeEscalation: true
+ runAsNonRoot: false
+ runAsUser: 1234
+
+ # spec.template.spec.containers[0].image
+ - it: should set container image
+ set:
+ image:
+ repository: test-repo
+ tag: test-tag
+ asserts:
+ - equal:
+ path: spec.template.spec.containers[0].image
+ value: test-repo:test-tag
+ - it: should set container image with template
+ set:
+ image:
+ repository: test-repo-{{ .Chart.Version }}
+ tag: test-tag-{{ .Release.Name }}
+ asserts:
+ - equal:
+ path: spec.template.spec.containers[0].image
+ value: test-repo-1.2.3:test-tag-polaris-release
+ - it: should set container image with chart version if no tag provided
+ set:
+ image:
+ repository: test-repo
+ tag: ""
+ asserts:
+ - equal:
+ path: spec.template.spec.containers[0].image
+ value: test-repo:1.2.3
+
+ # spec.template.spec.containers[0].imagePullPolicy
+ - it: should set container pull policy
+ set:
+ image:
+ pullPolicy: Always
+ asserts:
+ - equal:
+ path: spec.template.spec.containers[0].imagePullPolicy
+ value: Always
+
+ # spec.template.spec.containers[0].env
+ - it: should not set container env by default
+ asserts:
+ - notExists:
+ path: spec.template.spec.containers[0].env
+ - it: should set container env
+ set:
+ extraEnv:
+ - name: foo
+ value: bar
+ asserts:
+ - contains:
+ path: spec.template.spec.containers[0].env
+ content:
+ name: foo
+ value: bar
+
+ # spec.template.spec.containers[0].volumeMounts + spec.template.spec.volumes
+ - it: should not set persistence volumes by default
+ asserts:
+ - lengthEqual:
+ path: spec.template.spec.volumes
+ count: 2 # config-volume + temp-dir
+ - lengthEqual:
+ path: spec.template.spec.containers[0].volumeMounts
+ count: 2 # config-volume + temp-dir
+ - contains:
+ path: spec.template.spec.containers[0].volumeMounts
+ content:
+ name: config-volume
+ mountPath: /deployments/config
+ readOnly: true
+
+ - it: should evaluate template expressions in persistence secret name
+ set:
+ persistence:
+ type: eclipse-link
+ eclipseLink:
+ secret:
+ name: "{{ .Release.Name }}-persistence-secret"
+ asserts:
+ - contains:
+ path: spec.template.spec.volumes
+ content:
+ name: config-volume
+ projected:
+ sources:
+ - configMap:
+ items:
+ - key: application.properties
+ path: application.properties
+ name: polaris-release
+ - secret:
+ items:
+ - key: persistence.xml
+ path: persistence.xml
+ name: polaris-release-persistence-secret
+
+ # spec.template.spec.containers[0].ports
+ - it: should set container ports by default
+ asserts:
+ - lengthEqual:
+ path: spec.template.spec.containers[0].ports
+ count: 2
+ - contains:
+ path: spec.template.spec.containers[0].ports
+ content:
+ name: polaris-http
+ containerPort: 8181
+ protocol: TCP
+ - contains:
+ path: spec.template.spec.containers[0].ports
+ content:
+ name: polaris-mgmt
+ containerPort: 8182
+ protocol: TCP
+
+ - it: should set custom container ports
+ set:
+ service:
+ ports:
+ - name: polaris-custom
+ port: 18181
+ managementService:
+ ports:
+ - name: mgmt-custom
+ port: 18182
+ extraServices:
+ - nameSuffix: "-extra"
+ type: LoadBalancer
+ ports:
+ - name: extra-port
+ port: 18183
+ asserts:
+ - lengthEqual:
+ path: spec.template.spec.containers[0].ports
+ count: 3
+ - contains:
+ path: spec.template.spec.containers[0].ports
+ content:
+ name: polaris-custom
+ containerPort: 18181
+ protocol: TCP
+ - contains:
+ path: spec.template.spec.containers[0].ports
+ content:
+ name: mgmt-custom
+ containerPort: 18182
+ protocol: TCP
+ - contains:
+ path: spec.template.spec.containers[0].ports
+ content:
+ name: extra-port
+ containerPort: 18183
+ protocol: TCP
+
+ - it: should use targetPort if defined
+ set:
+ service:
+ ports:
+ - name: polaris-custom
+ port: 18181
+ targetPort: 8181
+ managementService:
+ ports:
+ - name: mgmt-custom
+ port: 18182
+ targetPort: 8182
+ extraServices:
+ - nameSuffix: "-extra"
+ ports:
+ - name: extra-port
+ port: 18183
+ targetPort: 8183
+ asserts:
+ - lengthEqual:
+ path: spec.template.spec.containers[0].ports
+ count: 3
+ - contains:
+ path: spec.template.spec.containers[0].ports
+ content:
+ name: polaris-custom
+ containerPort: 8181
+ protocol: TCP
+ - contains:
+ path: spec.template.spec.containers[0].ports
+ content:
+ name: mgmt-custom
+ containerPort: 8182
+ protocol: TCP
+ - contains:
+ path: spec.template.spec.containers[0].ports
+ content:
+ name: extra-port
+ containerPort: 8183
+ protocol: TCP
+
+ - it: should fail if port name is not unique (#1)
+ set:
+ service:
+ ports:
+ - name: polaris-http
+ port: 8181
+ - name: polaris-http
+ port: 18181
+ asserts:
+ - failedTemplate:
+ errorPattern: "service.ports\\[\\d\\]: port name already taken: polaris-http"
+
+ - it: should fail if port name is not unique (#2)
+ set:
+ managementService:
+ ports:
+ - name: polaris-mgmt
+ port: 8182
+ - name: polaris-mgmt
+ port: 18182
+ asserts:
+ - failedTemplate:
+ errorPattern: "managementService.ports\\[\\d\\]: port name already taken: polaris-mgmt"
+
+ - it: should fail if port name is not unique (#3)
+ set:
+ service:
+ ports:
+ - name: polaris
+ port: 8181
+ managementService:
+ ports:
+ - name: polaris
+ port: 8182
+ asserts:
+ - failedTemplate:
+ errorPattern: "managementService.ports\\[\\d\\]: port name already taken: polaris"
+
+ - it: should not fail when extra service references the same port name and number
+ set:
+ extraServices:
+ - nameSuffix: "-extra"
+ type: LoadBalancer
+ ports:
+ - name: polaris-http
+ port: 8181
+ asserts:
+ - lengthEqual:
+ path: spec.template.spec.containers[0].ports
+ count: 2
+ - contains:
+ path: spec.template.spec.containers[0].ports
+ content:
+ name: polaris-http
+ containerPort: 8181
+ protocol: TCP
+ - contains:
+ path: spec.template.spec.containers[0].ports
+ content:
+ name: polaris-mgmt
+ containerPort: 8182
+ protocol: TCP
+
+ - it: should fail when extra service references the same port name with different number (#1)
+ set:
+ extraServices:
+ - nameSuffix: "-extra"
+ type: LoadBalancer
+ ports:
+ - name: polaris-http
+ port: 9999
+ asserts:
+ - failedTemplate:
+ errorPattern: "extraServices\\[\\d\\].ports\\[\\d\\]: wrong port number for port polaris-http, expected 8181, got 9999"
+
+ - it: should fail when extra service references the same port name with different number (#2)
+ set:
+ extraServices:
+ - nameSuffix: "-extra"
+ type: LoadBalancer
+ ports:
+ - name: polaris-mgmt
+ port: 9999
+ asserts:
+ - failedTemplate:
+ errorPattern: "extraServices\\[\\d\\].ports\\[\\d\\]: wrong port number for port polaris-mgmt, expected 8182, got 9999"
+
+ - it: should fail when extra service references the same port name with different number (#3)
+ set:
+ service:
+ ports:
+ - name: polaris-http
+ port: 8181
+ - name: polaris-https
+ port: 8043
+ extraServices:
+ - nameSuffix: "-extra"
+ type: LoadBalancer
+ ports:
+ - name: polaris-https
+ port: 9999
+ asserts:
+ - failedTemplate:
+ errorPattern: "extraServices\\[\\d\\].ports\\[\\d\\]: wrong port number for port polaris-https, expected 8043, got 9999"
+
+ - it: should fail when extra service references the same port name with different protocol
+ set:
+ service:
+ ports:
+ - name: polaris-http
+ port: 8181
+ extraServices:
+ - nameSuffix: "-extra"
+ type: LoadBalancer
+ ports:
+ - name: polaris-http
+ port: 8181
+ protocol: UDP
+ asserts:
+ - failedTemplate:
+ errorPattern: "extraServices\\[\\d\\].ports\\[\\d\\]: wrong protocol for port polaris-http, expected TCP, got UDP"
+
+ - it: should create 2 ports with same number
+ set:
+ service:
+ ports:
+ - name: polaris-http
+ port: 8181
+ - name: polaris-http2
+ port: 8181
+ asserts:
+ - lengthEqual:
+ path: spec.template.spec.containers[0].ports
+ count: 3
+ - contains:
+ path: spec.template.spec.containers[0].ports
+ content:
+ name: polaris-http
+ containerPort: 8181
+ protocol: TCP
+ - contains:
+ path: spec.template.spec.containers[0].ports
+ content:
+ name: polaris-http2
+ containerPort: 8181
+ protocol: TCP
+ - it: should create 2 ports with same number using targetPort
+ set:
+ service:
+ ports:
+ - name: polaris-http
+ port: 18181
+ targetPort: 8181
+ - name: polaris-http2
+ port: 18181
+ targetPort: 8181
+ asserts:
+ - lengthEqual:
+ path: spec.template.spec.containers[0].ports
+ count: 3
+ - contains:
+ path: spec.template.spec.containers[0].ports
+ content:
+ name: polaris-http
+ containerPort: 8181
+ protocol: TCP
+ - contains:
+ path: spec.template.spec.containers[0].ports
+ content:
+ name: polaris-http2
+ containerPort: 8181
+ protocol: TCP
+ - it: should set port protocols
+ set:
+ service:
+ ports:
+ - name: polaris-http
+ port: 8181
+ protocol: UDP
+ managementService:
+ ports:
+ - name: polaris-mgmt
+ port: 8182
+ protocol: UDP
+ extraServices:
+ - nameSuffix: "-extra"
+ type: LoadBalancer
+ ports:
+ - name: polaris-extra
+ port: 8183
+ protocol: UDP
+ asserts:
+ - lengthEqual:
+ path: spec.template.spec.containers[0].ports
+ count: 3
+ - contains:
+ path: spec.template.spec.containers[0].ports
+ content:
+ name: polaris-http
+ containerPort: 8181
+ protocol: UDP
+ - contains:
+ path: spec.template.spec.containers[0].ports
+ content:
+ name: polaris-mgmt
+ containerPort: 8182
+ protocol: UDP
+ - contains:
+ path: spec.template.spec.containers[0].ports
+ content:
+ name: polaris-extra
+ containerPort: 8183
+ protocol: UDP
+
+ # spec.template.spec.containers[0].livenessProbe
+ - it: should set container livenessProbe by default
+ set:
+ managementService:
+ ports:
+ - name: mgmt-custom
+ port: 9999
+ livenessProbe:
+ initialDelaySeconds: 11
+ periodSeconds: 22
+ successThreshold: 33
+ failureThreshold: 44
+ timeoutSeconds: 55
+ terminationGracePeriodSeconds: 66
+ asserts:
+ - equal:
+ path: spec.template.spec.containers[0].livenessProbe
+ value:
+ httpGet:
+ path: /q/health/live
+ port: mgmt-custom
+ scheme: HTTP
+ initialDelaySeconds: 11
+ periodSeconds: 22
+ successThreshold: 33
+ failureThreshold: 44
+ timeoutSeconds: 55
+ terminationGracePeriodSeconds: 66
+
+ # spec.template.spec.containers[0].readinessProbe
+ - it: should set container readinessProbe by default
+ set:
+ managementService:
+ ports:
+ - name: mgmt-custom
+ port: 9999
+ readinessProbe:
+ initialDelaySeconds: 11
+ periodSeconds: 22
+ successThreshold: 33
+ failureThreshold: 44
+ timeoutSeconds: 55
+ asserts:
+ - equal:
+ path: spec.template.spec.containers[0].readinessProbe
+ value:
+ httpGet:
+ path: /q/health/ready
+ port: mgmt-custom
+ scheme: HTTP
+ initialDelaySeconds: 11
+ periodSeconds: 22
+ successThreshold: 33
+ failureThreshold: 44
+ timeoutSeconds: 55
+
+ # spec.template.spec.containers[0].resources
+ - it: should not set container resources by default
+ asserts:
+ - notExists:
+ path: spec.template.spec.containers[0].resources
+ - it: should set container resources
+ set:
+ resources:
+ requests:
+ cpu: 100m
+ memory: 128Mi
+ limits:
+ cpu: 200m
+ memory: 256Mi
+ asserts:
+ - equal:
+ path: spec.template.spec.containers[0].resources
+ value:
+ requests:
+ cpu: 100m
+ memory: 128Mi
+ limits:
+ cpu: 200m
+ memory: 256Mi
+
+ # spec.template.spec.nodeSelector
+ - it: should not set nodeSelector by default
+ asserts:
+ - notExists:
+ path: spec.template.spec.nodeSelector
+ - it: should set nodeSelector
+ set:
+ nodeSelector:
+ disktype: ssd
+ asserts:
+ - equal:
+ path: spec.template.spec.nodeSelector
+ value:
+ disktype: ssd
+
+ # spec.template.spec.affinity
+ - it: should not set affinity by default
+ asserts:
+ - notExists:
+ path: spec.template.spec.affinity
+ - it: should set affinity
+ set:
+ affinity:
+ nodeAffinity:
+ requiredDuringSchedulingIgnoredDuringExecution:
+ nodeSelectorTerms:
+ - matchExpressions:
+ - key: zone
+ operator: In
+ values:
+ - zone1
+ - zone2
+ asserts:
+ - equal:
+ path: spec.template.spec.affinity
+ value:
+ nodeAffinity:
+ requiredDuringSchedulingIgnoredDuringExecution:
+ nodeSelectorTerms:
+ - matchExpressions:
+ - key: zone
+ operator: In
+ values:
+ - zone1
+ - zone2
+
+ # spec.template.spec.tolerations
+ - it: should not set tolerations by default
+ asserts:
+ - notExists:
+ path: spec.template.spec.tolerations
+ - it: should set tolerations
+ set:
+ tolerations:
+ - key: "key"
+ operator: "Equal"
+ value: "value"
+ effect: "NoSchedule"
+ asserts:
+ - equal:
+ path: spec.template.spec.tolerations
+ value:
+ - key: "key"
+ operator: "Equal"
+ value: "value"
+ effect: "NoSchedule"
+
+ - it: should set storage credentials
+ set:
+ storage:
+ secret:
+ name: polaris-storage-secret
+ awsAccessKeyId: awsAccessKeyId
+ awsSecretAccessKey: awsSecretAccessKey
+ gcpToken: gcpToken
+ asserts:
+ - contains:
+ path: spec.template.spec.containers[0].env
+ content:
+ name: polaris.storage.aws.access-key
+ valueFrom:
+ secretKeyRef:
+ name: polaris-storage-secret
+ key: awsAccessKeyId
+ - contains:
+ path: spec.template.spec.containers[0].env
+ content:
+ name: polaris.storage.aws.secret-key
+ valueFrom:
+ secretKeyRef:
+ name: polaris-storage-secret
+ key: awsSecretAccessKey
+ - contains:
+ path: spec.template.spec.containers[0].env
+ content:
+ name: polaris.storage.gcp.token
+ valueFrom:
+ secretKeyRef:
+ name: polaris-storage-secret
+ key: gcpToken
+
+ - it: should set extra env
+ set:
+ extraEnv:
+ - name: foo
+ value: bar
+ - name: baz
+ valueFrom:
+ secretKeyRef:
+ name: secret
+ key: key
+ asserts:
+ - contains:
+ path: spec.template.spec.containers[0].env
+ content:
+ name: foo
+ value: bar
+ - contains:
+ path: spec.template.spec.containers[0].env
+ content:
+ name: baz
+ valueFrom:
+ secretKeyRef:
+ name: secret
+ key: key
+
+ - it: should set extra env + storage credentials
+ set:
+ storage:
+ secret:
+ name: polaris-storage-secret
+ awsAccessKeyId: awsAccessKeyId
+ extraEnv:
+ - name: foo
+ value: bar
+ asserts:
+ - contains:
+ path: spec.template.spec.containers[0].env
+ content:
+ name: foo
+ value: bar
+ - contains:
+ path: spec.template.spec.containers[0].env
+ content:
+ name: polaris.storage.aws.access-key
+ valueFrom:
+ secretKeyRef:
+ name: polaris-storage-secret
+ key: awsAccessKeyId
+
+ - it: should not set any environment variables by default
+ asserts:
+ - notExists:
+ path: spec.template.spec.containers[0].env
+
+ - it: should configure config volume
+ set:
+ image.configDir: /config/dir
+ asserts:
+ - contains:
+ path: spec.template.spec.containers[0].volumeMounts
+ content:
+ name: config-volume
+ mountPath: /config/dir
+ readOnly: true
+ - contains:
+ path: spec.template.spec.volumes
+ content:
+ name: config-volume
+ projected:
+ sources:
+ - configMap:
+ name: polaris-release
+ items:
+ - key: application.properties
+ path: application.properties
+
+ - it: should configure config volume with token broker secret
+ set:
+ image.configDir: /config/dir
+ authentication:
+ tokenBroker:
+ secret:
+ name: polaris-token-broker
+ publicKey: public.key
+ privateKey: private.key
+ asserts:
+ - contains:
+ path: spec.template.spec.containers[0].volumeMounts
+ content:
+ name: config-volume
+ mountPath: /config/dir
+ readOnly: true
+ - contains:
+ path: spec.template.spec.volumes
+ content:
+ name: config-volume
+ projected:
+ sources:
+ - configMap:
+ name: polaris-release
+ items:
+ - key: application.properties
+ path: application.properties
+ - secret:
+ name: polaris-token-broker
+ items:
+ - key: public.key
+ path: public.pem
+ - key: private.key
+ path: private.pem
+
+ - it: should configure config volume with persistence secret
+ set:
+ image.configDir: /config/dir
+ persistence:
+ type: eclipse-link
+ eclipseLink:
+ secret:
+ name: polaris-persistence
+ key: custom.xml
+ asserts:
+ - contains:
+ path: spec.template.spec.containers[0].volumeMounts
+ content:
+ name: config-volume
+ mountPath: /config/dir
+ readOnly: true
+ - contains:
+ path: spec.template.spec.volumes
+ content:
+ name: config-volume
+ projected:
+ sources:
+ - configMap:
+ name: polaris-release
+ items:
+ - key: application.properties
+ path: application.properties
+ - secret:
+ name: polaris-persistence
+ items:
+ - key: custom.xml
+ path: persistence.xml
+
+ - it: should configure volume for file logging
+ set:
+ logging.file.enabled: true
+ logging.file.logsDir: /custom/logs
+ asserts:
+ - contains:
+ path: spec.template.spec.containers[0].volumeMounts
+ content:
+ name: logs-storage
+ mountPath: /custom/logs
+ readOnly: false
+ - contains:
+ path: spec.template.spec.volumes
+ content:
+ name: logs-storage
+ persistentVolumeClaim:
+ claimName: polaris-release-logs
+
+ - it: should include extra volumes and volume mounts
+ set:
+ extraVolumes:
+ - name: extra-volume
+ emptyDir: {}
+ extraVolumeMounts:
+ - name: extra-volume
+ mountPath: /extra
+ readOnly: false
+ asserts:
+ - contains:
+ path: spec.template.spec.containers[0].volumeMounts
+ content:
+ name: extra-volume
+ mountPath: /extra
+ readOnly: false
+ - contains:
+ path: spec.template.spec.volumes
+ content:
+ name: extra-volume
+ emptyDir: {}
Added: dev/incubator/polaris/apache-polaris-1.0.0-incubating/helm-chart/tests/hpa_test.yaml
==============================================================================
--- dev/incubator/polaris/apache-polaris-1.0.0-incubating/helm-chart/tests/hpa_test.yaml (added)
+++ dev/incubator/polaris/apache-polaris-1.0.0-incubating/helm-chart/tests/hpa_test.yaml Tue Jun 24 00:39:22 2025
@@ -0,0 +1,209 @@
+#
+# 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.
+#
+
+chart:
+ version: 1.2.3
+ appVersion: 4.5.6
+
+release:
+ name: polaris-release
+ namespace: polaris-ns
+
+templates:
+ - hpa.yaml
+
+tests:
+
+ # kind
+ - it: should not create HPA by default
+ asserts:
+ - containsDocument:
+ kind: HorizontalPodAutoscaler
+ apiVersion: autoscaling/v2
+ not: true
+ - it: should create HPA when enabled
+ set:
+ autoscaling.enabled: true
+ asserts:
+ - containsDocument:
+ kind: HorizontalPodAutoscaler
+ apiVersion: autoscaling/v2
+
+ # metadata.name (with with autoscaling enabled)
+ - it: should set HPA name
+ set:
+ autoscaling.enabled: true
+ asserts:
+ - equal:
+ path: metadata.name
+ value: polaris-release
+ - it: should set HPA name with override
+ set:
+ autoscaling.enabled: true
+ nameOverride: polaris-override
+ asserts:
+ - equal:
+ path: metadata.name
+ value: polaris-release-polaris-override
+ - it: should set HPA name with full override
+ set:
+ autoscaling.enabled: true
+ fullnameOverride: polaris-override
+ asserts:
+ - equal:
+ path: metadata.name
+ value: polaris-override
+
+ # metadata.namespace (with autoscaling enabled)
+ - it: should set HPA namespace
+ set:
+ autoscaling.enabled: true
+ asserts:
+ - equal:
+ path: metadata.namespace
+ value: polaris-ns
+
+ # metadata.labels (with autoscaling enabled)
+ - it: should set HPA default labels
+ set:
+ autoscaling.enabled: true
+ asserts:
+ - isSubset:
+ path: metadata.labels
+ content:
+ app.kubernetes.io/name: polaris
+ app.kubernetes.io/instance: polaris-release
+ app.kubernetes.io/version: 4.5.6
+ app.kubernetes.io/managed-by: Helm
+ helm.sh/chart: polaris-1.2.3
+
+ # spec.scaleTargetRef.name (with autoscaling enabled)
+ - it: should set target deployment name
+ set:
+ autoscaling.enabled: true
+ asserts:
+ - equal:
+ path: spec.scaleTargetRef.name
+ value: polaris-release
+ - it: should set target deployment name with override
+ set:
+ autoscaling.enabled: true
+ nameOverride: polaris-override
+ asserts:
+ - equal:
+ path: spec.scaleTargetRef.name
+ value: polaris-release-polaris-override
+ - it: should set target deployment name with full override
+ set:
+ autoscaling.enabled: true
+ fullnameOverride: polaris-override
+ asserts:
+ - equal:
+ path: spec.scaleTargetRef.name
+ value: polaris-override
+
+ # spec.maxReplicas (with autoscaling enabled)
+ - it: should set default min replicas
+ set:
+ autoscaling.enabled: true
+ asserts:
+ - equal:
+ path: spec.minReplicas
+ value: 1
+ - it: should set min replicas
+ set:
+ autoscaling.enabled: true
+ autoscaling.minReplicas: 2
+ asserts:
+ - equal:
+ path: spec.minReplicas
+ value: 2
+
+ # spec.maxReplicas (with autoscaling enabled)
+ - it: should set default max replicas
+ set:
+ autoscaling.enabled: true
+ asserts:
+ - equal:
+ path: spec.maxReplicas
+ value: 3
+ - it: should set max replicas
+ set:
+ autoscaling.enabled: true
+ autoscaling.maxReplicas: 4
+ asserts:
+ - equal:
+ path: spec.maxReplicas
+ value: 4
+
+ # spec.metrics (with autoscaling enabled)
+ - it: should set default CPU utilization percentage
+ set:
+ autoscaling.enabled: true
+ asserts:
+ - contains:
+ path: spec.metrics
+ content:
+ type: Resource
+ resource:
+ name: cpu
+ target:
+ type: Utilization
+ averageUtilization: 80
+ - it: should set CPU utilization percentage
+ set:
+ autoscaling.enabled: true
+ autoscaling.targetCPUUtilizationPercentage: 90
+ asserts:
+ - contains:
+ path: spec.metrics
+ content:
+ type: Resource
+ resource:
+ name: cpu
+ target:
+ type: Utilization
+ averageUtilization: 90
+ - it: should not set default memory utilization percentage
+ set:
+ autoscaling.enabled: true
+ asserts:
+ - notContains:
+ path: spec.metrics
+ content:
+ type: Resource
+ resource:
+ name: memory
+ target:
+ type: Utilization
+ averageUtilization:
+ - it: should set memory utilization percentage
+ set:
+ autoscaling.enabled: true
+ autoscaling.targetMemoryUtilizationPercentage: 80
+ asserts:
+ - contains:
+ path: spec.metrics
+ content:
+ type: Resource
+ resource:
+ name: memory
+ target:
+ type: Utilization
+ averageUtilization: 80
Added: dev/incubator/polaris/apache-polaris-1.0.0-incubating/helm-chart/tests/ingress_test.yaml
==============================================================================
--- dev/incubator/polaris/apache-polaris-1.0.0-incubating/helm-chart/tests/ingress_test.yaml (added)
+++ dev/incubator/polaris/apache-polaris-1.0.0-incubating/helm-chart/tests/ingress_test.yaml Tue Jun 24 00:39:22 2025
@@ -0,0 +1,176 @@
+#
+# 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.
+#
+
+chart:
+ version: 1.2.3
+ appVersion: 4.5.6
+
+release:
+ name: polaris-release
+ namespace: polaris-ns
+
+templates:
+ - ingress.yaml
+
+tests:
+
+ # kind
+ - it: should not create ingress by default
+ asserts:
+ - containsDocument:
+ kind: Ingress
+ apiVersion: networking.k8s.io/v1
+ not: true
+ - it: should create ingress with enabled
+ set:
+ ingress.enabled: true
+ asserts:
+ - containsDocument:
+ kind: Ingress
+ apiVersion: networking.k8s.io/v1
+
+ # metadata.name (with ingress enabled)
+ - it: should set ingress name
+ set:
+ ingress.enabled: true
+ asserts:
+ - equal:
+ path: metadata.name
+ value: polaris-release
+ - it: should set ingress name with override
+ set:
+ ingress.enabled: true
+ nameOverride: polaris-override
+ asserts:
+ - equal:
+ path: metadata.name
+ value: polaris-release-polaris-override
+ - it: should set ingress name with full override
+ set:
+ ingress.enabled: true
+ fullnameOverride: polaris-override
+ asserts:
+ - equal:
+ path: metadata.name
+ value: polaris-override
+
+ # metadata.namespace (with ingress enabled)
+ - it: should set ingress namespace
+ set:
+ ingress.enabled: true
+ asserts:
+ - equal:
+ path: metadata.namespace
+ value: polaris-ns
+
+ # metadata.labels (with ingress enabled)
+ - it: should set ingress default labels
+ set:
+ ingress.enabled: true
+ asserts:
+ - isSubset:
+ path: metadata.labels
+ content:
+ app.kubernetes.io/name: polaris
+ app.kubernetes.io/instance: polaris-release
+ app.kubernetes.io/version: 4.5.6
+ app.kubernetes.io/managed-by: Helm
+ helm.sh/chart: polaris-1.2.3
+
+ # metadata.annotations (with ingress enabled)
+ - it: should not set ingress annotations by default
+ set:
+ ingress.enabled: true
+ asserts:
+ - notExists:
+ path: metadata.annotations
+ - it: should set ingress annotations
+ set:
+ ingress.enabled: true
+ ingress.annotations:
+ nginx.ingress.kubernetes.io/upstream-hash-by: "$binary_remote_addr"
+ asserts:
+ - isSubset:
+ path: metadata.annotations
+ content:
+ nginx.ingress.kubernetes.io/upstream-hash-by: "$binary_remote_addr"
+
+ # spec.ingressClassName (with ingress enabled)
+ - it: should not set ingress class by default
+ set:
+ ingress.enabled: true
+ asserts:
+ - notExists:
+ path: spec.ingressClassName
+ - it: should set ingress class
+ set:
+ ingress.enabled: true
+ ingress.className: nginx
+ asserts:
+ - equal:
+ path: spec.ingressClassName
+ value: nginx
+
+ # spec.tls (with ingress enabled)
+ - it: should not set ingress TLS by default
+ set:
+ ingress.enabled: true
+ asserts:
+ - notExists:
+ path: spec.tls
+ - it: should set ingress TLS
+ set:
+ ingress.enabled: true
+ ingress.tls:
+ - hosts:
+ - chart-example1.local
+ - chart-example2.local
+ secretName: secret1
+ asserts:
+ - equal:
+ path: spec.tls
+ value:
+ - hosts:
+ - "chart-example1.local"
+ - "chart-example2.local"
+ secretName: secret1
+
+ # spec.rules (with ingress enabled)
+ - it: should set ingress TLS
+ set:
+ ingress.enabled: true
+ ingress.hosts:
+ - host: chart-example.local
+ paths:
+ - path: /
+ pathType: Prefix
+ asserts:
+ - equal:
+ path: spec.rules
+ value:
+ - host: chart-example.local
+ http:
+ paths:
+ - path: /
+ pathType: Prefix
+ backend:
+ service:
+ name: polaris-release
+ port:
+ number: 8181
Added: dev/incubator/polaris/apache-polaris-1.0.0-incubating/helm-chart/tests/logging_storage_test.yaml
==============================================================================
--- dev/incubator/polaris/apache-polaris-1.0.0-incubating/helm-chart/tests/logging_storage_test.yaml (added)
+++ dev/incubator/polaris/apache-polaris-1.0.0-incubating/helm-chart/tests/logging_storage_test.yaml Tue Jun 24 00:39:22 2025
@@ -0,0 +1,106 @@
+#
+# Copyright (C) 2024 Dremio
+#
+# Licensed 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.
+#
+
+release:
+ name: polaris
+ namespace: polaris-ns
+
+tests:
+
+ - it: should create PVC for file logging
+ templates:
+ - storage.yaml
+ set:
+ logging.file.enabled: true
+ logging.file.logsDir: /var/log
+ logging.file.fileName: app.log
+ logging.file.storage.className: standard-rwo
+ logging.file.storage.size: 100Gi
+ asserts:
+ - containsDocument:
+ kind: PersistentVolumeClaim
+ apiVersion: v1
+ name: polaris-logs
+ namespace: polaris-ns
+ - equal:
+ path: spec
+ value:
+ accessModes:
+ - ReadWriteOnce
+ volumeMode: Filesystem
+ storageClassName: standard-rwo
+ resources:
+ requests:
+ storage: 100Gi
+ - notExists:
+ path: spec.selector
+
+ - it: should create PVC for file logging with selector labels
+ templates:
+ - storage.yaml
+ set:
+ logging.file.enabled: true
+ logging.file.logsDir: /var/log
+ logging.file.fileName: app.log
+ logging.file.storage.className: standard-rwo
+ logging.file.storage.size: 100Gi
+ logging.file.storage.selectorLabels:
+ app: polaris
+ documentSelector:
+ path: metadata.name
+ value: polaris-logs
+ asserts:
+ - containsDocument:
+ kind: PersistentVolumeClaim
+ apiVersion: v1
+ name: polaris-logs
+ namespace: polaris-ns
+ - equal:
+ path: spec
+ value:
+ accessModes:
+ - ReadWriteOnce
+ volumeMode: Filesystem
+ storageClassName: standard-rwo
+ resources:
+ requests:
+ storage: 100Gi
+ selector:
+ matchLabels:
+ app: polaris
+
+ - it: should mount PVC for file logging
+ templates:
+ - deployment.yaml
+ - configmap.yaml
+ set:
+ logging.file.enabled: true
+ logging.file.logsDir: /var/log
+ asserts:
+ - contains:
+ path: spec.template.spec.containers[0].volumeMounts
+ content:
+ name: logs-storage
+ mountPath: /var/log
+ readOnly: false
+ template: deployment.yaml
+ - contains:
+ path: spec.template.spec.volumes
+ content:
+ name: logs-storage
+ persistentVolumeClaim:
+ claimName: polaris-logs
+ template: deployment.yaml
Added: dev/incubator/polaris/apache-polaris-1.0.0-incubating/helm-chart/tests/quantity_test.yaml
==============================================================================
--- dev/incubator/polaris/apache-polaris-1.0.0-incubating/helm-chart/tests/quantity_test.yaml (added)
+++ dev/incubator/polaris/apache-polaris-1.0.0-incubating/helm-chart/tests/quantity_test.yaml Tue Jun 24 00:39:22 2025
@@ -0,0 +1,98 @@
+#
+# Copyright (C) 2024 Dremio
+#
+# Licensed 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.
+#
+
+templates:
+ - configmap.yaml
+
+tests:
+ - it: should convert quantity 12345
+ set: { advancedConfig: { test: "{{ include \"polaris.quantity\" \"12345\" }}" }}
+ asserts: [ { matchRegex: { path: "data[\"application.properties\"]", pattern: "test=12345" } } ]
+ - it: should convert quantity 12345.3456
+ set: { advancedConfig: { test: "{{ include \"polaris.quantity\" \"12345.3456\" }}" }}
+ asserts: [ { matchRegex: { path: "data[\"application.properties\"]", pattern: "test=12345.3456" } } ]
+ - it: should convert quantity 123451234512345
+ set: { advancedConfig: { test: "{{ include \"polaris.quantity\" \"123451234512345\" }}" }}
+ asserts: [ { matchRegex: { path: "data[\"application.properties\"]", pattern: "test=123451234512345" } } ]
+ - it: should convert quantity 1m
+ set: { advancedConfig: { test: "{{ include \"polaris.quantity\" \"1m\" }}" }}
+ asserts: [ { matchRegex: { path: "data[\"application.properties\"]", pattern: "test=0.001" } } ]
+ - it: should convert quantity 100m
+ set: { advancedConfig: { test: "{{ include \"polaris.quantity\" \"100m\" }}" }}
+ asserts: [ { matchRegex: { path: "data[\"application.properties\"]", pattern: "test=0.1" } } ]
+ - it: should convert quantity 1000m
+ set: { advancedConfig: { test: "{{ include \"polaris.quantity\" \"1000m\" }}" }}
+ asserts: [ { matchRegex: { path: "data[\"application.properties\"]", pattern: "test=1" } } ]
+ - it: should convert quantity 10000m
+ set: { advancedConfig: { test: "{{ include \"polaris.quantity\" \"10000m\" }}" }}
+ asserts: [ { matchRegex: { path: "data[\"application.properties\"]", pattern: "test=10" } } ]
+ - it: should convert quantity 1k
+ set: { advancedConfig: { test: "{{ include \"polaris.quantity\" \"1k\" }}" }}
+ asserts: [ { matchRegex: { path: "data[\"application.properties\"]", pattern: "test=1000" } } ]
+ - it: should convert quantity 1ki
+ set: { advancedConfig: { test: "{{ include \"polaris.quantity\" \"1ki\" }}" }}
+ asserts: [ { matchRegex: { path: "data[\"application.properties\"]", pattern: "test=1024" } } ]
+ - it: should convert quantity 100k
+ set: { advancedConfig: { test: "{{ include \"polaris.quantity\" \"100k\" }}" }}
+ asserts: [ { matchRegex: { path: "data[\"application.properties\"]", pattern: "test=100000" } } ]
+ - it: should convert quantity 100ki
+ set: { advancedConfig: { test: "{{ include \"polaris.quantity\" \"100ki\" }}" }}
+ asserts: [ { matchRegex: { path: "data[\"application.properties\"]", pattern: "test=102400" } } ]
+ - it: should convert quantity 1M
+ set: { advancedConfig: { test: "{{ include \"polaris.quantity\" \"1M\" }}" }}
+ asserts: [ { matchRegex: { path: "data[\"application.properties\"]", pattern: "test=1000000" } } ]
+ - it: should convert quantity 1Mi
+ set: { advancedConfig: { test: "{{ include \"polaris.quantity\" \"1Mi\" }}" }}
+ asserts: [ { matchRegex: { path: "data[\"application.properties\"]", pattern: "test=1048576" } } ]
+ - it: should convert quantity 1G
+ set: { advancedConfig: { test: "{{ include \"polaris.quantity\" \"1G\" }}" }}
+ asserts: [ { matchRegex: { path: "data[\"application.properties\"]", pattern: "test=1000000000" } } ]
+ - it: should convert quantity 1Gi
+ set: { advancedConfig: { test: "{{ include \"polaris.quantity\" \"1Gi\" }}" }}
+ asserts: [ { matchRegex: { path: "data[\"application.properties\"]", pattern: "test=1073741824" } } ]
+ - it: should convert quantity 1T
+ set: { advancedConfig: { test: "{{ include \"polaris.quantity\" \"1T\" }}" }}
+ asserts: [ { matchRegex: { path: "data[\"application.properties\"]", pattern: "test=1000000000000" } } ]
+ - it: should convert quantity 1Ti
+ set: { advancedConfig: { test: "{{ include \"polaris.quantity\" \"1Ti\" }}" }}
+ asserts: [ { matchRegex: { path: "data[\"application.properties\"]", pattern: "test=1099511627776" } } ]
+ - it: should convert quantity 1P
+ set: { advancedConfig: { test: "{{ include \"polaris.quantity\" \"1P\" }}" }}
+ asserts: [ { matchRegex: { path: "data[\"application.properties\"]", pattern: "test=1000000000000000" } } ]
+ - it: should convert quantity 1Pi
+ set: { advancedConfig: { test: "{{ include \"polaris.quantity\" \"1Pi\" }}" }}
+ asserts: [ { matchRegex: { path: "data[\"application.properties\"]", pattern: "test=1125899906842624" } } ]
+ - it: should convert quantity 1E
+ set: { advancedConfig: { test: "{{ include \"polaris.quantity\" \"1E\" }}" }}
+ asserts: [ { matchRegex: { path: "data[\"application.properties\"]", pattern: "test=1000000000000000000" } } ]
+ - it: should convert quantity 1Ei
+ set: { advancedConfig: { test: "{{ include \"polaris.quantity\" \"1Ei\" }}" }}
+ asserts: [ { matchRegex: { path: "data[\"application.properties\"]", pattern: "test=1152921504606846976" } } ]
+ - it: should fail on invalid quantity
+ set: { advancedConfig: { test: "{{ include \"polaris.quantity\" \"invalid\" }}" }}
+ asserts: [ { failedTemplate: { errorMessage: "invalid quantity: invalid" } } ]
+ - it: should fail on zero quantity
+ set: { advancedConfig: { test: "{{ include \"polaris.quantity\" \"0\" }}" }}
+ asserts: [ { failedTemplate: { errorMessage: "invalid quantity: 0" } } ]
+ - it: should fail on negative quantity
+ set: { advancedConfig: { test: "{{ include \"polaris.quantity\" \"-1\" }}" }}
+ asserts: [ { failedTemplate: { errorMessage: "invalid quantity: -1" } } ]
+ - it: should convert quantity in scientific notation 123e2
+ set: { advancedConfig: { test: "{{ include \"polaris.quantity\" \"123e2\" }}" }}
+ asserts: [ { matchRegex: { path: "data[\"application.properties\"]", pattern: "test=12300" } } ]
+ - it: should convert quantity in scientific notation 1.23e2
+ set: { advancedConfig: { test: "{{ include \"polaris.quantity\" \"1.23e2\" }}" }}
+ asserts: [ { matchRegex: { path: "data[\"application.properties\"]", pattern: "test=123" } } ]
Added: dev/incubator/polaris/apache-polaris-1.0.0-incubating/helm-chart/tests/service_extra_test.yaml
==============================================================================
--- dev/incubator/polaris/apache-polaris-1.0.0-incubating/helm-chart/tests/service_extra_test.yaml (added)
+++ dev/incubator/polaris/apache-polaris-1.0.0-incubating/helm-chart/tests/service_extra_test.yaml Tue Jun 24 00:39:22 2025
@@ -0,0 +1,349 @@
+#
+# 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.
+#
+
+chart:
+ version: 1.2.3
+ appVersion: 4.5.6
+
+release:
+ name: polaris-release
+ namespace: polaris-ns
+
+templates:
+ - service-extra.yaml
+
+tests:
+
+ - it: should not create extra service by default
+ asserts:
+ - containsDocument:
+ kind: Service
+ apiVersion: v1
+ not: true
+
+ - it: should fail to create extra service if suffix is not set
+ set:
+ extraServices:
+ - nameSuffix: ""
+ asserts:
+ - failedTemplate:
+ errorMessage: "extraServices[0]: missing required nameSuffix"
+
+ - it: should fail to create extra service if suffix is invalid
+ set:
+ extraServices:
+ - nameSuffix: "mgmt"
+ asserts:
+ - failedTemplate:
+ errorMessage: "extraServices[0]: invalid nameSuffix"
+ - it: should fail to create extra service if suffix is invalid (#2)
+ set:
+ extraServices:
+ - nameSuffix: "-mgmt"
+ asserts:
+ - failedTemplate:
+ errorMessage: "extraServices[0]: invalid nameSuffix"
+
+ # metadata.name
+ - it: should set service name
+ set:
+ extraServices:
+ - nameSuffix: "extra"
+ asserts:
+ - equal:
+ path: metadata.name
+ value: polaris-release-extra
+ - it: should set service name with override
+ set:
+ extraServices:
+ - nameSuffix: "extra"
+ nameOverride: polaris-override
+ asserts:
+ - equal:
+ path: metadata.name
+ value: polaris-release-polaris-override-extra
+ - it: should set service name with full override
+ set:
+ extraServices:
+ - nameSuffix: "extra"
+ fullnameOverride: polaris-override
+ asserts:
+ - equal:
+ path: metadata.name
+ value: polaris-override-extra
+
+ # metadata.namespace
+ - it: should set service namespace
+ set:
+ extraServices:
+ - nameSuffix: "extra"
+ asserts:
+ - equal:
+ path: metadata.namespace
+ value: polaris-ns
+
+ # metadata.labels
+ - it: should set service default labels
+ set:
+ extraServices:
+ - nameSuffix: "extra"
+ asserts:
+ - isSubset:
+ path: metadata.labels
+ content:
+ app.kubernetes.io/name: polaris
+ app.kubernetes.io/instance: polaris-release
+ app.kubernetes.io/version: 4.5.6
+ app.kubernetes.io/managed-by: Helm
+ helm.sh/chart: polaris-1.2.3
+
+ # metadata.annotations
+ - it: should not set service annotations by default
+ set:
+ extraServices:
+ - nameSuffix: "extra"
+ asserts:
+ - notExists:
+ path: metadata.annotations
+ - it: should set service annotations
+ set:
+ extraServices:
+ - nameSuffix: "extra"
+ annotations:
+ foo: bar
+ asserts:
+ - isSubset:
+ path: metadata.annotations
+ content:
+ foo: bar
+
+ # spec.type
+ - it: should set service default type
+ set:
+ extraServices:
+ - nameSuffix: "extra"
+ type: ClusterIP
+ asserts:
+ - equal:
+ path: spec.type
+ value: ClusterIP
+ - it: should set service type
+ set:
+ extraServices:
+ - nameSuffix: "extra"
+ type: NodePort
+ asserts:
+ - equal:
+ path: spec.type
+ value: NodePort
+
+ # spec.selector
+ - it: should set service default selector
+ set:
+ extraServices:
+ - nameSuffix: "extra"
+ asserts:
+ - isSubset:
+ path: spec.selector
+ content:
+ app.kubernetes.io/name: polaris
+ app.kubernetes.io/instance: polaris-release
+
+ # spec.ports
+ - it: should set service ports
+ set:
+ extraServices:
+ - nameSuffix: "extra"
+ ports:
+ - port: 18181
+ targetPort: 18181
+ name: polaris-http
+ - port: 28181
+ targetPort: 28181
+ name: polaris-http2
+ nodePort: 28181
+ protocol: UDP
+ asserts:
+ - equal:
+ path: spec.ports
+ value:
+ - port: 18181
+ targetPort: 18181
+ protocol: TCP
+ name: polaris-http
+ - port: 28181
+ targetPort: 28181
+ name: polaris-http2
+ nodePort: 28181
+ protocol: UDP
+
+ # spec.sessionAffinity
+ - it: should not set service session affinity by default
+ set:
+ extraServices:
+ - nameSuffix: "extra"
+ asserts:
+ - notExists:
+ path: spec.sessionAffinity
+ - it: should set service session affinity
+ set:
+ extraServices:
+ - nameSuffix: "extra"
+ sessionAffinity: ClientIP
+ asserts:
+ - equal:
+ path: spec.sessionAffinity
+ value: ClientIP
+
+ # spec.clusterIP
+ - it: should not set service cluster IP by default
+ set:
+ extraServices:
+ - nameSuffix: "extra"
+ asserts:
+ - notExists:
+ path: spec.clusterIP
+ - it: should set service cluster IP
+ set:
+ extraServices:
+ - nameSuffix: "extra"
+ clusterIP: 1.2.3.4
+ asserts:
+ - equal:
+ path: spec.clusterIP
+ value: 1.2.3.4
+
+ # spec.externalTrafficPolicy
+ - it: should not set service external traffic policy by default
+ set:
+ extraServices:
+ - nameSuffix: "extra"
+ asserts:
+ - notExists:
+ path: spec.externalTrafficPolicy
+ - it: should set service external traffic policy if LoadBalancer
+ set:
+ extraServices:
+ - nameSuffix: "extra"
+ externalTrafficPolicy: Local
+ type: LoadBalancer
+ asserts:
+ - equal:
+ path: spec.externalTrafficPolicy
+ value: Local
+ - it: should set service external traffic policy if NodePort
+ set:
+ extraServices:
+ - nameSuffix: "extra"
+ externalTrafficPolicy: Local
+ type: NodePort
+ asserts:
+ - equal:
+ path: spec.externalTrafficPolicy
+ value: Local
+ - it: should set service external traffic policy if ClusterIP
+ set:
+ extraServices:
+ - nameSuffix: "extra"
+ externalTrafficPolicy: Local
+ type: ClusterIP
+ asserts:
+ - notExists:
+ path: spec.externalTrafficPolicy
+
+ # spec.internalTrafficPolicy
+ - it: should not set service internal traffic policy by default
+ set:
+ extraServices:
+ - nameSuffix: "extra"
+ asserts:
+ - notExists:
+ path: spec.internalTrafficPolicy
+ - it: should set service internal traffic policy
+ set:
+ extraServices:
+ - nameSuffix: "extra"
+ internalTrafficPolicy: Local
+ asserts:
+ - equal:
+ path: spec.internalTrafficPolicy
+ value: Local
+
+ # spec.trafficDistribution
+ - it: should not set service traffic distribution by default
+ set:
+ extraServices:
+ - nameSuffix: "extra"
+ asserts:
+ - notExists:
+ path: spec.trafficDistribution
+ - it: should set service traffic distribution if Kubernetes version >= 1.31
+ capabilities:
+ majorVersion: 1
+ minorVersion: 31
+ set:
+ extraServices:
+ - nameSuffix: "extra"
+ trafficDistribution: Local
+ asserts:
+ - equal:
+ path: spec.trafficDistribution
+ value: Local
+ - it: should not set service traffic distribution if Kubernetes version < 1.31
+ capabilities:
+ majorVersion: 1
+ minorVersion: 30
+ set:
+ extraServices:
+ - nameSuffix: "extra"
+ trafficDistribution: Local
+ asserts:
+ - notExists:
+ path: spec.trafficDistribution
+
+ - it: should define many extra services
+ set:
+ extraServices:
+ - nameSuffix: "extra1"
+ annotations:
+ foo: bar
+ - nameSuffix: "extra2"
+ annotations:
+ bar: baz
+ asserts:
+ - hasDocuments:
+ count: 2
+ - equal:
+ path: metadata.name
+ value: polaris-release-extra1
+ documentIndex: 0
+ - equal:
+ path: metadata.name
+ value: polaris-release-extra2
+ documentIndex: 1
+ - equal:
+ path: metadata.annotations
+ value:
+ foo: bar
+ documentIndex: 0
+ - equal:
+ path: metadata.annotations
+ value:
+ bar: baz
+ documentIndex: 1
Added: dev/incubator/polaris/apache-polaris-1.0.0-incubating/helm-chart/tests/service_mgmt_test.yaml
==============================================================================
--- dev/incubator/polaris/apache-polaris-1.0.0-incubating/helm-chart/tests/service_mgmt_test.yaml (added)
+++ dev/incubator/polaris/apache-polaris-1.0.0-incubating/helm-chart/tests/service_mgmt_test.yaml Tue Jun 24 00:39:22 2025
@@ -0,0 +1,254 @@
+#
+# 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.
+#
+
+chart:
+ version: 1.2.3
+ appVersion: 4.5.6
+
+release:
+ name: polaris-release
+ namespace: polaris-ns
+
+templates:
+ - service-mgmt.yaml
+
+tests:
+
+ # metadata.name
+ - it: should set service name
+ asserts:
+ - equal:
+ path: metadata.name
+ value: polaris-release-mgmt
+ - it: should set service name with override
+ set:
+ nameOverride: polaris-override
+ asserts:
+ - equal:
+ path: metadata.name
+ value: polaris-release-polaris-override-mgmt
+ - it: should set service name with full override
+ set:
+ fullnameOverride: polaris-override
+ asserts:
+ - equal:
+ path: metadata.name
+ value: polaris-override-mgmt
+
+ # metadata.namespace
+ - it: should set service namespace
+ asserts:
+ - equal:
+ path: metadata.namespace
+ value: polaris-ns
+
+ # metadata.labels
+ - it: should set service default labels
+ asserts:
+ - isSubset:
+ path: metadata.labels
+ content:
+ app.kubernetes.io/name: polaris
+ app.kubernetes.io/instance: polaris-release
+ app.kubernetes.io/version: 4.5.6
+ app.kubernetes.io/managed-by: Helm
+ helm.sh/chart: polaris-1.2.3
+
+ # metadata.annotations
+ - it: should not set service annotations by default
+ asserts:
+ - notExists:
+ path: metadata.annotations
+ - it: should set service annotations
+ set:
+ managementService.annotations:
+ foo: bar
+ asserts:
+ - isSubset:
+ path: metadata.annotations
+ content:
+ foo: bar
+
+ # spec.type
+ - it: should set service default type
+ asserts:
+ - equal:
+ path: spec.type
+ value: ClusterIP
+ - it: should set service type
+ set:
+ managementService.type: NodePort
+ asserts:
+ - equal:
+ path: spec.type
+ value: NodePort
+
+ # spec.selector
+ - it: should set service default selector
+ asserts:
+ - isSubset:
+ path: spec.selector
+ content:
+ app.kubernetes.io/name: polaris
+ app.kubernetes.io/instance: polaris-release
+
+ # spec.ports
+ - it: should set service default ports
+ asserts:
+ - equal:
+ path: spec.ports
+ value:
+ - port: 8182
+ protocol: TCP
+ name: polaris-mgmt
+ - it: should set service ports
+ set:
+ managementService:
+ ports:
+ - port: 18182
+ targetPort: 18182
+ name: polaris-mgmt
+ asserts:
+ - equal:
+ path: spec.ports
+ value:
+ - port: 18182
+ targetPort: 18182
+ protocol: TCP
+ name: polaris-mgmt
+ - it: should set many service ports
+ set:
+ managementService:
+ ports:
+ - port: 18182
+ targetPort: 18182
+ name: polaris-mgmt
+ - port: 28182
+ targetPort: 28182
+ name: polaris-mgmt2
+ nodePort: 28182
+ protocol: UDP
+ asserts:
+ - equal:
+ path: spec.ports
+ value:
+ - port: 18182
+ targetPort: 18182
+ protocol: TCP
+ name: polaris-mgmt
+ - port: 28182
+ targetPort: 28182
+ name: polaris-mgmt2
+ nodePort: 28182
+ protocol: UDP
+
+ # spec.sessionAffinity
+ - it: should not set service session affinity by default
+ asserts:
+ - notExists:
+ path: spec.sessionAffinity
+ - it: should set service session affinity
+ set:
+ managementService.sessionAffinity: ClientIP
+ asserts:
+ - equal:
+ path: spec.sessionAffinity
+ value: ClientIP
+
+ # spec.clusterIP
+ - it: should set service cluster IP to None (headless) by default
+ asserts:
+ - equal:
+ path: spec.clusterIP
+ value: None
+ - it: should set service cluster IP
+ set:
+ managementService.clusterIP: 1.2.3.4
+ asserts:
+ - equal:
+ path: spec.clusterIP
+ value: 1.2.3.4
+
+
+ # spec.externalTrafficPolicy
+ - it: should not set service external traffic policy by default
+ asserts:
+ - notExists:
+ path: spec.externalTrafficPolicy
+ - it: should set service external traffic policy if LoadBalancer
+ set:
+ managementService.externalTrafficPolicy: Local
+ managementService.type: LoadBalancer
+ asserts:
+ - equal:
+ path: spec.externalTrafficPolicy
+ value: Local
+ - it: should set service external traffic policy if NodePort
+ set:
+ managementService.externalTrafficPolicy: Local
+ managementService.type: NodePort
+ asserts:
+ - equal:
+ path: spec.externalTrafficPolicy
+ value: Local
+ - it: should set service external traffic policy if ClusterIP
+ set:
+ managementService.externalTrafficPolicy: Local
+ managementService.type: ClusterIP
+ asserts:
+ - notExists:
+ path: spec.externalTrafficPolicy
+
+ # spec.internalTrafficPolicy
+ - it: should not set service internal traffic policy by default
+ asserts:
+ - notExists:
+ path: spec.internalTrafficPolicy
+ - it: should set service internal traffic policy
+ set:
+ managementService.internalTrafficPolicy: Local
+ asserts:
+ - equal:
+ path: spec.internalTrafficPolicy
+ value: Local
+
+ # spec.trafficDistribution
+ - it: should not set service traffic distribution by default
+ asserts:
+ - notExists:
+ path: spec.trafficDistribution
+ - it: should set service traffic distribution if Kubernetes version >= 1.31
+ capabilities:
+ majorVersion: 1
+ minorVersion: 31
+ set:
+ managementService.trafficDistribution: Local
+ asserts:
+ - equal:
+ path: spec.trafficDistribution
+ value: Local
+ - it: should not set service traffic distribution if Kubernetes version < 1.31
+ capabilities:
+ majorVersion: 1
+ minorVersion: 30
+ set:
+ managementService.trafficDistribution: Local
+ asserts:
+ - notExists:
+ path: spec.trafficDistribution
Added: dev/incubator/polaris/apache-polaris-1.0.0-incubating/helm-chart/tests/service_monitor_test.yaml
==============================================================================
--- dev/incubator/polaris/apache-polaris-1.0.0-incubating/helm-chart/tests/service_monitor_test.yaml (added)
+++ dev/incubator/polaris/apache-polaris-1.0.0-incubating/helm-chart/tests/service_monitor_test.yaml Tue Jun 24 00:39:22 2025
@@ -0,0 +1,73 @@
+#
+# Copyright (C) 2024 Dremio
+#
+# Licensed 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.
+#
+
+release:
+ name: polaris
+ namespace: polaris-ns
+
+capabilities:
+ apiVersions:
+ - monitoring.coreos.com/v1
+
+templates:
+ - servicemonitor.yaml
+
+tests:
+
+ - it: should create ServiceMonitor if enabled
+ set:
+ serviceMonitor:
+ enabled: true
+ asserts:
+ - containsDocument:
+ kind: ServiceMonitor
+ apiVersion: monitoring.coreos.com/v1
+ name: polaris
+ namespace: polaris-ns
+
+ - it: should not create ServiceMonitor if disabled
+ set:
+ serviceMonitor:
+ enabled: false
+ asserts:
+ - containsDocument:
+ kind: ServiceMonitor
+ apiVersion: monitoring.coreos.com/v1
+ name: polaris
+ namespace: polaris-ns
+ not: true
+
+ - it: should add metrics relabelings
+ set:
+ serviceMonitor:
+ enabled: true
+ metricRelabelings:
+ - source_labels: [ __meta_kubernetes_namespace ]
+ separator: ;
+ regex: (.*)
+ target_label: namespace
+ replacement: $1
+ action: replace
+ asserts:
+ - equal:
+ path: spec.endpoints[ 0].metricRelabelings
+ value:
+ - source_labels: [ __meta_kubernetes_namespace ]
+ separator: ;
+ regex: (.*)
+ target_label: namespace
+ replacement: $1
+ action: replace
\ No newline at end of file
Added: dev/incubator/polaris/apache-polaris-1.0.0-incubating/helm-chart/tests/service_test.yaml
==============================================================================
--- dev/incubator/polaris/apache-polaris-1.0.0-incubating/helm-chart/tests/service_test.yaml (added)
+++ dev/incubator/polaris/apache-polaris-1.0.0-incubating/helm-chart/tests/service_test.yaml Tue Jun 24 00:39:22 2025
@@ -0,0 +1,331 @@
+#
+# 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.
+#
+
+chart:
+ version: 1.2.3
+ appVersion: 4.5.6
+
+release:
+ name: polaris-release
+ namespace: polaris-ns
+
+templates:
+ - service.yaml
+
+tests:
+ # metadata.name
+ - it: should set service name
+ asserts:
+ - equal:
+ path: metadata.name
+ value: polaris-release
+ - it: should set service name with override
+ set:
+ nameOverride: polaris-override
+ asserts:
+ - equal:
+ path: metadata.name
+ value: polaris-release-polaris-override
+ - it: should set service name with full override
+ set:
+ fullnameOverride: polaris-override
+ asserts:
+ - equal:
+ path: metadata.name
+ value: polaris-override
+
+ # metadata.namespace
+ - it: should set service namespace
+ asserts:
+ - equal:
+ path: metadata.namespace
+ value: polaris-ns
+
+ # metadata.labels
+ - it: should set service default labels
+ asserts:
+ - isSubset:
+ path: metadata.labels
+ content:
+ app.kubernetes.io/name: polaris
+ app.kubernetes.io/instance: polaris-release
+ app.kubernetes.io/version: 4.5.6
+ app.kubernetes.io/managed-by: Helm
+ helm.sh/chart: polaris-1.2.3
+
+ # metadata.annotations
+ - it: should not set service annotations by default
+ asserts:
+ - notExists:
+ path: metadata.annotations
+ - it: should set service annotations
+ set:
+ service.annotations:
+ foo: bar
+ asserts:
+ - isSubset:
+ path: metadata.annotations
+ content:
+ foo: bar
+
+ # spec.type
+ - it: should set service default type
+ asserts:
+ - equal:
+ path: spec.type
+ value: ClusterIP
+ - it: should set service type
+ set:
+ service.type: NodePort
+ asserts:
+ - equal:
+ path: spec.type
+ value: NodePort
+
+ # spec.selector
+ - it: should set service default selector
+ asserts:
+ - isSubset:
+ path: spec.selector
+ content:
+ app.kubernetes.io/name: polaris
+ app.kubernetes.io/instance: polaris-release
+
+ # spec.ports
+ - it: should set service default ports
+ asserts:
+ - equal:
+ path: spec.ports
+ value:
+ - port: 8181
+ protocol: TCP
+ name: polaris-http
+ - it: should set service ports
+ set:
+ service:
+ ports:
+ - port: 18181
+ targetPort: 18181
+ name: polaris-http
+ asserts:
+ - equal:
+ path: spec.ports
+ value:
+ - port: 18181
+ targetPort: 18181
+ protocol: TCP
+ name: polaris-http
+ - it: should set many service ports
+ set:
+ service:
+ ports:
+ - port: 18181
+ targetPort: 18181
+ name: polaris-http
+ - port: 28181
+ targetPort: 28181
+ name: polaris-http2
+ protocol: UDP
+ asserts:
+ - equal:
+ path: spec.ports
+ value:
+ - port: 18181
+ targetPort: 18181
+ protocol: TCP
+ name: polaris-http
+ - port: 28181
+ targetPort: 28181
+ name: polaris-http2
+ protocol: UDP
+ # node port
+ - it: should set nodeport only when service type is NodePort
+ set:
+ service:
+ type: NodePort
+ ports:
+ - port: 18181
+ targetPort: 18181
+ nodePort: 30081
+ name: polaris-http
+ asserts:
+ - equal:
+ path: spec.type
+ value: NodePort
+ - equal:
+ path: spec.ports
+ value:
+ - port: 18181
+ targetPort: 18181
+ protocol: TCP
+ name: polaris-http
+ nodePort: 30081
+ - it: should not set nodeport type is NodePort and nodePort value is empty
+ set:
+ service:
+ type: NodePort
+ ports:
+ - port: 18181
+ targetPort: 18181
+ name: polaris-http
+ asserts:
+ - equal:
+ path: spec.type
+ value: NodePort
+ - equal:
+ path: spec.ports
+ value:
+ - port: 18181
+ targetPort: 18181
+ protocol: TCP
+ name: polaris-http
+
+ - it: should set node port only if service type is NodePort
+ set:
+ service:
+ type: NodePort
+ ports:
+ - port: 18181
+ targetPort: 18181
+ nodePort: 30081
+ name: polaris-http
+ asserts:
+ - equal:
+ path: spec.type
+ value: NodePort
+ - equal:
+ path: spec.ports
+ value:
+ - port: 18181
+ targetPort: 18181
+ protocol: TCP
+ name: polaris-http
+ nodePort: 30081
+ - it: should not set node port if service type is NodePort and nodePort is empty
+ set:
+ service:
+ type: NodePort
+ ports:
+ - port: 18181
+ targetPort: 18181
+ name: polaris-http
+ asserts:
+ - equal:
+ path: spec.type
+ value: NodePort
+ - equal:
+ path: spec.ports
+ value:
+ - port: 18181
+ targetPort: 18181
+ protocol: TCP
+ name: polaris-http
+
+ # spec.sessionAffinity
+ - it: should not set service session affinity by default
+ asserts:
+ - notExists:
+ path: spec.sessionAffinity
+ - it: should set service session affinity
+ set:
+ service.sessionAffinity: ClientIP
+ asserts:
+ - equal:
+ path: spec.sessionAffinity
+ value: ClientIP
+
+ # spec.clusterIP
+ - it: should not set service cluster IP by default
+ asserts:
+ - notExists:
+ path: spec.clusterIP
+ - it: should set service cluster IP
+ set:
+ service.clusterIP: 1.2.3.4
+ asserts:
+ - equal:
+ path: spec.clusterIP
+ value: 1.2.3.4
+
+ # spec.externalTrafficPolicy
+ - it: should not set service external traffic policy by default
+ asserts:
+ - notExists:
+ path: spec.externalTrafficPolicy
+ - it: should set service external traffic policy if LoadBalancer
+ set:
+ service.externalTrafficPolicy: Local
+ service.type: LoadBalancer
+ asserts:
+ - equal:
+ path: spec.externalTrafficPolicy
+ value: Local
+ - it: should set service external traffic policy if NodePort
+ set:
+ service.externalTrafficPolicy: Local
+ service.type: NodePort
+ asserts:
+ - equal:
+ path: spec.externalTrafficPolicy
+ value: Local
+ - it: should set service external traffic policy if ClusterIP
+ set:
+ service.externalTrafficPolicy: Local
+ service.type: ClusterIP
+ asserts:
+ - notExists:
+ path: spec.externalTrafficPolicy
+
+ # spec.internalTrafficPolicy
+ - it: should not set service internal traffic policy by default
+ asserts:
+ - notExists:
+ path: spec.internalTrafficPolicy
+ - it: should set service internal traffic policy
+ set:
+ service.internalTrafficPolicy: Local
+ asserts:
+ - equal:
+ path: spec.internalTrafficPolicy
+ value: Local
+
+ # spec.trafficDistribution
+ - it: should not set service traffic distribution by default
+ asserts:
+ - notExists:
+ path: spec.trafficDistribution
+ - it: should set service traffic distribution if Kubernetes version >= 1.31
+ capabilities:
+ majorVersion: 1
+ minorVersion: 31
+ set:
+ service.trafficDistribution: Local
+ asserts:
+ - equal:
+ path: spec.trafficDistribution
+ value: Local
+ - it: should not set service traffic distribution if Kubernetes version < 1.31
+ capabilities:
+ majorVersion: 1
+ minorVersion: 30
+ set:
+ service.trafficDistribution: Local
+ asserts:
+ - notExists:
+ path: spec.trafficDistribution
Added: dev/incubator/polaris/apache-polaris-1.0.0-incubating/helm-chart/tests/serviceaccount_test.yaml
==============================================================================
--- dev/incubator/polaris/apache-polaris-1.0.0-incubating/helm-chart/tests/serviceaccount_test.yaml (added)
+++ dev/incubator/polaris/apache-polaris-1.0.0-incubating/helm-chart/tests/serviceaccount_test.yaml Tue Jun 24 00:39:22 2025
@@ -0,0 +1,108 @@
+#
+# 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.
+#
+
+chart:
+ version: 1.2.3
+ appVersion: 4.5.6
+
+release:
+ name: polaris-release
+ namespace: polaris-ns
+
+templates:
+ - serviceaccount.yaml
+
+tests:
+
+ # Kind
+ - it: should create service account by default
+ asserts:
+ - containsDocument:
+ kind: ServiceAccount
+ apiVersion: v1
+ - it: should not create service account when disabled
+ set:
+ serviceAccount.create: false
+ asserts:
+ - containsDocument:
+ kind: ServiceAccount
+ apiVersion: v1
+ not: true
+
+ # metadata.name
+ - it: should set service account name
+ asserts:
+ - equal:
+ path: metadata.name
+ value: polaris-release
+ - it: should set service account name with override
+ set:
+ nameOverride: polaris-override
+ asserts:
+ - equal:
+ path: metadata.name
+ value: polaris-release-polaris-override
+ - it: should set service account name with full override
+ set:
+ fullnameOverride: polaris-override
+ asserts:
+ - equal:
+ path: metadata.name
+ value: polaris-override
+ - it: should set service account name with defined name
+ set:
+ serviceAccount.name: polaris-override
+ asserts:
+ - equal:
+ path: metadata.name
+ value: polaris-override
+
+ # metadata.namespace
+ - it: should set service account namespace
+ asserts:
+ - equal:
+ path: metadata.namespace
+ value: polaris-ns
+
+ # metadata.labels
+ - it: should set service account default labels
+ asserts:
+ - isSubset:
+ path: metadata.labels
+ content:
+ app.kubernetes.io/name: polaris
+ app.kubernetes.io/instance: polaris-release
+ app.kubernetes.io/version: 4.5.6
+ app.kubernetes.io/managed-by: Helm
+ helm.sh/chart: polaris-1.2.3
+
+ # metadata.annotations
+ - it: should not set service account annotations by default
+ asserts:
+ - notExists:
+ path: metadata.annotations
+ - it: should set service account annotations
+ set:
+ serviceAccount.annotations:
+ foo: bar
+ asserts:
+ - isSubset:
+ path: metadata.annotations
+ content:
+ foo: bar