-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TIKA-4232 Create and execute unit tests for tika-helm (#17)
- Loading branch information
Showing
13 changed files
with
314 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,11 +45,39 @@ jobs: | |
if [[ -n "$changed" ]]; then | ||
echo "::set-output name=changed::true" | ||
fi | ||
shell: bash | ||
- name: Run chart-testing (lint) | ||
run: ct lint --target-branch ${{ github.event.repository.default_branch }} --charts . | ||
shell: bash | ||
- name: Create kind cluster | ||
uses: helm/[email protected] | ||
if: steps.list-changed.outputs.changed == 'true' | ||
- name: Uninstall helm-unittest if present | ||
run: | | ||
helm plugin uninstall unittest >/dev/null 2>/dev/null \ | ||
|| echo "Failed to uninstall plugin, assuming it's not present." | ||
shell: bash | ||
- name: Install latest helm-unittest | ||
run: | | ||
echo "Installing latest version of helm-unittest" | ||
helm plugin install https://github.com/helm-unittest/helm-unittest >/dev/null 2>/dev/null | ||
shell: bash | ||
- name: Assemble list of chart directories to test | ||
run: | | ||
tr ' ' '\n' <<< . | grep -v '^$' > charts-to-test || true | ||
find . -type f -name 'Chart.yaml' -exec dirname {} \; > all-charts | ||
[ -z . ] && mv all-charts charts-to-test || true | ||
shell: bash | ||
- name: Fetch chart dependencies | ||
run: | | ||
for chart in $(cat charts-to-test); do | ||
helm dependency update "$chart" >/dev/null | ||
done | ||
shell: bash | ||
- name: Run unit tests | ||
run: helm unittest --color $(cat charts-to-test) | ||
shell: bash | ||
- name: Run chart-testing (install) | ||
if: steps.list-changed.outputs.changed == 'true' | ||
run: ct install --target-branch ${{ github.event.repository.default_branch }} --charts . | ||
if: steps.list-changed.outputs.changed == 'true' | ||
shell: bash |
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 |
---|---|---|
|
@@ -35,8 +35,10 @@ jobs: | |
wget https://github.com/FairwindsOps/pluto/releases/download/v${{ env.PLUTO_VERSION }}/pluto_${{ env.PLUTO_VERSION }}_linux_amd64.tar.gz -O - | tar -xz | ||
mv pluto /usr/local/bin/pluto | ||
chmod +x /usr/local/bin/pluto | ||
shell: bash | ||
- name: Set up Helm | ||
uses: azure/[email protected] | ||
- name: verify helm chart | ||
run: | | ||
helm template . | pluto detect -omarkdown - >> $GITHUB_STEP_SUMMARY | ||
shell: bash |
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 @@ | ||
test-output.xml |
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 |
---|---|---|
|
@@ -21,3 +21,4 @@ | |
.idea/ | ||
*.tmproj | ||
.vscode/ | ||
tests |
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
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
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,62 @@ | ||
# 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 deployment | ||
templates: | ||
- deployment.yaml | ||
tests: | ||
- it: should pass | ||
set: | ||
image.tag: latest | ||
asserts: | ||
- isKind: | ||
of: Deployment | ||
- isAPIVersion: | ||
of: apps/v1 | ||
- matchRegex: | ||
path: metadata.name | ||
pattern: RELEASE-NAME-tika | ||
- equal: | ||
path: spec.template.spec.containers[0].image | ||
value: apache/tika:latest | ||
- lengthEqual: | ||
path: spec.template.spec.containers | ||
count: 1 | ||
- isSubset: | ||
path: spec.template.spec.containers[0] | ||
content: | ||
livenessProbe: | ||
httpGet: | ||
path: / | ||
port: 9998 | ||
scheme: HTTP | ||
initialDelaySeconds: 15 | ||
timeoutSeconds: 30 | ||
failureThreshold: 20 | ||
periodSeconds: 5 | ||
- isSubset: | ||
path: spec.template.spec.containers[0] | ||
content: | ||
readinessProbe: | ||
httpGet: | ||
path: / | ||
port: 9998 | ||
scheme: HTTP | ||
initialDelaySeconds: 15 | ||
timeoutSeconds: 30 | ||
failureThreshold: 20 | ||
periodSeconds: 5 |
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 @@ | ||
# 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 hpa | ||
templates: | ||
- hpa.yaml | ||
tests: | ||
- it: should pass | ||
set: | ||
autoscaling.enabled: true | ||
asserts: | ||
- isKind: | ||
of: HorizontalPodAutoscaler | ||
- isAPIVersion: | ||
of: autoscaling/v2 | ||
- matchRegex: | ||
path: metadata.name | ||
pattern: RELEASE-NAME-tika | ||
- equal: | ||
path: spec.minReplicas | ||
value: 1 | ||
- equal: | ||
path: spec.maxReplicas | ||
value: 100 | ||
- lengthEqual: | ||
path: spec.metrics | ||
count: 2 |
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,40 @@ | ||
# 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 ingress | ||
templates: | ||
- ingress.yaml | ||
tests: | ||
- it: should pass | ||
set: | ||
image.tag: latest | ||
ingress.enabled: true | ||
Capabilities.KubeVersion.GitVersion: 1.20 | ||
ingress.tls: | ||
- secretName: chart-example-tls | ||
hosts: | ||
- chart-example.local | ||
asserts: | ||
- containsDocument: | ||
kind: Ingress | ||
apiVersion: networking.k8s.io/v1 | ||
metadata.name: RELEASE-NAME-tika | ||
- isNotNullOrEmpty: | ||
path: spec.tls | ||
- lengthEqual: | ||
path: spec.rules | ||
count: 1 |
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,38 @@ | ||
# 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 networkpolicy | ||
templates: | ||
- networkpolicy.yaml | ||
tests: | ||
- it: should pass | ||
set: | ||
image.tag: latest | ||
networkPolicy.enabled: true | ||
networkPolicy.allowExternal: false | ||
asserts: | ||
- isKind: | ||
of: NetworkPolicy | ||
- matchRegex: | ||
path: metadata.name | ||
pattern: RELEASE-NAME-tika | ||
- isAPIVersion: | ||
of: networking.k8s.io/v1 | ||
- isNullOrEmpty: | ||
path: spec.egress[0] | ||
- isNotNullOrEmpty: | ||
path: spec.ingress[0].from |
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 @@ | ||
# 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 service | ||
templates: | ||
- service.yaml | ||
tests: | ||
- it: should pass | ||
set: | ||
image.tag: latest | ||
asserts: | ||
- isKind: | ||
of: Service | ||
- matchRegex: | ||
path: metadata.name | ||
pattern: RELEASE-NAME-tika | ||
- isAPIVersion: | ||
of: v1 | ||
- equal: | ||
path: spec.type | ||
value: ClusterIP | ||
- lengthEqual: | ||
path: spec.ports | ||
count: 1 | ||
- equal: | ||
path: spec.ports[0].port | ||
value: 9998 |
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,32 @@ | ||
# 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 serviceaccount | ||
templates: | ||
- serviceaccount.yaml | ||
tests: | ||
- it: should pass | ||
set: | ||
image.tag: latest | ||
asserts: | ||
- isKind: | ||
of: ServiceAccount | ||
- isAPIVersion: | ||
of: v1 | ||
- matchRegex: | ||
path: metadata.name | ||
pattern: RELEASE-NAME-tika |
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