Skip to content

Commit

Permalink
feat(helm): add tests for dev stage and put tests in subfolder for ea…
Browse files Browse the repository at this point in the history
…ch stage
  • Loading branch information
pmoscode committed Jul 4, 2023
1 parent 3e17880 commit ecbe7e5
Show file tree
Hide file tree
Showing 6 changed files with 173 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,13 @@ tests:
privileged: false
runAsGroup: 11111
runAsNonRoot: true
runAsUser: 11111
runAsUser: 11111

- it: should have environment variables set
template: templates/deployment.yaml
asserts:
- isNotEmpty:
path: spec.template.spec.containers[0].env
- lengthEqual:
path: spec.template.spec.containers[0].env
count: 1
34 changes: 34 additions & 0 deletions charts/managed-identity-wallet/tests/dev/deployment_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# /********************************************************************************
# * 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 dev deployment
chart:
version: 9.9.9+test
appVersion: 9.9.9
values:
- ../../values-dev.yaml
tests:
- it: should have environment variables set
template: templates/deployment.yaml
asserts:
- isNotEmpty:
path: spec.template.spec.containers[0].env
- lengthEqual:
path: spec.template.spec.containers[0].env
count: 11
73 changes: 73 additions & 0 deletions charts/managed-identity-wallet/tests/dev/ingress_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# /********************************************************************************
# * 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 dev ingress
chart:
version: 9.9.9+test
appVersion: 9.9.9
values:
- ../../values-dev.yaml
tests:
- it: should have correct metadata
template: templates/ingress.yaml
asserts:
- hasDocuments:
count: 1
- containsDocument:
kind: Ingress
apiVersion: networking.k8s.io/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 rules set
template: templates/ingress.yaml
asserts:
- isNotEmpty:
path: spec.rules
- lengthEqual:
path: spec.rules
count: 1
- isNotEmpty:
path: spec.rules[0].host
- lengthEqual:
path: spec.rules[0].http.paths
count: 1
- isNotEmpty:
path: spec.rules[0].http.paths[0].path

- it: must have tls set
template: templates/ingress.yaml
asserts:
- isNotEmpty:
path: spec.tls
- lengthEqual:
path: spec.tls
count: 1
- isNotEmpty:
path: spec.tls[0].hosts
- lengthEqual:
path: spec.tls[0].hosts[0]
count: 1
56 changes: 56 additions & 0 deletions charts/managed-identity-wallet/tests/dev/secret_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# /********************************************************************************
# * 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 dev secret
chart:
version: 9.9.9+test
appVersion: 9.9.9
values:
- ../../values-dev.yaml
tests:
- it: should have correct metadata
template: templates/secret.yaml
asserts:
- hasDocuments:
count: 1
- containsDocument:
kind: Secret
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 Opaque
template: templates/secret.yaml
asserts:
- equal:
path: type
value: Opaque

- it: must have data set
template: templates/secret.yaml
asserts:
- isNotEmpty:
path: data

0 comments on commit ecbe7e5

Please sign in to comment.