Exemple #1
0
    def test_director_all_successful(self, mock_checer, mock_opertion,
                                     mock_attacker, mock_monitor):
        ins = Director(self.scenario_cfg, self.ctx)
        opertion_action = ins.createActionPlayer("operation", "service-status")
        attacker_action = ins.createActionPlayer("attacker", "kill-process")
        checker_action = ins.createActionPlayer("resultchecker",
                                                "process-checker")
        monitor_action = ins.createActionPlayer("monitor", "service-status")

        opertion_rollback = ins.createActionRollbacker("operation",
                                                       "service-status")
        attacker_rollback = ins.createActionRollbacker("attacker",
                                                       "kill-process")
        ins.executionSteps.append(opertion_rollback)
        ins.executionSteps.append(attacker_rollback)

        opertion_action.action()
        attacker_action.action()
        checker_action.action()
        monitor_action.action()

        attacker_rollback.rollback()
        opertion_rollback.rollback()

        ins.stopMonitors()
        ins.verify()
        ins.knockoff()
Exemple #2
0
 def setup(self):
     self.director = Director(self.scenario_cfg, self.context_cfg)
Exemple #3
0
 def test_director_get_wrong_item(self, mock_checer, mock_opertion,
                                  mock_attacker, mock_monitor):
     ins = Director(self.scenario_cfg, self.ctx)
     ins.createActionPlayer("wrong_type", "wrong_key")
     ins.createActionRollbacker("wrong_type", "wrong_key")