Esempio n. 1
0
    def __init__(self, scenario_cfg, context_cfg):

        # A stack store Rollbacker that will be called after
        # all actionplayers finish.
        self.executionSteps = []
        self.data = {}

        self.scenario_cfg = scenario_cfg
        self.context_cfg = context_cfg
        nodes = self.context_cfg.get("nodes", None)
        # setup attackers
        if "attackers" in self.scenario_cfg["options"]:
            LOG.debug("start init attackers...")
            attacker_cfgs = self.scenario_cfg["options"]["attackers"]
            self.attackerMgr = baseattacker.AttackerMgr()
            self.data = self.attackerMgr.init_attackers(attacker_cfgs, nodes)

        # setup monitors
        if "monitors" in self.scenario_cfg["options"]:
            LOG.debug("start init monitors...")
            monitor_cfgs = self.scenario_cfg["options"]["monitors"]
            self.monitorMgr = basemonitor.MonitorMgr(self.data)
            self.monitorMgr.init_monitors(monitor_cfgs, nodes)
        # setup operations
        if "operations" in self.scenario_cfg["options"]:
            LOG.debug("start init operations...")
            operation_cfgs = self.scenario_cfg["options"]["operations"]
            self.operationMgr = baseoperation.OperationMgr()
            self.operationMgr.init_operations(operation_cfgs, nodes)
        # setup result checker
        if "resultCheckers" in self.scenario_cfg["options"]:
            LOG.debug("start init resultCheckers...")
            result_check_cfgs = self.scenario_cfg["options"]["resultCheckers"]
            self.resultCheckerMgr = baseresultchecker.ResultCheckerMgr()
            self.resultCheckerMgr.init_ResultChecker(result_check_cfgs, nodes)
Esempio n. 2
0
 def test_getitem_fail(self, mock_operation):
     mgr_ins = baseoperation.OperationMgr()
     mgr_ins.init_operations(self.operation_configs, None)
     with self.assertRaises(KeyError):
         operation_ins = mgr_ins["operation-not-exist"]
Esempio n. 3
0
 def test_all_successful(self, mock_operation):
     mgr_ins = baseoperation.OperationMgr()
     mgr_ins.init_operations(self.operation_configs, None)
     operation_ins = mgr_ins["service-status"]
     mgr_ins.rollback()