Add barbican helm test

This patch set adds basic barbican test using the OpenStack Client.  This
patch set also addressed an issue where the href contains a duplicate
version in the path, e.g. http://URL:xxxx/v1/v1/secrets in secret path.

Change-Id: Ie66d00d5a0b02721ba41e6bf4b5e784fb49adce8
This commit is contained in:
Tin Lam 2017-08-07 01:26:28 -05:00
parent a95845062f
commit 8e76f32407
7 changed files with 105 additions and 3 deletions

View File

@ -0,0 +1,37 @@
#!/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
openstack secret list
# Come up with a random payload
PAYLOAD=`cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1`
echo $PAYLOAD
SECRET=`openstack secret store --name mysecret --payload ${PAYLOAD} | awk ' /href/ {print $5}'`
openstack secret list
openstack secret get $SECRET
openstack secret get --payload $SECRET
openstack secret delete $SECRET
openstack secret list

View File

@ -26,6 +26,8 @@ data:
bootstrap.sh: |+
{{ tuple "bin/_bootstrap.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
{{- end }}
barbican-test.sh: |
{{ tuple "bin/_barbican-test.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
db-init.py: |
{{- include "helm-toolkit.scripts.db_init" . | indent 4 }}
db-sync.sh: |

View File

@ -58,8 +58,9 @@ limitations under the License.
{{- tuple "oslo_messaging" "internal" "user" "amqp" . | include "helm-toolkit.endpoints.authenticated_endpoint_uri_lookup" | set .Values.conf.barbican.default.oslo.messaging "transport_url" | quote | trunc 0 -}}
{{- end -}}
{{- $barbicanPath := index .Values "endpoints" "key-manager" "path" "default" }}
{{- if empty .Values.conf.barbican.default.barbican.common.config.host_href -}}
{{- tuple "key-manager" "public" "api" . | include "helm-toolkit.endpoints.keystone_endpoint_uri_lookup" | set .Values.conf.barbican.default.barbican.common.config "host_href" | quote | trunc 0 -}}
{{- tuple "key-manager" "public" "api" . | include "helm-toolkit.endpoints.keystone_endpoint_uri_lookup" | trimSuffix $barbicanPath | set .Values.conf.barbican.default.barbican.common.config "host_href" | quote | trunc 0 -}}
{{- end -}}
---

View File

@ -0,0 +1,52 @@
{{/*
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.
*/}}
{{- $envAll := . }}
{{- $dependencies := .Values.dependencies.tests }}
{{- $mounts_barbican_tests := .Values.pod.mounts.barbican_tests.barbican_tests }}
{{- $mounts_barbican_tests_init := .Values.pod.mounts.barbican_tests.init_container }}
---
apiVersion: v1
kind: Pod
metadata:
name: "{{.Release.Name}}-test"
annotations:
"helm.sh/hook": test-success
spec:
restartPolicy: Never
initContainers:
{{ tuple $envAll $dependencies $mounts_barbican_tests_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
containers:
- name: {{.Release.Name}}-barbican-test
image: {{ .Values.images.test }}
env:
{{- with $env := dict "ksUserSecret" .Values.secrets.identity.admin }}
{{- include "helm-toolkit.snippets.keystone_openrc_env_vars" $env | indent 8 }}
{{- end }}
command:
- /tmp/barbican-test.sh
volumeMounts:
- name: barbican-bin
mountPath: /tmp/barbican-test.sh
subPath: barbican-test.sh
readOnly: true
{{- if $mounts_barbican_tests.volumeMounts }}{{ toYaml $mounts_barbican_tests.volumeMounts | indent 8 }}{{ end }}
volumes:
- name: barbican-bin
configMap:
name: barbican-bin
defaultMode: 0555
{{- if $mounts_barbican_tests.volumes }}{{ toYaml $mounts_barbican_tests.volumes | indent 4 }}{{ end }}

View File

@ -19,6 +19,7 @@ release_group: null
images:
bootstrap: docker.io/kolla/ubuntu-source-barbican-api:3.0.3
dep_check: docker.io/kolla/ubuntu-source-kubernetes-entrypoint:4.0.0
test: docker.io/kolla/ubuntu-source-barbican-api:3.0.3
db_init: docker.io/kolla/ubuntu-source-barbican-api:3.0.3
db_sync: docker.io/kolla/ubuntu-source-barbican-api:3.0.3
ks_user: docker.io/kolla/ubuntu-source-kolla-toolbox:3.0.3
@ -41,6 +42,9 @@ pod:
barbican_bootstrap:
init_container: null
barbican_bootstrap:
barbican_tests:
init_container: null
barbican_tests:
replicas:
api: 1
lifecycle:

View File

@ -126,4 +126,5 @@ if [ "x$INTEGRATION" == "xmulti" ]; then
helm_test_deployment cinder ${SERVICE_TEST_TIMEOUT}
helm_test_deployment neutron ${SERVICE_TEST_TIMEOUT}
helm_test_deployment nova ${SERVICE_TEST_TIMEOUT}
helm_test_deployment barbican ${SERVICE_TEST_TIMEOUT} norally
fi

View File

@ -84,13 +84,18 @@ function helm_test_deployment {
TIMEOUT=$2
fi
NAME="${DEPLOYMENT}-rally-test"
if [ "$#" -gt 2 ]; then
NAME="${DEPLOYMENT}-test"
fi
# Get the namespace of the chart via the Helm release
NAMESPACE=$(helm status ${DEPLOYMENT} | awk '/^NAMESPACE/ { print $NF }')
helm test --timeout ${TIMEOUT} ${DEPLOYMENT}
mkdir -p ${LOGS_DIR}/rally
kubectl logs -n ${NAMESPACE} ${DEPLOYMENT}-rally-test > ${LOGS_DIR}/rally/${DEPLOYMENT}
kubectl delete -n ${NAMESPACE} pod ${DEPLOYMENT}-rally-test
kubectl logs -n ${NAMESPACE} ${NAME} > ${LOGS_DIR}/rally/${DEPLOYMENT}
kubectl delete -n ${NAMESPACE} pod ${NAME}
}
function helm_plugin_template_install {