[383710] Add helm test to Shipyard

Also covers [383892] Add helm test to Airflow
Provides basic tests to run as helm test during deployment
of Shipyard/Airflow.

Change-Id: Icc4012f38b6162adf175702dd7f50de46dbfbe47
This commit is contained in:
Bryan Strassner 2018-03-05 20:40:03 -06:00 committed by Scott Hussey
parent 0a7d0d36c9
commit 9edcc7bc20
3 changed files with 94 additions and 0 deletions

View File

@ -0,0 +1,38 @@
{{/*
# Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
#
# 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. */}}
{{/*
Test Airflow for api functionality.
*/}}
{{- if .Values.manifests.test_airflow_api }}
---
apiVersion: v1
kind: Pod
metadata:
name: "{{ .Release.Name }}-airflow-api-test"
annotations:
"helm.sh/hook": "test-success"
spec:
restartPolicy: Never
containers:
- name: "{{ .Release.Name }}-airflow-api-test"
env:
- name: 'AIRFLOW_URL'
value: {{ tuple "airflow_web" "internal" "airflow_web" . | include "helm-toolkit.endpoints.host_and_port_endpoint_uri_lookup" | quote }}
image: {{ .Values.images.tags.airflow }}
imagePullPolicy: {{ .Values.images.pull_policy }}
{{ tuple . .Values.pod.resources.test.airflow | include "helm-toolkit.snippets.kubernetes_resources" | indent 8 }}
command: ["/bin/bash", "-c", "curl -v -X GET --fail ${AIRFLOW_URL}/admin/rest_api/api?api=version; exit $?"]
...
{{- end }}

View File

@ -0,0 +1,38 @@
{{/*
# Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
#
# 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. */}}
{{/*
Test the Shipyard API, to ensure that the health endpoint is active and able to respond.
*/}}
{{- if .Values.manifests.test_shipyard_api }}
---
apiVersion: v1
kind: Pod
metadata:
name: "{{ .Release.Name }}-shipyard-api-test"
annotations:
"helm.sh/hook": "test-success"
spec:
restartPolicy: Never
containers:
- name: "{{ .Release.Name }}-shipyard-api-test"
env:
- name: 'SHIPYARD_URL'
value: {{ tuple "shipyard" "internal" "api" . | include "helm-toolkit.endpoints.host_and_port_endpoint_uri_lookup" | quote }}
image: {{ .Values.images.tags.shipyard }}
imagePullPolicy: {{ .Values.images.pull_policy }}
{{ tuple . .Values.pod.resources.test.shipyard | include "helm-toolkit.snippets.kubernetes_resources" | indent 8 }}
command: ["/bin/bash", "-c", "curl -v -X GET --fail ${SHIPYARD_URL}/api/v1.0/health; exit $?"]
...
{{- end }}

View File

@ -641,6 +641,22 @@ pod:
requests:
memory: "128Mi"
cpu: "500m"
test:
shipyard:
limits:
memory: "128Mi"
cpu: "100m"
requests:
memory: "128Mi"
cpu: "100m"
airflow:
limits:
memory: "128Mi"
cpu: "100m"
requests:
memory: "128Mi"
cpu: "100m"
manifests:
configmap_shipyard_bin: true
configmap_shipyard_etc: true
@ -670,3 +686,5 @@ manifests:
service_airflow_web: true
service_airflow_worker: true
service_discovery_airflow_worker: true
test_shipyard_api: true
test_airflow_api: true