Grafana: Remove tests that query API
This removes the tests that query the Grafana API for checking whether the prometheus datasource has been provisioned and for checking the number of active dashboards against the number of expected dashboards determined via the chart's values.yaml. The reason for removing these is that Grafana can be configured to use data source types beyond just Prometheus and additional dashboards can be added to Grafana via the Grafana UI. In cases where dashboards are added via the Grafana UI, they are persisted in the grafana database which will cause helm test failures during upgrade scenarios. Now that we have selenium tests executed as part of the Grafana helm tests that validate Grafana is functional, these API tests add little value Change-Id: I9f20ca28e9c840fb3f4fa0707a43c9419fafa2c1 Signed-off-by: Steve Wilkerson <sw5822@att.com>
This commit is contained in:
parent
8edc3b4286
commit
c7290b7ffe
@ -1,50 +0,0 @@
|
||||
#!/bin/bash
|
||||
{{/*
|
||||
Copyright 2017 The Openstack-Helm Authors.
|
||||
|
||||
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.
|
||||
*/}}
|
||||
|
||||
|
||||
set -ex
|
||||
|
||||
function check_datasource () {
|
||||
echo "Verifying prometheus datasource configured"
|
||||
datasource_type=$(curl -K- <<< "--user ${GF_SECURITY_ADMIN_USER}:${GF_SECURITY_ADMIN_PASSWORD}" \
|
||||
"${GRAFANA_ENDPOINT}/api/datasources" \
|
||||
| python -c "import sys, json; print json.load(sys.stdin)[0]['type']")
|
||||
if [ "$datasource_type" == "prometheus" ];
|
||||
then
|
||||
echo "PASS: Prometheus datasource found!";
|
||||
else
|
||||
echo "FAIL: Prometheus datasource not found!";
|
||||
exit 1;
|
||||
fi
|
||||
}
|
||||
|
||||
function check_dashboard_count () {
|
||||
echo "Verifying number of configured dashboards"
|
||||
dashboard_count=$(curl -K- <<< "--user ${GF_SECURITY_ADMIN_USER}:${GF_SECURITY_ADMIN_PASSWORD}" \
|
||||
"${GRAFANA_ENDPOINT}/api/admin/stats" \
|
||||
| python -c "import sys, json; print json.load(sys.stdin)['dashboards']")
|
||||
if [ "$dashboard_count" == "$DASHBOARD_COUNT" ];
|
||||
then
|
||||
echo "PASS: Reported number:$dashboard_count, expected number: $DASHBOARD_COUNT";
|
||||
else
|
||||
echo "FAIL: Reported number:$dashboard_count, expected number: $DASHBOARD_COUNT";
|
||||
exit 1;
|
||||
fi
|
||||
}
|
||||
|
||||
check_datasource
|
||||
check_dashboard_count
|
@ -28,8 +28,6 @@ data:
|
||||
{{ tuple "bin/_db-session-sync.py.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
|
||||
image-repo-sync.sh: |
|
||||
{{- include "helm-toolkit.scripts.image_repo_sync" . | indent 4 }}
|
||||
helm-tests.sh: |
|
||||
{{ tuple "bin/_helm-tests.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
|
||||
grafana.sh: |
|
||||
{{ tuple "bin/_grafana.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
|
||||
selenium-tests.py: |
|
||||
|
@ -39,34 +39,6 @@ spec:
|
||||
initContainers:
|
||||
{{ tuple $envAll "tests" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 4 }}
|
||||
containers:
|
||||
- name: {{.Release.Name}}-helm-tests
|
||||
{{ tuple $envAll "helm_tests" | include "helm-toolkit.snippets.image" | indent 6 }}
|
||||
{{ tuple $envAll $envAll.Values.pod.resources.jobs.tests | include "helm-toolkit.snippets.kubernetes_resources" | indent 6 }}
|
||||
{{ dict "envAll" $envAll "application" "test" "container" "helm_tests" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 6 }}
|
||||
command:
|
||||
- /tmp/helm-tests.sh
|
||||
env:
|
||||
- name: DASHBOARD_COUNT
|
||||
value: {{ $dashboardCount | quote }}
|
||||
- name: GF_SECURITY_ADMIN_USER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: grafana-admin-creds
|
||||
key: GRAFANA_ADMIN_USERNAME
|
||||
- name: GF_SECURITY_ADMIN_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: grafana-admin-creds
|
||||
key: GRAFANA_ADMIN_PASSWORD
|
||||
- name: GRAFANA_ENDPOINT
|
||||
value: {{ tuple "grafana" "internal" "grafana" . | include "helm-toolkit.endpoints.host_and_port_endpoint_uri_lookup" }}
|
||||
volumeMounts:
|
||||
- name: pod-tmp
|
||||
mountPath: /tmp
|
||||
- name: grafana-bin
|
||||
mountPath: /tmp/helm-tests.sh
|
||||
subPath: helm-tests.sh
|
||||
readOnly: true
|
||||
- name: {{.Release.Name}}-selenium-tests
|
||||
{{ tuple $envAll "selenium_tests" | include "helm-toolkit.snippets.image" | indent 6 }}
|
||||
{{ tuple $envAll $envAll.Values.pod.resources.jobs.tests | include "helm-toolkit.snippets.kubernetes_resources" | indent 6 }}
|
||||
|
@ -22,7 +22,6 @@ images:
|
||||
dep_check: quay.io/stackanetes/kubernetes-entrypoint:v0.3.1
|
||||
db_init: docker.io/openstackhelm/heat:newton-ubuntu_xenial
|
||||
grafana_db_session_sync: docker.io/openstackhelm/heat:newton-ubuntu_xenial
|
||||
helm_tests: docker.io/openstackhelm/heat:newton-ubuntu_xenial
|
||||
selenium_tests: docker.io/openstackhelm/osh-selenium:latest-ubuntu_xenial
|
||||
image_repo_sync: docker.io/docker:17.07.0
|
||||
pull_policy: IfNotPresent
|
||||
|
Loading…
Reference in New Issue
Block a user