rally-openstack/rally-jobs/plugins/fake_plugin.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

46 lines
1.3 KiB
Python

# Copyright 2014: 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.
import random
import time
from rally.task.scenarios import base
# This is used to test relative import
from test_relative_import import zzz
class FakePlugin(base.Scenario):
"""Fake plugin with a scenario."""
@base.atomic_action_timer("test1")
def _test1(self, factor):
time.sleep(random.random() * 0.1)
@base.atomic_action_timer("test2")
def _test2(self, factor):
time.sleep(random.random() * factor)
@base.scenario()
def testplugin(self, factor=1):
"""Fake scenario.
:param factor: influences the argument value for a time.sleep() call
"""
zzz.some_very_important_function()
self._test1(factor)
self._test2(factor)