diff --git a/certification/openstack/task.yaml b/certification/openstack/task.yaml new file mode 100644 index 0000000000..5c9022670b --- /dev/null +++ b/certification/openstack/task.yaml @@ -0,0 +1,245 @@ +{%- set image_name = image_name|default("^(cirros.*uec|TestVM)$") %} +{%- set flavor_name = flavor_name|default("m1.tiny") %} +{%- set use_existing_users = use_existing_users|default(false) %} +{%- set service_list = service_list|default(["authentication", "cinder"]) %} +{%- macro user_context(tenants=1,users_per_tenant=1) -%} +{%- if use_existing_users and caller is not defined -%} {} +{%- else %} + {%- if not use_existing_users %} + users: + tenants: {{ tenants }} + users_per_tenant: {{ users_per_tenant }} + {%- endif %} + {%- if caller is defined %} + {{ caller() }} + {%- endif %} +{%- endif %} +{%- endmacro %} +{%- macro vm_params(image=none, flavor=none, size=none) %} +{%- if flavor is not none %} + flavor: + name: {{ flavor }} +{%- endif %} +{%- if image is not none %} + image: + name: {{ image }} +{%- endif %} +{%- if size is not none %} + size: {{ size }} +{%- endif %} +{%- endmacro %} +{%- macro unlimited_volumes() %} + cinder: + gigabytes: -1 + snapshots: -1 + volumes: -1 +{%- endmacro %} +{%- macro runner(type='constant',concurrency=1,times=1) %} + type: {{ type }} + concurrency: {{ concurrency }} + times: {{ times }} +{%- endmacro %} +{%- macro no_failures_sla() %} + failure_rate: + max: 0 +{%- endmacro %} +{%- macro volumes(size=1, volumes_per_tenant=1) %} + volumes: + size: {{ size }} + volumes_per_tenant: {{ volumes_per_tenant }} +{%- endmacro %} +--- +{% if "authentication" in service_list %} + Authenticate.keystone: + - + context: + {{ user_context() }} + runner: + {{ runner() }} + sla: + {{ no_failures_sla() }} +{% endif %} +{% if "cinder" in service_list %} + CinderVolumes.create_and_attach_volume: + - + args: + {{ vm_params(image_name,flavor_name,1) }} + context: + {% call user_context() %} + quotas: + {{ unlimited_volumes() }} + {% endcall %} + runner: + {{ runner() }} + sla: + {{ no_failures_sla() }} + + CinderVolumes.create_and_delete_snapshot: + - + args: + force: false + context: + {% call user_context() %} + quotas: + {{ unlimited_volumes() }} + {{ volumes() }} + {% endcall %} + runner: + {{ runner() }} + sla: + {{ no_failures_sla() }} + + CinderVolumes.create_and_delete_volume: + - + args: + size: + max: 1 + min: 1 + context: + {% call user_context() %} + quotas: + {{ unlimited_volumes() }} + {% endcall %} + runner: + {{ runner() }} + sla: + {{ no_failures_sla() }} + - + args: + {{ vm_params(image_name,none,1) }} + context: + {% call user_context() %} + quotas: + {{ unlimited_volumes() }} + {% endcall %} + runner: + {{ runner() }} + sla: + {{ no_failures_sla() }} + - + args: + size: 1 + context: + {% call user_context() %} + quotas: + {{ unlimited_volumes() }} + {% endcall %} + runner: + {{ runner() }} + sla: + {{ no_failures_sla() }} + + CinderVolumes.create_and_extend_volume: + - + args: + new_size: 2 + size: 1 + context: + {% call user_context() %} + quotas: + {{ unlimited_volumes() }} + {% endcall %} + runner: + {{ runner() }} + sla: + {{ no_failures_sla() }} + + CinderVolumes.create_and_list_snapshots: + - + args: + detailed: true + force: false + context: + {% call user_context() %} + quotas: + {{ unlimited_volumes() }} + {{ volumes() }} + {% endcall %} + runner: + {{ runner() }} + sla: + {{ no_failures_sla() }} + + CinderVolumes.create_and_list_volume: + - + args: + detailed: true + {{ vm_params(image_name,none,1) }} + context: + {% call user_context() %} + quotas: + {{ unlimited_volumes() }} + {% endcall %} + runner: + {{ runner() }} + sla: + {{ no_failures_sla() }} + - + args: + detailed: true + size: 1 + context: + {% call user_context() %} + quotas: + {{ unlimited_volumes() }} + {% endcall %} + runner: + {{ runner() }} + sla: + {{ no_failures_sla() }} + + CinderVolumes.create_and_upload_volume_to_image: + - + args: + container_format: "bare" + disk_format: "raw" + do_delete: true + force: false + size: 1 + context: + {% call user_context() %} + quotas: + {{ unlimited_volumes() }} + {% endcall %} + runner: + {{ runner() }} + sla: + {{ no_failures_sla() }} + + CinderVolumes.create_from_volume_and_delete_volume: + - + args: + size: 1 + context: + {% call user_context() %} + quotas: + {{ unlimited_volumes() }} + {{ volumes() }} + {% endcall %} + runner: + {{ runner() }} + sla: + {{ no_failures_sla() }} + + CinderVolumes.create_nested_snapshots_and_attach_volume: + - + args: + nested_level: + max: 1 + min: 1 + size: + max: 1 + min: 1 + context: + {% call user_context() %} + quotas: + {{ unlimited_volumes() }} + servers: + {{ vm_params(image_name,flavor_name,none)|indent(2,true) }} + servers_per_tenant: 1 + {% endcall %} + runner: + {{ runner() }} + sla: + {{ no_failures_sla() }} +{% endif %} diff --git a/tests/functional/test_certification_task.py b/tests/functional/test_certification_task.py new file mode 100644 index 0000000000..a3036d2a2c --- /dev/null +++ b/tests/functional/test_certification_task.py @@ -0,0 +1,36 @@ +# Copyright 2014: Mirantis Inc. +# Copyright 2014: Catalyst IT Ltd. +# 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. + +import os +import traceback +import unittest + +from tests.functional import utils + + +class TestCertificationTask(unittest.TestCase): + + def test_task_samples_is_valid(self): + rally = utils.Rally() + full_path = os.path.join( + os.path.dirname(__file__), os.pardir, os.pardir, + "certification", "openstack", "task.yaml") + + try: + rally("task validate --task %s" % full_path) + except Exception: + print(traceback.format_exc()) + self.assertTrue(False, "Wrong task config %s" % full_path)