Files
rally-openstack/rally/plugins/openstack/scenarios/mistral/workbooks.py
Alexander Nevenchannyy 6694950b12 Rename rally/benchmark to rally/task
We need to reduce amount of works in our glossary
Rally task commands are based on what is in rally/benchmark
So it will be better to call this directory properly

Change-Id: I7dccdec82c24942517cb2611a8e12218db6118f1
2015-07-01 23:38:48 +03:00

60 lines
2.3 KiB
Python

# Copyright 2015: Mirantis Inc.
# 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.
from rally import consts
from rally.plugins.openstack.scenarios.mistral import utils
from rally.task.scenarios import base
from rally.task import types
from rally.task import validation
class MistralWorkbooks(utils.MistralScenario):
"""Benchmark scenarios for Mistral workbook."""
@validation.required_clients("mistral")
@validation.required_openstack(users=True)
@validation.required_services(consts.Service.MISTRAL)
@base.scenario()
def list_workbooks(self):
"""Scenario test mistral workbook-list command.
This simple scenario tests the Mistral workbook-list
command by listing all the workbooks.
"""
self._list_workbooks()
@types.set(definition=types.FileType)
@validation.file_exists("definition")
@validation.required_parameters("definition")
@validation.required_clients("mistral")
@validation.required_openstack(users=True)
@validation.required_services(consts.Service.MISTRAL)
@base.scenario(context={"cleanup": ["mistral"]})
def create_workbook(self, definition, do_delete=False):
"""Scenario tests workbook creation and deletion.
This scenario is a very useful tool to measure the
"mistral workbook-create" and "mistral workbook-delete"
commands performance.
:param definition: string (yaml string) representation of given
file content (Mistral workbook definition)
:param do_delete: if False than it allows to check performance
in "create only" mode.
"""
wb = self._create_workbook(definition)
if do_delete:
self._delete_workbook(wb.name)