From d69f021e32e1ba11a0b079bdfb91a361f7efc38e Mon Sep 17 00:00:00 2001 From: Pete Birley Date: Thu, 22 Jun 2017 18:02:25 -0500 Subject: [PATCH] Nova: Helm test functionaility using Rally This PS adds 'helm test' functionality using Rally to Nova Change-Id: Ie53c42636b58e36c22a9260c67a7981183d741d3 Partial-Implements: blueprint implement-helm-test-for-charts External-Tracking-Id: OSH-89 --- nova/templates/configmap-bin.yaml | 2 + nova/templates/configmap-etc.yaml | 2 + nova/templates/etc/_rally_tests.yaml.tpl | 323 +++++++++++++++++++++++ nova/templates/pod-rally-test.yaml | 64 +++++ nova/values.yaml | 14 + tools/gate/basic_launch.sh | 1 + 6 files changed, 406 insertions(+) create mode 100644 nova/templates/etc/_rally_tests.yaml.tpl create mode 100644 nova/templates/pod-rally-test.yaml diff --git a/nova/templates/configmap-bin.yaml b/nova/templates/configmap-bin.yaml index 312da9c130..76188e5c67 100644 --- a/nova/templates/configmap-bin.yaml +++ b/nova/templates/configmap-bin.yaml @@ -17,6 +17,8 @@ kind: ConfigMap metadata: name: nova-bin data: + rally-test.sh: | +{{- include "helm-toolkit.scripts.rally_test" . | indent 4 }} db-init.py: |+ {{- include "helm-toolkit.scripts.db_init" . | indent 4 }} db-sync.sh: |+ diff --git a/nova/templates/configmap-etc.yaml b/nova/templates/configmap-etc.yaml index 283b0ec709..bf7e5b5801 100644 --- a/nova/templates/configmap-etc.yaml +++ b/nova/templates/configmap-etc.yaml @@ -60,6 +60,8 @@ kind: ConfigMap metadata: name: nova-etc data: + rally_tests.yaml: |+ +{{ tuple "etc/_rally_tests.yaml.tpl" . | include "helm-toolkit.utils.template" | indent 4 }} nova.conf: |+ {{ if .Values.conf.nova.override -}} {{ .Values.conf.nova.override | indent 4 }} diff --git a/nova/templates/etc/_rally_tests.yaml.tpl b/nova/templates/etc/_rally_tests.yaml.tpl new file mode 100644 index 0000000000..75a5e34821 --- /dev/null +++ b/nova/templates/etc/_rally_tests.yaml.tpl @@ -0,0 +1,323 @@ +--- +NovaAgents.list_agents: +- runner: + concurrency: 1 + times: 1 + type: constant + sla: + failure_rate: + max: 0 +NovaAggregates.create_and_get_aggregate_details: +- args: + availability_zone: nova + context: + users: + tenants: 1 + users_per_tenant: 1 + runner: + concurrency: 1 + times: 1 + type: constant + sla: + failure_rate: + max: 0 +NovaAggregates.create_and_update_aggregate: +- args: + availability_zone: nova + context: + users: + tenants: 1 + users_per_tenant: 1 + runner: + concurrency: 1 + times: 1 + type: constant + sla: + failure_rate: + max: 0 +NovaAggregates.list_aggregates: +- runner: + concurrency: 1 + times: 1 + type: constant + sla: + failure_rate: + max: 0 +NovaAvailabilityZones.list_availability_zones: +- args: + detailed: true + runner: + concurrency: 1 + times: 1 + type: constant + sla: + failure_rate: + max: 0 +NovaFlavors.create_and_delete_flavor: +- args: + disk: 1 + ram: 500 + vcpus: 1 + context: + users: + tenants: 1 + users_per_tenant: 1 + runner: + concurrency: 1 + times: 1 + type: constant + sla: + failure_rate: + max: 0 +NovaFlavors.create_and_list_flavor_access: +- args: + disk: 1 + ram: 500 + vcpus: 1 + runner: + concurrency: 1 + times: 1 + type: constant + sla: + failure_rate: + max: 0 +NovaFlavors.create_flavor: +- args: + disk: 1 + ram: 500 + vcpus: 1 + runner: + concurrency: 1 + times: 1 + type: constant + sla: + failure_rate: + max: 0 +NovaFlavors.create_flavor_and_add_tenant_access: +- args: + disk: 1 + ram: 500 + vcpus: 1 + context: + users: + tenants: 1 + users_per_tenant: 1 + runner: + concurrency: 1 + times: 1 + type: constant + sla: + failure_rate: + max: 0 +NovaFlavors.create_flavor_and_set_keys: +- args: + disk: 1 + extra_specs: + quota:disk_read_bytes_sec: 10240 + ram: 500 + vcpus: 1 + context: + users: + tenants: 1 + users_per_tenant: 1 + runner: + concurrency: 1 + times: 1 + type: constant + sla: + failure_rate: + max: 0 +NovaFlavors.list_flavors: +- args: + detailed: true + context: + users: + tenants: 1 + users_per_tenant: 1 + runner: + concurrency: 1 + times: 1 + type: constant + sla: + failure_rate: + max: 0 +NovaHosts.list_hosts: +- runner: + concurrency: 1 + times: 1 + type: constant + sla: + failure_rate: + max: 0 +NovaHypervisors.list_and_get_hypervisors: +- args: + detailed: true + context: + users: + tenants: 1 + users_per_tenant: 1 + runner: + concurrency: 1 + times: 1 + type: constant + sla: + failure_rate: + max: 0 +NovaHypervisors.list_and_get_uptime_hypervisors: +- args: + detailed: true + context: + users: + tenants: 1 + users_per_tenant: 1 + runner: + concurrency: 1 + times: 1 + type: constant + sla: + failure_rate: + max: 0 +NovaHypervisors.list_and_search_hypervisors: +- args: + detailed: true + context: + users: + tenants: 1 + users_per_tenant: 1 + runner: + concurrency: 1 + times: 1 + type: constant + sla: + failure_rate: + max: 0 +NovaHypervisors.list_hypervisors: +- args: + detailed: true + runner: + concurrency: 1 + times: 1 + type: constant + sla: + failure_rate: + max: 0 +NovaHypervisors.statistics_hypervisors: +- args: {} + context: + users: + tenants: 1 + users_per_tenant: 1 + runner: + concurrency: 1 + times: 1 + type: constant + sla: + failure_rate: + max: 0 +NovaImages.list_images: +- args: + detailed: true + context: + users: + tenants: 1 + users_per_tenant: 1 + runner: + concurrency: 1 + times: 1 + type: constant + sla: + failure_rate: + max: 0 +NovaKeypair.create_and_delete_keypair: +- context: + users: + tenants: 1 + users_per_tenant: 1 + runner: + concurrency: 1 + times: 1 + type: constant + sla: + failure_rate: + max: 0 +NovaKeypair.create_and_list_keypairs: +- context: + users: + tenants: 1 + users_per_tenant: 1 + runner: + concurrency: 1 + times: 1 + type: constant + sla: + failure_rate: + max: 0 +NovaSecGroup.create_and_delete_secgroups: +- args: + rules_per_security_group: 1 + security_group_count: 1 + context: + users: + tenants: 1 + users_per_tenant: 1 + runner: + concurrency: 1 + times: 1 + type: constant + sla: + failure_rate: + max: 0 +NovaSecGroup.create_and_list_secgroups: +- args: + rules_per_security_group: 1 + security_group_count: 1 + context: + users: + tenants: 1 + users_per_tenant: 1 + runner: + concurrency: 1 + times: 1 + type: constant + sla: + failure_rate: + max: 0 +NovaSecGroup.create_and_update_secgroups: +- args: + security_group_count: 1 + context: + users: + tenants: 1 + users_per_tenant: 1 + runner: + concurrency: 1 + times: 1 + type: constant + sla: + failure_rate: + max: 0 +NovaServerGroups.create_and_list_server_groups: +- args: + all_projects: false + kwargs: + policies: + - affinity + context: + users: + tenants: 1 + users_per_tenant: 1 + runner: + concurrency: 1 + times: 1 + type: constant + sla: + failure_rate: + max: 0 +NovaServices.list_services: +- runner: + concurrency: 1 + times: 1 + type: constant + sla: + failure_rate: + max: 0 diff --git a/nova/templates/pod-rally-test.yaml b/nova/templates/pod-rally-test.yaml new file mode 100644 index 0000000000..ef1a44591e --- /dev/null +++ b/nova/templates/pod-rally-test.yaml @@ -0,0 +1,64 @@ +# 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 := . }} +{{- $ksAdminSecret := .Values.keystone.admin_secret | default "nova-env-keystone-admin" }} +{{- $dependencies := .Values.dependencies.tests }} +{{- $mounts_nova_tests := .Values.mounts.nova_tests.nova_tests }} +{{- $mounts_nova_tests_init := .Values.mounts.nova_tests.init_container }} + +apiVersion: v1 +kind: Pod +metadata: + name: "{{.Release.Name}}-rally-test" + annotations: + "helm.sh/hook": test-success +spec: + restartPolicy: Never + initContainers: +{{ tuple $envAll $dependencies $mounts_nova_tests_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} + containers: + - name: {{.Release.Name}}-token-issue-test + image: {{ .Values.images.test }} + env: +{{- with $env := dict "ksUserSecret" $ksAdminSecret }} +{{- include "helm-toolkit.snippets.keystone_openrc_env_vars" $env | indent 8 }} +{{- end }} + - name: RALLY_ENV_NAME + value: {{.Release.Name}} + command: + - /tmp/rally-test.sh + volumeMounts: + - name: nova-etc + mountPath: /etc/rally/rally_tests.yaml + subPath: rally_tests.yaml + readOnly: true + - name: nova-bin + mountPath: /tmp/rally-test.sh + subPath: rally-test.sh + readOnly: true + - name: rally-db + mountPath: /var/lib/rally +{{ if $mounts_nova_tests.volumeMounts }}{{ toYaml $mounts_nova_tests.volumeMounts | indent 8 }}{{ end }} + volumes: + - name: nova-etc + configMap: + name: nova-etc + - name: nova-bin + configMap: + name: nova-bin + defaultMode: 0555 + - name: rally-db + emptyDir: {} +{{ if $mounts_nova_tests.volumes }}{{ toYaml $mounts_nova_tests.volumes | indent 4 }}{{ end }} diff --git a/nova/values.yaml b/nova/values.yaml index 85ef881466..df1e99ed98 100644 --- a/nova/values.yaml +++ b/nova/values.yaml @@ -52,6 +52,7 @@ labels: node_selector_value: enabled images: + test: docker.io/kolla/ubuntu-binary-rally:4.0.0 db_init: docker.io/kolla/ubuntu-source-nova-api:3.0.3 db_sync: docker.io/kolla/ubuntu-source-nova-api:3.0.3 ks_user: docker.io/kolla/ubuntu-source-kolla-toolbox:3.0.3 @@ -191,6 +192,8 @@ dependencies: services: - service: oslo_messaging endpoint: internal + - service: image + endpoint: internal - service: compute endpoint: internal - service: network @@ -236,6 +239,14 @@ dependencies: endpoint: internal - service: compute endpoint: internal + tests: + service: + - service: image + endpoint: internal + - service: compute + endpoint: internal + - service: network + endpoint: internal mounts: nova_compute: @@ -262,6 +273,9 @@ mounts: nova_bootstrap: init_container: null nova_bootstrap: + nova_tests: + init_container: null + nova_tests: conf: paste: diff --git a/tools/gate/basic_launch.sh b/tools/gate/basic_launch.sh index 4b6e14ff05..810c86ce1e 100755 --- a/tools/gate/basic_launch.sh +++ b/tools/gate/basic_launch.sh @@ -56,3 +56,4 @@ fi helm_test_deployment keystone 600 helm_test_deployment glance 600 helm_test_deployment neutron 600 +helm_test_deployment nova 600