This is an automated email from the ASF dual-hosted git repository.
baiyangtx pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/amoro.git
The following commit(s) were added to refs/heads/master by this push:
new 75ac1775b [AMORO-2778][Helm Chart] Add Tests for Helm Chart (#2794)
75ac1775b is described below
commit 75ac1775b0c4486747ac65a42b3330d3f4406e41
Author: Lianne Li <[email protected]>
AuthorDate: Sat May 4 10:23:24 2024 +0800
[AMORO-2778][Helm Chart] Add Tests for Helm Chart (#2794)
* [AMORO-2778] add Tests for Helm Charts
* Add Tests for Helm Chart Templates
* [AMORO-2778] add Tests for Helm Charts With Lisence
* [AMORO-2778][helm chart] fix syntax errors on test names, and add a
workflow to run unittest when aubmit pr
* [AMORO2778] debug workflow
* [AMORO2778] debug workflow
* Update .github/workflows/pull-request-on-helmchat.yml
Co-authored-by: baiyangtx <[email protected]>
* Update and rename pull-request-on-helmchat.yml to helm-charts-ci.yml
---------
Co-authored-by: baiyangtx <[email protected]>
---
.github/workflows/helm-charts-ci.yml | 60 ++++
charts/amoro/.helmignore | 3 +-
charts/amoro/README.md | 18 +-
...base-secert.yaml => amoro-database-secret.yaml} | 1 -
charts/amoro/tests/amoro-configmap_test.yaml | 123 +++++++
charts/amoro/tests/amoro-database-secret_test.yaml | 86 +++++
charts/amoro/tests/amoro-deployment_test.yaml | 367 +++++++++++++++++++++
charts/amoro/tests/amoro-ingress_test.yaml | 222 +++++++++++++
charts/amoro/tests/amoro-rbac_test.yaml | 74 +++++
charts/amoro/tests/amoro-service_test.yaml | 265 +++++++++++++++
charts/amoro/tests/amoro-serviceaccount_test.yaml | 64 ++++
11 files changed, 1280 insertions(+), 3 deletions(-)
diff --git a/.github/workflows/helm-charts-ci.yml
b/.github/workflows/helm-charts-ci.yml
new file mode 100644
index 000000000..7f659a1a4
--- /dev/null
+++ b/.github/workflows/helm-charts-ci.yml
@@ -0,0 +1,60 @@
+#
+# 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.
+#
+
+
+# This workflow will execute Tests when submit a PR.
+
+name: "CI for Helm Charts"
+
+concurrency:
+ group: ${{ github.workflow }}-${{ github.ref }}
+ cancel-in-progress: true
+
+on:
+ pull_request:
+ paths:
+ - 'charts/**'
+ push:
+ paths:
+ - 'charts/**'
+ merge_group:
+ workflow_dispatch:
+
+jobs:
+ unit-tests:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+
+ - name: Install Helm
+ uses: azure/setup-helm@v4
+
+ - name: Install helm-unittests
+ run: |
+ helm plugin install
https://github.com/helm-unittest/helm-unittest.git
+
+ - name: Rebuild Chart with Dependency
+ run: |
+ cd charts/amoro
+ helm dependency build
+
+ - name: Run Unit Tests
+ run: |
+ helm unittest charts/amoro
diff --git a/charts/amoro/.helmignore b/charts/amoro/.helmignore
index c954bd4f0..c220f2ed4 100644
--- a/charts/amoro/.helmignore
+++ b/charts/amoro/.helmignore
@@ -22,4 +22,5 @@
*.tmproj
.vscode/
# test files
-test-values.yaml
\ No newline at end of file
+test-values.yaml
+tests/
\ No newline at end of file
diff --git a/charts/amoro/README.md b/charts/amoro/README.md
index a0884628f..82617a5bb 100644
--- a/charts/amoro/README.md
+++ b/charts/amoro/README.md
@@ -62,4 +62,20 @@ Configuration guide documentation for Amoro lives [on the
website](https://amoro
## Contributing
-Want to help build Amoro? Check out our [contributing
documentation](https://amoro.apache.org/join-community/).
\ No newline at end of file
+Want to help build Amoro? Check out our [contributing
documentation](https://amoro.apache.org/join-community/).
+
+### Unit Test
+
+Helm Chart for Amoro supports Unit Tests by
[helm-unittest](https://github.com/helm-unittest/helm-unittest). Before
+submitting PRs, please let all the tests passed .
+
+2 Steps for test. (Same as above,you should rebuild the charts/ first)
+
+- Install `helm-unittest`
+```shell
+helm plugin install https://github.com/helm-unittest/helm-unittest.git
+```
+- Execute Tests.
+```shell
+helm unittest ../amoro
+```
diff --git a/charts/amoro/templates/amoro-database-secert.yaml
b/charts/amoro/templates/amoro-database-secret.yaml
similarity index 95%
rename from charts/amoro/templates/amoro-database-secert.yaml
rename to charts/amoro/templates/amoro-database-secret.yaml
index 4c0720c2e..022562e17 100644
--- a/charts/amoro/templates/amoro-database-secert.yaml
+++ b/charts/amoro/templates/amoro-database-secret.yaml
@@ -21,7 +21,6 @@ kind: Secret
metadata:
name: {{ include "common.names.fullname" . }}
labels:
- app.kubernetes.io/name: amoro-database-secret
{{- include "amoro.labels" . | nindent 4 }}
type: Opaque
data:
diff --git a/charts/amoro/tests/amoro-configmap_test.yaml
b/charts/amoro/tests/amoro-configmap_test.yaml
new file mode 100644
index 000000000..c0bee71ba
--- /dev/null
+++ b/charts/amoro/tests/amoro-configmap_test.yaml
@@ -0,0 +1,123 @@
+# 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 Amoro ConfigMap
+templates:
+ - amoro-configmap.yaml
+chart:
+ appVersion: 0.1.0
+ version: 0.6.0
+tests:
+ - it: Amoro ConfigMap should override name if set
+ set:
+ fullnameOverride: test
+ asserts:
+ - containsDocument:
+ kind: ConfigMap
+ apiVersion: v1
+ name: test
+ - hasDocuments:
+ count: 1
+ - it: Amoro configMap should reflect jvmOptions
+ set:
+ jvmOptions:
+ xms=8196
+ asserts:
+ - matchRegex:
+ path: data["jvm.properties"]
+ pattern:
+ |
+ xms=8196
+ - it: Amoro configMap should reflect ports
+ asserts:
+ - matchRegex:
+ path: data["config.yaml"]
+ pattern:
+ |
+ bind-port: 1260
+ - it: Amoro configMap should reflect database.username if type is set to
mysql
+ set:
+ amoroConf:
+ database:
+ type: mysql
+ username: aaa
+ asserts:
+ - matchRegex:
+ path: data["config.yaml"]
+ pattern:
+ |
+ username: "aaa"
+ - it: Amoro configMap should reflect terminal iceberg params if
terminal.backend is set to local
+ set:
+ amoroConf:
+ terminal:
+ backend: local
+ icebergHandleTimestampWithoutTimezone: true
+ asserts:
+ - matchRegex:
+ path: data["config.yaml"]
+ pattern:
+ |
+ local.spark.sql.iceberg.handle-timestamp-without-timezone: true
+ - it: Amoro configMap should show kyuubi url if terminal.backend is set to
kyuubi
+ set:
+ amoroConf:
+ terminal:
+ backend: kyuubi
+ kyuubiJdbcUrl: jdbc:hive2://127.0.0.1:10009/
+ asserts:
+ - matchRegex:
+ path: data["config.yaml"]
+ pattern:
+ |
+ kyuubi.jdbc.url: "jdbc:hive2://127.0.0.1:10009/"
+ - it: Amoro configMap should show flink if flink optimizer enabled is set
true
+ set:
+ optimizer:
+ flink:
+ enabled: true
+ name: flink1
+ asserts:
+ - matchRegex:
+ path: data["config.yaml"]
+ pattern:
+ |
+ - name: flink1
+ - it: Amoro configMap should show spark if spark optimizer enabled is set
true
+ set:
+ optimizer:
+ spark:
+ enabled: true
+ name: spark1
+ asserts:
+ - matchRegex:
+ path: data["config.yaml"]
+ pattern:
+ |
+ - name: spark1
+ - it: Amoro configMap should show local if local optimizer enabled is set
true
+ set:
+ optimizer:
+ local:
+ enabled: true
+ name: local1
+ asserts:
+ - matchRegex:
+ path: data["config.yaml"]
+ pattern:
+ |
+ - name: local1
\ No newline at end of file
diff --git a/charts/amoro/tests/amoro-database-secret_test.yaml
b/charts/amoro/tests/amoro-database-secret_test.yaml
new file mode 100644
index 000000000..9fba396f7
--- /dev/null
+++ b/charts/amoro/tests/amoro-database-secret_test.yaml
@@ -0,0 +1,86 @@
+# 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 Amoro Database Secret
+templates:
+ - amoro-database-secret.yaml
+chart:
+ appVersion: 0.1.0
+ version: 0.6.0
+tests:
+ - it: Amoro database secret should not exist if database type is set to derby
+ set:
+ amoroConf:
+ database:
+ type: derby
+ asserts:
+ - hasDocuments:
+ count: 0
+ - it: Amoro database secret should exist if database type is set to mysql
+ set:
+ fullnameOverride: test
+ amoroConf:
+ database:
+ type: mysql
+ username: "abc"
+ password: "123"
+ asserts:
+ - containsDocument:
+ kind: Secret
+ apiVersion: v1
+ name: test
+ - hasDocuments:
+ count: 1
+ - it: Amoro database secret should exist if database type is set to postgres
+ set:
+ fullnameOverride: test
+ amoroConf:
+ database:
+ type: postgres
+ username: "abc"
+ password: "123"
+ asserts:
+ - containsDocument:
+ kind: Secret
+ apiVersion: v1
+ name: test
+ - hasDocuments:
+ count: 1
+ - it: Amoro database secret should reflect username if database type is set
to mysql
+ set:
+ amoroConf:
+ database:
+ type: mysql
+ username: "abc"
+ password: "123"
+ asserts:
+ - equal:
+ path: data.username
+ value: "abc"
+ decodeBase64: true
+ - it: Amoro database secret should reflect password if database type is set
to mysql
+ set:
+ amoroConf:
+ database:
+ type: mysql
+ username: "abc"
+ password: "123"
+ asserts:
+ - equal:
+ path: data.password
+ value: "123"
+ decodeBase64: true
\ No newline at end of file
diff --git a/charts/amoro/tests/amoro-deployment_test.yaml
b/charts/amoro/tests/amoro-deployment_test.yaml
new file mode 100644
index 000000000..d0d1d6ee4
--- /dev/null
+++ b/charts/amoro/tests/amoro-deployment_test.yaml
@@ -0,0 +1,367 @@
+# 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 Amoro Deployment
+templates:
+ - amoro-configmap.yaml
+ - amoro-deployment.yaml
+chart:
+ appVersion: 0.1.0
+ version: 0.6.0
+tests:
+ - it: Amoro Deployment should override name if set
+ template: amoro-deployment.yaml
+ set:
+ fullnameOverride: test
+ nameOverride: test1
+ asserts:
+ - containsDocument:
+ kind: Deployment
+ apiVersion: apps/v1
+ name: test
+ - hasDocuments:
+ count: 1
+ - isSubset:
+ path: spec.selector.matchLabels
+ content:
+ app.kubernetes.io/name: test1
+ - isSubset:
+ path: spec.template.metadata.labels
+ content:
+ app.kubernetes.io/name: test1
+ - it: Amoro Deployment should contain imagePullSecrets if set
+ template: amoro-deployment.yaml
+ set:
+ imagePullSecrets:
+ - name: test
+ asserts:
+ - exists:
+ path: spec.template.spec.imagePullSecrets
+ - contains:
+ path: spec.template.spec.imagePullSecrets
+ content:
+ name: test
+ - it: Amoro Deployment should set if serviceAccount.name is set even though
serviceAccount.create is false
+ template: amoro-deployment.yaml
+ set:
+ serviceAccount:
+ create: false
+ name: test
+ asserts:
+ - exists:
+ path: spec.template.spec.serviceAccountName
+ - equal:
+ path: spec.template.spec.serviceAccountName
+ value: test
+ - it: Amoro Deployment should set default value if serviceAccount.name is
set even though serviceAccount.create is false
+ template: amoro-deployment.yaml
+ set:
+ fullnameOverride: test
+ serviceAccount:
+ create: true
+ asserts:
+ - exists:
+ path: spec.template.spec.serviceAccountName
+ - equal:
+ path: spec.template.spec.serviceAccountName
+ value: test
+ - it: Amoro Deployment should reflect securityContext if set
+ template: amoro-deployment.yaml
+ set:
+ securityContext:
+ runAsUser: 2000
+ asserts:
+ - equal:
+ path: spec.template.spec.containers[?(@.name ==
"amoro-ams")].securityContext
+ value:
+ runAsUser: 2000
+ - equal:
+ path: spec.template.spec.securityContext
+ value:
+ runAsUser: 2000
+ - it: Amoro Deployment should reflect pullPolicy if set
+ template: amoro-deployment.yaml
+ set:
+ image:
+ pullPolicy: Always
+ asserts:
+ - equal:
+ path: spec.template.spec.containers[?(@.name ==
"amoro-ams")].imagePullPolicy
+ value: Always
+ - it: Amoro Deployment should add env if database type is set to mysql
+ template: amoro-deployment.yaml
+ set:
+ fullnameOverride: test
+ amoroConf:
+ database:
+ type: "mysql"
+ asserts:
+ - contains:
+ path: spec.template.spec.containers[?(@.name == "amoro-ams")].env
+ content:
+ name: "AMS_DATABASE_USERNAME"
+ valueFrom:
+ secretKeyRef:
+ name: test
+ key: username
+ - contains:
+ path: spec.template.spec.containers[?(@.name == "amoro-ams")].env
+ content:
+ name: "AMS_DATABASE_PASSWORD"
+ valueFrom:
+ secretKeyRef:
+ name: test
+ key: password
+ - it: Amoro Deployment should add env if database type is set to postgres
+ template: amoro-deployment.yaml
+ set:
+ fullnameOverride: test
+ amoroConf:
+ database:
+ type: "postgres"
+ asserts:
+ - contains:
+ path: spec.template.spec.containers[?(@.name == "amoro-ams")].env
+ content:
+ name: "AMS_DATABASE_USERNAME"
+ valueFrom:
+ secretKeyRef:
+ name: test
+ key: username
+ - contains:
+ path: spec.template.spec.containers[?(@.name == "amoro-ams")].env
+ content:
+ name: "AMS_DATABASE_PASSWORD"
+ valueFrom:
+ secretKeyRef:
+ name: test
+ key: password
+ - it: Amoro Deployment should add env if set
+ template: amoro-deployment.yaml
+ set:
+ env:
+ - name: "ABC-TEST"
+ value: "ABC-VALUE"
+ - name: "ABC-TEST2"
+ value: "ABC-VALUE2"
+ asserts:
+ - contains:
+ path: spec.template.spec.containers[?(@.name == "amoro-ams")].env
+ content:
+ name: "ABC-TEST"
+ value: "ABC-VALUE"
+ - contains:
+ path: spec.template.spec.containers[?(@.name == "amoro-ams")].env
+ content:
+ name: "ABC-TEST2"
+ value: "ABC-VALUE2"
+ - it: Amoro Deployment should add envFrom if set
+ template: amoro-deployment.yaml
+ set:
+ env:
+ - name: "ABC-TEST"
+ valueFrom:
+ secretKeyRef:
+ name: abc
+ key: abc
+ asserts:
+ - contains:
+ path: spec.template.spec.containers[?(@.name == "amoro-ams")].env
+ content:
+ name: "ABC-TEST"
+ valueFrom:
+ secretKeyRef:
+ name: abc
+ key: abc
+ - it: Amoro Deployment should reflect ports of services
+ template: amoro-deployment.yaml
+ asserts:
+ - contains:
+ path: spec.template.spec.containers[?(@.name == "amoro-ams")].ports
+ content:
+ name: rest
+ containerPort: 1630
+ - contains:
+ path: spec.template.spec.containers[?(@.name == "amoro-ams")].ports
+ content:
+ name: table
+ containerPort: 1260
+ - contains:
+ path: spec.template.spec.containers[?(@.name == "amoro-ams")].ports
+ content:
+ name: optimizing
+ containerPort: 1261
+ - it: Amoro Deployment should not exist livenessProbe if enabled is set to
false
+ template: amoro-deployment.yaml
+ set:
+ livenessProbe:
+ enabled: false
+ asserts:
+ - notExists:
+ path: spec.template.spec.containers[?(@.name ==
"amoro-ams")].livenessProbe
+ - it: Amoro Deployment should exist livenessProbe if enabled is set to true
+ template: amoro-deployment.yaml
+ set:
+ livenessProbe:
+ enabled: true
+ asserts:
+ - exists:
+ path: spec.template.spec.containers[?(@.name ==
"amoro-ams")].livenessProbe
+ - equal:
+ path: spec.template.spec.containers[?(@.name ==
"amoro-ams")].livenessProbe.initialDelaySeconds
+ value: 40
+ - equal:
+ path: spec.template.spec.containers[?(@.name ==
"amoro-ams")].livenessProbe.periodSeconds
+ value: 10
+ - equal:
+ path: spec.template.spec.containers[?(@.name ==
"amoro-ams")].livenessProbe.timeoutSeconds
+ value: 2
+ - equal:
+ path: spec.template.spec.containers[?(@.name ==
"amoro-ams")].livenessProbe.failureThreshold
+ value: 10
+ - equal:
+ path: spec.template.spec.containers[?(@.name ==
"amoro-ams")].livenessProbe.successThreshold
+ value: 1
+ - it: Amoro Deployment should not exist readinessProbe if enabled is set to
false
+ template: amoro-deployment.yaml
+ set:
+ readinessProbe:
+ enabled: false
+ asserts:
+ - notExists:
+ path: spec.template.spec.containers[?(@.name ==
"amoro-ams")].readinessProbe
+ - it: Amoro Deployment should exist readinessProbe if enabled is set to true
+ template: amoro-deployment.yaml
+ set:
+ readinessProbe:
+ enabled: true
+ asserts:
+ - exists:
+ path: spec.template.spec.containers[?(@.name ==
"amoro-ams")].readinessProbe
+ - equal:
+ path: spec.template.spec.containers[?(@.name ==
"amoro-ams")].readinessProbe.initialDelaySeconds
+ value: 30
+ - equal:
+ path: spec.template.spec.containers[?(@.name ==
"amoro-ams")].readinessProbe.periodSeconds
+ value: 10
+ - equal:
+ path: spec.template.spec.containers[?(@.name ==
"amoro-ams")].readinessProbe.timeoutSeconds
+ value: 2
+ - equal:
+ path: spec.template.spec.containers[?(@.name ==
"amoro-ams")].readinessProbe.failureThreshold
+ value: 10
+ - equal:
+ path: spec.template.spec.containers[?(@.name ==
"amoro-ams")].readinessProbe.successThreshold
+ value: 1
+ - it: Amoro Deployment should reflect resources
+ template: amoro-deployment.yaml
+ set:
+ resources:
+ requests:
+ cpu: 2
+ memory: 4Gi
+ limits:
+ cpu: 4
+ memory: 10Gi
+ asserts:
+ - equal:
+ path: spec.template.spec.containers[?(@.name ==
"amoro-ams")].resources.requests.cpu
+ value: 2
+ - equal:
+ path: spec.template.spec.containers[?(@.name ==
"amoro-ams")].resources.requests.memory
+ value: 4Gi
+ - equal:
+ path: spec.template.spec.containers[?(@.name ==
"amoro-ams")].resources.limits.cpu
+ value: 4
+ - equal:
+ path: spec.template.spec.containers[?(@.name ==
"amoro-ams")].resources.limits.memory
+ value: 10Gi
+ - it: Amoro Deployment should not reflect nodeSelector if not set
+ template: amoro-deployment.yaml
+ set:
+ nodeSelector:
+ asserts:
+ - notExists:
+ path: spec.template.spec.nodeSelector
+ - it: Amoro Deployment should reflect nodeSelector
+ template: amoro-deployment.yaml
+ set:
+ nodeSelector:
+ disktype: ssd
+ asserts:
+ - exists:
+ path: spec.template.spec.nodeSelector
+ - equal:
+ path: spec.template.spec.nodeSelector
+ value:
+ disktype: ssd
+ - it: Amoro Deployment should not reflect tolerations if not set
+ template: amoro-deployment.yaml
+ set:
+ tolerations:
+ asserts:
+ - notExists:
+ path: spec.template.spec.tolerations
+ - it: Amoro Deployment should reflect tolerations
+ template: amoro-deployment.yaml
+ set:
+ tolerations:
+ - key: "example-key"
+ operator: "Exists"
+ effect: "NoSchedule"
+ asserts:
+ - exists:
+ path: spec.template.spec.tolerations
+ - contains:
+ path: spec.template.spec.tolerations
+ content:
+ key: "example-key"
+ operator: "Exists"
+ effect: "NoSchedule"
+ - it: Amoro Deployment should not reflect affinity if not set
+ template: amoro-deployment.yaml
+ set:
+ affinity:
+ asserts:
+ - notExists:
+ path: spec.template.spec.affinity
+ - it: Amoro Deployment should reflect affinity
+ template: amoro-deployment.yaml
+ set:
+ affinity:
+ nodeAffinity:
+ requiredDuringSchedulingIgnoredDuringExecution:
+ nodeSelectorTerms:
+ - matchExpressions:
+ - key: disktype
+ operator: In
+ values:
+ - ssd
+ asserts:
+ - exists:
+ path: spec.template.spec.affinity
+ - equal:
+ path: spec.template.spec.affinity
+ value:
+ nodeAffinity:
+ requiredDuringSchedulingIgnoredDuringExecution:
+ nodeSelectorTerms:
+ - matchExpressions:
+ - key: disktype
+ operator: In
+ values:
+ - ssd
\ No newline at end of file
diff --git a/charts/amoro/tests/amoro-ingress_test.yaml
b/charts/amoro/tests/amoro-ingress_test.yaml
new file mode 100644
index 000000000..f38b8100e
--- /dev/null
+++ b/charts/amoro/tests/amoro-ingress_test.yaml
@@ -0,0 +1,222 @@
+# 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 Amoro Ingress
+templates:
+ - amoro-ingress.yaml
+chart:
+ appVersion: 0.1.0
+ version: 0.6.0
+tests:
+ - it: Amoro Ingress should not exist if enabled is set to false
+ set:
+ ingress:
+ enabled: false
+ asserts:
+ - hasDocuments:
+ count: 0
+ - it: Amoro Ingress should exist if enabled is set to true
+ set:
+ fullnameOverride: test
+ ingress:
+ enabled: true
+ asserts:
+ - equal:
+ path: metadata.name
+ value: test
+ - hasDocuments:
+ count: 1
+ - it: Amoro Ingress should contain common labels and common annotations if
set
+ set:
+ ingress:
+ enabled: true
+ commonLabels:
+ LABEL: LABEL_V
+ commonAnnotations:
+ ANNOTATION: ANNOTATION_V
+ asserts:
+ - exists:
+ path: metadata.labels
+ - isSubset:
+ path: metadata.labels
+ content:
+ LABEL: LABEL_V
+ - exists:
+ path: metadata.annotations
+ - isSubset:
+ path: metadata.annotations
+ content:
+ ANNOTATION: ANNOTATION_V
+ - it: Amoro Ingress should contain ingress annotations if set
+ set:
+ ingress:
+ enabled: true
+ annotations:
+ ANNOTATION: ANNOTATION_V2
+ asserts:
+ - exists:
+ path: metadata.annotations
+ - isSubset:
+ path: metadata.annotations
+ content:
+ ANNOTATION: ANNOTATION_V2
+ - it: Amoro Ingress should not contain annotations if annotations are not set
+ set:
+ ingress:
+ enabled: true
+ asserts:
+ - notExists:
+ path: metadata.annotations
+ - it: Amoro Ingress should not contain ingress className if not set
+ set:
+ ingress:
+ enabled: true
+ ingressClassName: ""
+ asserts:
+ - notExists:
+ path: spec.ingressClassName
+ - it: Amoro Ingress should contain ingress className if set
+ set:
+ ingress:
+ enabled: true
+ ingressClassName: "nginx"
+ asserts:
+ - exists:
+ path: spec.ingressClassName
+ - equal:
+ path: spec.ingressClassName
+ value: "nginx"
+ - it: Amoro Ingress should not contain ingress hostname if not set
+ set:
+ ingress:
+ enabled: true
+ hostname: ""
+ asserts:
+ - notExists:
+ path: spec.rules.host
+ - notExists:
+ path: spec.rules.http
+ - it: Amoro Ingress should contain ingress hostname and extra Paths if set
+ set:
+ ingress:
+ enabled: true
+ hostname: "localhost"
+ extraPaths:
+ - path: /*
+ backend:
+ serviceName: ssl-redirect
+ servicePort: use-annotation
+ asserts:
+ - contains:
+ path: spec.rules
+ content:
+ host: localhost
+ http:
+ paths:
+ - path: /*
+ backend:
+ serviceName: ssl-redirect
+ servicePort: use-annotation
+ - backend:
+ service:
+ name: RELEASE-NAME-amoro-rest
+ port:
+ name: rest
+ path: /
+ pathType: ImplementationSpecific
+ - it: Amoro Ingress should contain extra Hosts if set
+ set:
+ ingress:
+ enabled: true
+ extraHosts:
+ - name: amoro.local
+ path: /
+ asserts:
+ - contains:
+ path: spec.rules
+ content:
+ host: amoro.local
+ http:
+ paths:
+ - backend:
+ service:
+ name: RELEASE-NAME-amoro-master-svc
+ port:
+ name: http
+ path: /
+ pathType: ImplementationSpecific
+ - it: Amoro Ingress should contain extra Rules if set
+ set:
+ ingress:
+ enabled: true
+ extraRules:
+ - host: foo.bar.com
+ http:
+ paths:
+ - backend:
+ service:
+ name: service1
+ port:
+ number: 80
+ path: /foo
+ pathType: Prefix
+ asserts:
+ - contains:
+ path: spec.rules
+ content:
+ host: foo.bar.com
+ http:
+ paths:
+ - backend:
+ service:
+ name: service1
+ port:
+ number: 80
+ path: /foo
+ pathType: Prefix
+ - it: Amoro Ingress should not contain tls if tls is set to false
+ set:
+ ingress:
+ enabled: true
+ tls: false
+ asserts:
+ - notExists:
+ path: spec.tls
+ - it: Amoro Ingress should contain tls and extra Tls if set
+ set:
+ ingress:
+ enabled: true
+ hostname: "localhost"
+ tls: true
+ selfSigned: true
+ extraTls:
+ - hosts:
+ - amoro.local
+ secretName: amoro.local-tls
+ asserts:
+ - contains:
+ path: spec.tls
+ content:
+ hosts:
+ - amoro.local
+ secretName: amoro.local-tls
+ - contains:
+ path: spec.tls
+ content:
+ hosts:
+ - localhost
+ secretName: localhost-tls
\ No newline at end of file
diff --git a/charts/amoro/tests/amoro-rbac_test.yaml
b/charts/amoro/tests/amoro-rbac_test.yaml
new file mode 100644
index 000000000..0edfcd163
--- /dev/null
+++ b/charts/amoro/tests/amoro-rbac_test.yaml
@@ -0,0 +1,74 @@
+# 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 Amoro RBAC
+templates:
+ - amoro-rbac.yaml
+chart:
+ appVersion: 0.1.0
+ version: 0.6.0
+tests:
+ - it: Amoro rbac documents should not exist if serviceAccount.create is set
to false
+ set:
+ serviceAccount:
+ create: false
+ asserts:
+ - hasDocuments:
+ count: 0
+ - it: Amoro rbac documents should not exist if serviceAccount.rbac.create is
set to false
+ set:
+ serviceAccount:
+ rbac:
+ create: false
+ asserts:
+ - hasDocuments:
+ count: 0
+ - it: Amoro rbac documents should count 2 for default value
+ set:
+ fullnameOverride: test
+ asserts:
+ - hasDocuments:
+ count: 2
+ - containsDocument:
+ kind: Role
+ apiVersion: rbac.authorization.k8s.io/v1
+ name: test
+ documentIndex: 0
+ - containsDocument:
+ kind: RoleBinding
+ apiVersion: rbac.authorization.k8s.io/v1
+ name: test
+ documentIndex: 1
+ - it: Amoro rbac documents should count 2 if serviceAccount.rbac.cluster is
set to true
+ set:
+ fullnameOverride: test
+ serviceAccount:
+ rbac:
+ cluster: true
+ asserts:
+ - hasDocuments:
+ count: 2
+ - containsDocument:
+ kind: ClusterRole
+ apiVersion: rbac.authorization.k8s.io/v1
+ name: test
+ documentIndex: 0
+ - containsDocument:
+ kind: ClusterRoleBinding
+ apiVersion: rbac.authorization.k8s.io/v1
+ name: test
+ documentIndex: 1
\ No newline at end of file
diff --git a/charts/amoro/tests/amoro-service_test.yaml
b/charts/amoro/tests/amoro-service_test.yaml
new file mode 100644
index 000000000..01aebcc1c
--- /dev/null
+++ b/charts/amoro/tests/amoro-service_test.yaml
@@ -0,0 +1,265 @@
+# 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 Amoro Service
+templates:
+ - amoro-service.yaml
+chart:
+ appVersion: 0.1.0
+ version: 0.6.0
+tests:
+ - it: Amoro Service should contain 3 service by default value
+ asserts:
+ - hasDocuments:
+ count: 3
+ - it: Amoro Service should count 2 if rest.enabled is set to false
+ set:
+ server:
+ rest:
+ enabled: false
+ asserts:
+ - hasDocuments:
+ count: 2
+ - it: Amoro Service should count 1 if rest and table.enabled is set to false
+ set:
+ server:
+ rest:
+ enabled: false
+ table:
+ enabled: false
+ asserts:
+ - hasDocuments:
+ count: 1
+ - it: Amoro Service should count 0 if all the services enabled are set to
false
+ set:
+ server:
+ rest:
+ enabled: false
+ table:
+ enabled: false
+ optimizing:
+ enabled: false
+ asserts:
+ - hasDocuments:
+ count: 0
+ - it: Amoro Service for rest should contain service annotations if set
+ set:
+ fullnameOverride: test
+ server:
+ rest:
+ service:
+ annotations:
+ ANNOTATION: ANNOTATION_V2
+ asserts:
+ - exists:
+ path: metadata.annotations
+ documentSelector:
+ path: metadata.name
+ value: test-rest
+ - isSubset:
+ path: metadata.annotations
+ content:
+ ANNOTATION: ANNOTATION_V2
+ documentSelector:
+ path: metadata.name
+ value: test-rest
+ - it: Amoro Service for table should contain service annotations if set
+ set:
+ fullnameOverride: test
+ server:
+ table:
+ service:
+ annotations:
+ ANNOTATION: ANNOTATION_V3
+ asserts:
+ - exists:
+ path: metadata.annotations
+ documentSelector:
+ path: metadata.name
+ value: test-table
+ - isSubset:
+ path: metadata.annotations
+ content:
+ ANNOTATION: ANNOTATION_V3
+ documentSelector:
+ path: metadata.name
+ value: test-table
+ - it: Amoro Service for optimizing should contain service annotations if set
+ set:
+ fullnameOverride: test
+ server:
+ optimizing:
+ service:
+ annotations:
+ ANNOTATION: ANNOTATION_V4
+ asserts:
+ - exists:
+ path: metadata.annotations
+ documentSelector:
+ path: metadata.name
+ value: test-optimizing
+ - isSubset:
+ path: metadata.annotations
+ content:
+ ANNOTATION: ANNOTATION_V4
+ documentSelector:
+ path: metadata.name
+ value: test-optimizing
+ - it: Amoro Service for rest should reflect ports
+ set:
+ fullnameOverride: test
+ server:
+ rest:
+ service:
+ port: "1234"
+ asserts:
+ - equal:
+ path: spec.type
+ value: ClusterIP
+ documentSelector:
+ path: metadata.name
+ value: test-rest
+ - contains:
+ path: spec.ports
+ content:
+ name: rest
+ port: 1234
+ targetPort: 1630
+ documentSelector:
+ path: metadata.name
+ value: test-rest
+ - it: Amoro Service for rest should reflect Node port if type is set to
NodePort
+ set:
+ fullnameOverride: test
+ server:
+ rest:
+ service:
+ type: "NodePort"
+ nodePort: "1234"
+ asserts:
+ - equal:
+ path: spec.type
+ value: NodePort
+ documentSelector:
+ path: metadata.name
+ value: test-rest
+ - contains:
+ path: spec.ports
+ content:
+ name: rest
+ nodePort: 1234
+ port: 1630
+ targetPort: 1630
+ documentSelector:
+ path: metadata.name
+ value: test-rest
+ - it: Amoro Service for table should reflect ports
+ set:
+ fullnameOverride: test
+ server:
+ table:
+ service:
+ port: "1234"
+ asserts:
+ - equal:
+ path: spec.type
+ value: ClusterIP
+ documentSelector:
+ path: metadata.name
+ value: test-table
+ - contains:
+ path: spec.ports
+ content:
+ name: table
+ port: 1234
+ targetPort: 1260
+ documentSelector:
+ path: metadata.name
+ value: test-table
+ - it: Amoro Service for table should reflect Node port if type is set to
NodePort
+ set:
+ fullnameOverride: test
+ server:
+ table:
+ service:
+ type: "NodePort"
+ nodePort: "1234"
+ asserts:
+ - equal:
+ path: spec.type
+ value: NodePort
+ documentSelector:
+ path: metadata.name
+ value: test-table
+ - contains:
+ path: spec.ports
+ content:
+ name: table
+ nodePort: 1234
+ port: 1260
+ targetPort: 1260
+ documentSelector:
+ path: metadata.name
+ value: test-table
+ - it: Amoro Service for optimizing should reflect ports
+ set:
+ fullnameOverride: test
+ server:
+ optimizing:
+ service:
+ port: "1234"
+ asserts:
+ - equal:
+ path: spec.type
+ value: ClusterIP
+ documentSelector:
+ path: metadata.name
+ value: test-optimizing
+ - contains:
+ path: spec.ports
+ content:
+ name: optimizing
+ port: 1234
+ targetPort: 1261
+ documentSelector:
+ path: metadata.name
+ value: test-optimizing
+ - it: Amoro Service for optimizing should reflect Node port if type is set
to NodePort
+ set:
+ fullnameOverride: test
+ server:
+ optimizing:
+ service:
+ type: "NodePort"
+ nodePort: "1234"
+ asserts:
+ - equal:
+ path: spec.type
+ value: NodePort
+ documentSelector:
+ path: metadata.name
+ value: test-optimizing
+ - contains:
+ path: spec.ports
+ content:
+ name: optimizing
+ nodePort: 1234
+ port: 1261
+ targetPort: 1261
+ documentSelector:
+ path: metadata.name
+ value: test-optimizing
\ No newline at end of file
diff --git a/charts/amoro/tests/amoro-serviceaccount_test.yaml
b/charts/amoro/tests/amoro-serviceaccount_test.yaml
new file mode 100644
index 000000000..a846a92f6
--- /dev/null
+++ b/charts/amoro/tests/amoro-serviceaccount_test.yaml
@@ -0,0 +1,64 @@
+# 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 Amoro Service Account
+templates:
+ - amoro-serviceaccount.yaml
+chart:
+ appVersion: 0.1.0
+ version: 0.6.0
+tests:
+ - it: Amoro Service Account should not exist if enabled is set to false
+ set:
+ serviceAccount:
+ create: false
+ asserts:
+ - hasDocuments:
+ count: 0
+ - it: Amoro Service Account should exist if enabled is set to true
+ set:
+ fullnameOverride: test
+ serviceAccount:
+ create: true
+ asserts:
+ - containsDocument:
+ kind: ServiceAccount
+ apiVersion: v1
+ name: test
+ - hasDocuments:
+ count: 1
+ - it: Amoro Service Account should reflect service account name
+ set:
+ serviceAccount:
+ name: test
+ asserts:
+ - equal:
+ path: metadata.name
+ value: test
+ - it: Amoro Service Account should contain service account annotations if set
+ set:
+ serviceAccount:
+ create: true
+ annotations:
+ ANNOTATION: ANNOTATION_V2
+ asserts:
+ - exists:
+ path: metadata.annotations
+ - isSubset:
+ path: metadata.annotations
+ content:
+ ANNOTATION: ANNOTATION_V2
\ No newline at end of file