forked from eclipse-tractusx/managed-identity-wallet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(test): add Helm unittests for default values
- Loading branch information
Showing
5 changed files
with
198 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
97 changes: 97 additions & 0 deletions
97
charts/managed-identity-wallet/tests/default_deployment_test.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
# /******************************************************************************** | ||
# * Copyright (c) 2021,2023 Contributors to the Eclipse Foundation | ||
# * | ||
# * See the NOTICE file(s) distributed with this work for additional | ||
# * information regarding copyright ownership. | ||
# * | ||
# * This program and the accompanying materials are made available under the | ||
# * terms of the Apache License, Version 2.0 which is available at | ||
# * https://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. | ||
# * | ||
# * SPDX-License-Identifier: Apache-2.0 | ||
# ********************************************************************************/ | ||
|
||
suite: test default deployment | ||
chart: | ||
version: 9.9.9+test | ||
appVersion: 9.9.9 | ||
tests: | ||
- it: should have correct metadata | ||
template: templates/deployment.yaml | ||
asserts: | ||
- hasDocuments: | ||
count: 1 | ||
- containsDocument: | ||
kind: Deployment | ||
apiVersion: apps/v1 | ||
name: RELEASE-NAME-managed-identity-wallet | ||
- isSubset: | ||
path: metadata.labels | ||
content: | ||
helm.sh/chart: managed-identity-wallet-9.9.9_test | ||
app.kubernetes.io/name: managed-identity-wallet | ||
app.kubernetes.io/instance: RELEASE-NAME | ||
app.kubernetes.io/version: "9.9.9" | ||
app.kubernetes.io/managed-by: Helm | ||
|
||
- it: must have important values set | ||
template: templates/deployment.yaml | ||
asserts: | ||
- equal: | ||
path: spec.replicas | ||
value: 1 | ||
- lengthEqual: | ||
path: spec.template.spec.containers | ||
count: 1 | ||
- isNotEmpty: | ||
path: spec.template.spec.serviceAccountName | ||
- contains: | ||
path: spec.template.spec.containers[0].ports | ||
content: | ||
name: http | ||
containerPort: 8080 | ||
protocol: TCP | ||
|
||
- it: must have probes set | ||
template: templates/deployment.yaml | ||
asserts: | ||
- isNotEmpty: | ||
path: spec.template.spec.containers[0].livenessProbe | ||
- isNotEmpty: | ||
path: spec.template.spec.containers[0].readinessProbe | ||
|
||
- it: must have resource limits set | ||
template: templates/deployment.yaml | ||
asserts: | ||
- isNotEmpty: | ||
path: spec.template.spec.containers[0].resources | ||
- isNotEmpty: | ||
path: spec.template.spec.containers[0].resources.limits | ||
- isNotEmpty: | ||
path: spec.template.spec.containers[0].resources.limits.cpu | ||
- isNotEmpty: | ||
path: spec.template.spec.containers[0].resources.limits.memory | ||
- isNotEmpty: | ||
path: spec.template.spec.containers[0].resources.requests | ||
- isNotEmpty: | ||
path: spec.template.spec.containers[0].resources.requests.cpu | ||
- isNotEmpty: | ||
path: spec.template.spec.containers[0].resources.requests.memory | ||
|
||
- it: must have a security context | ||
template: templates/deployment.yaml | ||
asserts: | ||
- isSubset: | ||
path: spec.template.spec.containers[0].securityContext | ||
content: | ||
allowPrivilegeEscalation: false | ||
privileged: false | ||
runAsGroup: 11111 | ||
runAsNonRoot: true | ||
runAsUser: 11111 |
41 changes: 41 additions & 0 deletions
41
charts/managed-identity-wallet/tests/default_service_account_test.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# /******************************************************************************** | ||
# * Copyright (c) 2021,2023 Contributors to the Eclipse Foundation | ||
# * | ||
# * See the NOTICE file(s) distributed with this work for additional | ||
# * information regarding copyright ownership. | ||
# * | ||
# * This program and the accompanying materials are made available under the | ||
# * terms of the Apache License, Version 2.0 which is available at | ||
# * https://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. | ||
# * | ||
# * SPDX-License-Identifier: Apache-2.0 | ||
# ********************************************************************************/ | ||
|
||
suite: test default serviceaccount | ||
chart: | ||
version: 9.9.9+test | ||
appVersion: 9.9.9 | ||
tests: | ||
- it: should have correct metadata | ||
template: templates/serviceaccount.yaml | ||
asserts: | ||
- hasDocuments: | ||
count: 1 | ||
- containsDocument: | ||
kind: ServiceAccount | ||
apiVersion: v1 | ||
name: RELEASE-NAME-managed-identity-wallet | ||
- isSubset: | ||
path: metadata.labels | ||
content: | ||
helm.sh/chart: managed-identity-wallet-9.9.9_test | ||
app.kubernetes.io/name: managed-identity-wallet | ||
app.kubernetes.io/instance: RELEASE-NAME | ||
app.kubernetes.io/version: "9.9.9" | ||
app.kubernetes.io/managed-by: Helm |
59 changes: 59 additions & 0 deletions
59
charts/managed-identity-wallet/tests/default_service_test.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# /******************************************************************************** | ||
# * Copyright (c) 2021,2023 Contributors to the Eclipse Foundation | ||
# * | ||
# * See the NOTICE file(s) distributed with this work for additional | ||
# * information regarding copyright ownership. | ||
# * | ||
# * This program and the accompanying materials are made available under the | ||
# * terms of the Apache License, Version 2.0 which is available at | ||
# * https://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. | ||
# * | ||
# * SPDX-License-Identifier: Apache-2.0 | ||
# ********************************************************************************/ | ||
|
||
suite: test default service | ||
chart: | ||
version: 9.9.9+test | ||
appVersion: 9.9.9 | ||
tests: | ||
- it: should have correct metadata | ||
template: templates/service.yaml | ||
asserts: | ||
- hasDocuments: | ||
count: 1 | ||
- containsDocument: | ||
kind: Service | ||
apiVersion: v1 | ||
name: RELEASE-NAME-managed-identity-wallet | ||
- isSubset: | ||
path: metadata.labels | ||
content: | ||
helm.sh/chart: managed-identity-wallet-9.9.9_test | ||
app.kubernetes.io/name: managed-identity-wallet | ||
app.kubernetes.io/instance: RELEASE-NAME | ||
app.kubernetes.io/version: "9.9.9" | ||
app.kubernetes.io/managed-by: Helm | ||
|
||
- it: must have type set to ClusterIP | ||
template: templates/service.yaml | ||
asserts: | ||
- equal: | ||
path: spec.type | ||
value: ClusterIP | ||
|
||
- it: must have ports set | ||
template: templates/service.yaml | ||
asserts: | ||
- contains: | ||
path: spec.ports | ||
content: | ||
name: http | ||
targetPort: http | ||
port: 8080 | ||
protocol: TCP |
14 changes: 0 additions & 14 deletions
14
charts/managed-identity-wallet/tests/deployment_default_test.yaml
This file was deleted.
Oops, something went wrong.