[stable/kibana] add tests (#12595)

* test stable/kibana

Signed-off-by: Steven Chung <schung@mesosphere.io>

* stable/kibana test revisions due to PR #12200

Signed-off-by: Steven Chung <schung@mesosphere.io>
This commit is contained in:
Steve Chung
2019-04-02 03:18:35 -07:00
committed by Kubernetes Prow Robot
parent 8a6c08fc6d
commit 33defe0a80
5 changed files with 89 additions and 5 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
name: kibana
version: 2.1.0
version: 2.2.0
appVersion: 6.7.0
description: Kibana is an open source data visualization plugin for Elasticsearch
icon: https://raw.githubusercontent.com/elastic/kibana/master/src/ui/public/icons/kibana-color.svg
+3
View File
@@ -112,6 +112,9 @@ The following table lists the configurable parameters of the kibana chart and th
| `extraConfigMapMounts` | Additional configmaps to be mounted | `[]` |
| `deployment.annotations` | Annotations for deployment | `{}` |
| `initContainers` | Init containers to add to the kibana deployment | `{}` |
| `testFramework.image` | `test-framework` image repository. | `dduportal/bats` |
| `testFramework.tag` | `test-framework` image tag. | `0.4.0` |
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
@@ -0,0 +1,35 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "kibana.fullname" . }}-test
labels:
app: {{ template "kibana.fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
heritage: "{{ .Release.Service }}"
release: "{{ .Release.Name }}"
data:
run.sh: |-
@test "Test Status" {
{{- if .Values.service.selector }}
skip "Can't guarentee pod names with selector"
{{- else }}
{{- $port := .Values.service.externalPort }}
url="http://{{ template "kibana.fullname" . }}{{ if $port }}:{{ $port }}{{ end }}/api{{ .Values.livenessProbe.path }}"
# retry for 1 minute
run curl -s -o /dev/null -I -w "%{http_code}" --retry 30 --retry-delay 2 $url
code=$(curl -s -o /dev/null -I -w "%{http_code}" $url)
body=$(curl $url)
if [ "$code" == "503" ]
then
skip "Kibana Unavailable (503), can't get status - see pod logs: $body"
fi
result=$(echo $body | jq -cr '.status.statuses[]')
[ "$result" != "" ]
result=$(echo $body | jq -cr '.status.statuses[] | select(.state != "green")')
[ "$result" == "" ]
{{- end }}
}
+42
View File
@@ -0,0 +1,42 @@
apiVersion: v1
kind: Pod
metadata:
name: {{ template "kibana.fullname" . }}-test
labels:
app: {{ template "kibana.fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
heritage: "{{ .Release.Service }}"
release: "{{ .Release.Name }}"
annotations:
"helm.sh/hook": test-success
spec:
initContainers:
- name: test-framework
image: "{{ .Values.testFramework.image}}:{{ .Values.testFramework.tag }}"
command:
- "bash"
- "-c"
- |
set -ex
# copy bats to tools dir
cp -R /usr/local/libexec/ /tools/bats/
volumeMounts:
- mountPath: /tools
name: tools
containers:
- name: {{ .Release.Name }}-test
image: "dwdraju/alpine-curl-jq"
command: ["/tools/bats/bats", "-t", "/tests/run.sh"]
volumeMounts:
- mountPath: /tests
name: tests
readOnly: true
- mountPath: /tools
name: tools
volumes:
- name: tests
configMap:
name: {{ template "kibana.fullname" . }}-test
- name: tools
emptyDir: {}
restartPolicy: Never
+8 -4
View File
@@ -3,6 +3,10 @@ image:
tag: "6.7.0"
pullPolicy: "IfNotPresent"
testFramework:
image: "dduportal/bats"
tag: "0.4.0"
commandline:
args: []
@@ -17,11 +21,11 @@ env: {}
# SERVER_DEFAULTROUTE: "/app/kibana"
files:
kibana.yml: {}
kibana.yml:
## Default Kibana configuration from kibana-docker.
# server.name: kibana
# server.host: "0"
# elasticsearch.url: http://elasticsearch:9200
server.name: kibana
server.host: "0"
elasticsearch.url: http://elasticsearch:9200
## Custom config properties below
## Ref: https://www.elastic.co/guide/en/kibana/current/settings.html