rally-openstack/rally-jobs/plugins/fake_plugin.py
Boris Pavlovic 63618c81a5 Remove old way to describe scenario plugin via method
Initally Rally scenario plugins were methods of speical class.
However to unify scenarios with other plugins we moved to model
where plugin is class.

We have a bunch of code that was used for transition and backward
compatiblity that we can finally remove.

Change-Id: Ia6841068eb1d5a39a8f64f160160f1fcc1e05ac5
2017-07-07 08:30:30 -07:00

47 lines
1.4 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 import atomic
from rally.task import scenario
# This is used to test relative import
from test_relative_import import zzz
@scenario.configure(name="FakePlugin.testplugin")
class FakePlugin(scenario.Scenario):
"""Fake plugin with a scenario."""
@atomic.action_timer("test1")
def _test1(self, factor):
time.sleep(random.random() * 0.1)
@atomic.action_timer("test2")
def _test2(self, factor):
time.sleep(random.random() * factor)
def run(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)