Esempio n. 1
0
    def _run_scenario(self, cls, method_name, context, args):
        """Runs the specified scenario with given arguments.

        The scenario iterations are executed one-by-one in the same python
        interpreter process as Rally. This allows you to execute
        scenario without introducing any concurrent operations as well as
        interactively debug the scenario from the same command that you use
        to start Rally.

        :param cls: The Scenario class where the scenario is implemented
        :param method_name: Name of the method that implements the scenario
        :param context: context that contains users, admin & other
                        information, that was created before scenario
                        execution starts.
        :param args: Arguments to call the scenario method with

        :returns: List of results fore each single scenario iteration,
                  where each result is a dictionary
        """
        times = self.config.get("times", 1)

        event_queue = rutils.DequeAsQueue(self.event_queue)

        for i in range(times):
            if self.aborted.is_set():
                break
            result = runner._run_scenario_once(
                cls, method_name, runner._get_scenario_context(i, context),
                args, event_queue)
            self._send_result(result)

        self._flush_results()
Esempio n. 2
0
 def setUp(self):
     super(DequeAsQueueTestCase, self).setUp()
     self.deque = collections.deque()
     self.deque_as_queue = utils.DequeAsQueue(self.deque)