当前位置: 首页>>代码示例>>Python>>正文


Python ChaosMonkey.get_all_groups方法代码示例

本文整理汇总了Python中chaos_monkey.ChaosMonkey.get_all_groups方法的典型用法代码示例。如果您正苦于以下问题:Python ChaosMonkey.get_all_groups方法的具体用法?Python ChaosMonkey.get_all_groups怎么用?Python ChaosMonkey.get_all_groups使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在chaos_monkey.ChaosMonkey的用法示例。


在下文中一共展示了ChaosMonkey.get_all_groups方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: filter_commands

# 需要导入模块: from chaos_monkey import ChaosMonkey [as 别名]
# 或者: from chaos_monkey.ChaosMonkey import get_all_groups [as 别名]
    def filter_commands(self, include_group=None, exclude_group=None,
                        include_command=None, exclude_command=None):
        """Perform command selection and exclusion.

        See random_chaos() for the description of the parameters.
        """
        all_groups = ChaosMonkey.get_all_groups()
        all_commands = ChaosMonkey.get_all_commands()
        self.chaos_monkey.reset_command_selection()

        # If any groups and any commands are not included, assume the intent
        #  is to include all groups and all commands.
        if not include_group and not include_command:
            self.chaos_monkey.include_group('all')
        if include_group:
            include_group = self._validate(include_group, all_groups)
            self.chaos_monkey.include_group(include_group)
        if exclude_group:
            exclude_group = self._validate(exclude_group, all_groups)
            self.chaos_monkey.exclude_group(exclude_group)
        if include_command:
            include_command = self._validate(
                include_command, all_commands)
            self.chaos_monkey.include_command(include_command)
        if exclude_command:
            exclude_command = self._validate(
                exclude_command, all_commands)
            self.chaos_monkey.exclude_command(exclude_command)
开发者ID:FoldingSkyCorporation,项目名称:chaos-monkey,代码行数:30,代码来源:runner.py

示例2: test_list_all_commands

# 需要导入模块: from chaos_monkey import ChaosMonkey [as 别名]
# 或者: from chaos_monkey.ChaosMonkey import get_all_groups [as 别名]
 def test_list_all_commands(self):
     cmd = Runner.list_all_commands()
     self.assertItemsEqual(cmd.keys(), ChaosMonkey.get_all_groups())
     all_commands = []
     for commands in cmd.values():
         for command in commands:
             all_commands.extend(command)
     self._assert_from_list(ChaosMonkey.get_all_commands(), all_commands)
开发者ID:FoldingSkyCorporation,项目名称:chaos-monkey,代码行数:10,代码来源:test_runner.py

示例3: list_all_commands

# 需要导入模块: from chaos_monkey import ChaosMonkey [as 别名]
# 或者: from chaos_monkey.ChaosMonkey import get_all_groups [as 别名]
 def list_all_commands():
     """List all available commands."""
     all_chaos, _ = ChaosMonkey.get_all_chaos()
     all_groups = ChaosMonkey.get_all_groups()
     commands = {}
     for group in all_groups:
         commands[group] = [[c.command_str, c.description]
                            for c in all_chaos if c.group == group]
     return commands
开发者ID:FoldingSkyCorporation,项目名称:chaos-monkey,代码行数:11,代码来源:runner.py

示例4: test_get_all_groups

# 需要导入模块: from chaos_monkey import ChaosMonkey [as 别名]
# 或者: from chaos_monkey.ChaosMonkey import get_all_groups [as 别名]
 def test_get_all_groups(self):
     all_groups = ChaosMonkey.get_all_groups()
     self.assertItemsEqual(all_groups, self._get_all_groups())
开发者ID:FoldingSkyCorporation,项目名称:chaos-monkey,代码行数:5,代码来源:test_chaos_monkey.py

示例5: test_display_all_commands

# 需要导入模块: from chaos_monkey import ChaosMonkey [as 别名]
# 或者: from chaos_monkey.ChaosMonkey import get_all_groups [as 别名]
 def test_display_all_commands(self):
     cmd = display_all_commands()
     self._assert_from_list(ChaosMonkey.get_all_groups(), cmd)
     self._assert_from_list(ChaosMonkey.get_all_commands(), cmd)
开发者ID:FoldingSkyCorporation,项目名称:chaos-monkey,代码行数:6,代码来源:test_runner.py

示例6: test_validate_incorrect_group

# 需要导入模块: from chaos_monkey import ChaosMonkey [as 别名]
# 或者: from chaos_monkey.ChaosMonkey import get_all_groups [as 别名]
 def test_validate_incorrect_group(self):
     groups = "net,killl"
     all_groups = ChaosMonkey.get_all_groups()
     with self.assertRaisesRegexp(
             BadRequest,  "Invalid value given on command line: killl"):
         Runner._validate(groups, all_groups)
开发者ID:FoldingSkyCorporation,项目名称:chaos-monkey,代码行数:8,代码来源:test_runner.py

示例7: test_validate_groups

# 需要导入模块: from chaos_monkey import ChaosMonkey [as 别名]
# 或者: from chaos_monkey.ChaosMonkey import get_all_groups [as 别名]
 def test_validate_groups(self):
     groups = "net,{}".format(Kill.group)
     all_groups = ChaosMonkey.get_all_groups()
     groups = Runner._validate(groups, all_groups)
     self.assertItemsEqual(groups, ['net', Kill.group])
开发者ID:FoldingSkyCorporation,项目名称:chaos-monkey,代码行数:7,代码来源:test_runner.py

示例8: test_validate_group

# 需要导入模块: from chaos_monkey import ChaosMonkey [as 别名]
# 或者: from chaos_monkey.ChaosMonkey import get_all_groups [as 别名]
 def test_validate_group(self):
     groups = "net"
     all_groups = ChaosMonkey.get_all_groups()
     groups = Runner._validate(groups, all_groups)
     self.assertItemsEqual(groups, ['net'])
开发者ID:FoldingSkyCorporation,项目名称:chaos-monkey,代码行数:7,代码来源:test_runner.py


注:本文中的chaos_monkey.ChaosMonkey.get_all_groups方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。