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


Python ChaosMonkey.factory方法代码示例

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


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

示例1: test_random_enablement_zero

# 需要导入模块: from chaos_monkey import ChaosMonkey [as 别名]
# 或者: from chaos_monkey.ChaosMonkey import factory [as 别名]
 def test_random_enablement_zero(self):
     with patch('utility.check_output', autospec=True) as mock:
         with temp_dir() as directory:
             runner = Runner(directory, ChaosMonkey.factory())
             runner.random_chaos(run_timeout=1, enablement_timeout=0,
                                 exclude_command=Kill.restart_cmd)
     self.assertEqual(mock.called, True)
开发者ID:FoldingSkyCorporation,项目名称:chaos-monkey,代码行数:9,代码来源:test_runner.py

示例2: test_include_command

# 需要导入模块: from chaos_monkey import ChaosMonkey [as 别名]
# 或者: from chaos_monkey.ChaosMonkey import factory [as 别名]
 def test_include_command(self):
     command = ['deny-incoming']
     cm = ChaosMonkey.factory()
     cm.include_command(command)
     self.assertGreaterEqual(len(cm.chaos), 1)
     self.assertTrue(
         all(c.command_str == 'deny-incoming' for c in cm.chaos))
开发者ID:FoldingSkyCorporation,项目名称:chaos-monkey,代码行数:9,代码来源:test_chaos_monkey.py

示例3: test_filter_commands_exclude_incorrect_group

# 需要导入模块: from chaos_monkey import ChaosMonkey [as 别名]
# 或者: from chaos_monkey.ChaosMonkey import factory [as 别名]
 def test_filter_commands_exclude_incorrect_group(self):
     exclude_group = 'net,killl'
     with temp_dir() as directory:
         runner = Runner(directory, ChaosMonkey.factory())
         with self.assertRaisesRegexp(
                 BadRequest, "Invalid value given on command line: killl"):
             runner.filter_commands(exclude_group=exclude_group)
开发者ID:FoldingSkyCorporation,项目名称:chaos-monkey,代码行数:9,代码来源:test_runner.py

示例4: test_exclude_commands

# 需要导入模块: from chaos_monkey import ChaosMonkey [as 别名]
# 或者: from chaos_monkey.ChaosMonkey import factory [as 别名]
 def test_exclude_commands(self):
     commands = ['deny-all', Kill.jujud_cmd]
     cm = ChaosMonkey.factory()
     cm.include_group('all')
     cm.exclude_command(commands)
     self.assertGreaterEqual(len(cm.chaos), 1)
     self.assertTrue(all(c.command_str not in commands for c in cm.chaos))
开发者ID:FoldingSkyCorporation,项目名称:chaos-monkey,代码行数:9,代码来源:test_chaos_monkey.py

示例5: test_exclude_group

# 需要导入模块: from chaos_monkey import ChaosMonkey [as 别名]
# 或者: from chaos_monkey.ChaosMonkey import factory [as 别名]
 def test_exclude_group(self):
     group = ['net']
     cm = ChaosMonkey.factory()
     cm.include_group('all')
     cm.exclude_group(group)
     self.assertGreaterEqual(len(cm.chaos), 1)
     self.assertTrue(all(c.group != 'net' for c in cm.chaos))
开发者ID:FoldingSkyCorporation,项目名称:chaos-monkey,代码行数:9,代码来源:test_chaos_monkey.py

示例6: test_filter_command_include_command

# 需要导入模块: from chaos_monkey import ChaosMonkey [as 别名]
# 或者: from chaos_monkey.ChaosMonkey import factory [as 别名]
 def test_filter_command_include_command(self):
     include_command = 'deny-all'
     with temp_dir() as directory:
         runner = Runner(directory, ChaosMonkey.factory())
         runner.filter_commands(include_command=include_command)
     self.assertEqual(len(runner.chaos_monkey.chaos), 1)
     self.assertEqual(runner.chaos_monkey.chaos[0].command_str, 'deny-all')
开发者ID:FoldingSkyCorporation,项目名称:chaos-monkey,代码行数:9,代码来源:test_runner.py

示例7: test_random_assert_run_command_method_called

# 需要导入模块: from chaos_monkey import ChaosMonkey [as 别名]
# 或者: from chaos_monkey.ChaosMonkey import factory [as 别名]
 def test_random_assert_run_command_method_called(self):
     with patch('utility.check_output', autospec=True):
         with patch('runner.Runner._run_command', autospec=True) as cm_mock:
             with temp_dir() as directory:
                 runner = Runner(directory, ChaosMonkey.factory())
                 runner.random_chaos(run_timeout=1, enablement_timeout=1)
     cm_mock.assert_called_with(runner, 1)
开发者ID:FoldingSkyCorporation,项目名称:chaos-monkey,代码行数:9,代码来源:test_runner.py

示例8: test_exclude_group_multiple_groups

# 需要导入模块: from chaos_monkey import ChaosMonkey [as 别名]
# 或者: from chaos_monkey.ChaosMonkey import factory [as 别名]
 def test_exclude_group_multiple_groups(self):
     group = ['net', 'kill']
     cm = ChaosMonkey.factory()
     cm.include_group('all')
     cm.exclude_group(group)
     self.assertTrue(all(c.group != 'net' for c in cm.chaos))
     self.assertTrue(all(c.group != 'kill' for c in cm.chaos))
开发者ID:FoldingSkyCorporation,项目名称:chaos-monkey,代码行数:9,代码来源:test_chaos_monkey.py

示例9: test_filter_command_exclude_incorrect_command

# 需要导入模块: from chaos_monkey import ChaosMonkey [as 别名]
# 或者: from chaos_monkey.ChaosMonkey import factory [as 别名]
 def test_filter_command_exclude_incorrect_command(self):
     exclude_command = 'deny-all,deny-net,{}'.format(Kill.jujud_cmd)
     with temp_dir() as directory:
         runner = Runner(directory, ChaosMonkey.factory())
         with self.assertRaisesRegexp(
                 BadRequest,
                 "Invalid value given on command line: deny-net"):
             runner.filter_commands(exclude_command=exclude_command)
开发者ID:FoldingSkyCorporation,项目名称:chaos-monkey,代码行数:10,代码来源:test_runner.py

示例10: test_filter_command_include_incorrect_command

# 需要导入模块: from chaos_monkey import ChaosMonkey [as 别名]
# 或者: from chaos_monkey.ChaosMonkey import factory [as 别名]
 def test_filter_command_include_incorrect_command(self):
     include_command = 'deny-all,deny-net'
     with temp_dir() as directory:
         runner = Runner(directory, ChaosMonkey.factory())
         with self.assertRaisesRegexp(
                 BadRequest,
                 "Invalid value given on command line: deny-net"):
             runner.filter_commands(include_command=include_command)
开发者ID:FoldingSkyCorporation,项目名称:chaos-monkey,代码行数:10,代码来源:test_runner.py

示例11: test_filter_command_exclude_command

# 需要导入模块: from chaos_monkey import ChaosMonkey [as 别名]
# 或者: from chaos_monkey.ChaosMonkey import factory [as 别名]
 def test_filter_command_exclude_command(self):
     exclude_command = Kill.jujud_cmd
     with temp_dir() as directory:
         runner = Runner(directory, ChaosMonkey.factory())
         runner.filter_commands(exclude_command=exclude_command)
     self.assertGreaterEqual(len(runner.chaos_monkey.chaos), 1)
     self.assertTrue(all(c.command_str != Kill.jujud_cmd
                         for c in runner.chaos_monkey.chaos))
开发者ID:FoldingSkyCorporation,项目名称:chaos-monkey,代码行数:10,代码来源:test_runner.py

示例12: test_filter_commands_exclude_group

# 需要导入模块: from chaos_monkey import ChaosMonkey [as 别名]
# 或者: from chaos_monkey.ChaosMonkey import factory [as 别名]
 def test_filter_commands_exclude_group(self):
     exclude_group = 'net'
     with temp_dir() as directory:
         runner = Runner(directory, ChaosMonkey.factory())
         runner.filter_commands(exclude_group=exclude_group)
     self.assertGreaterEqual(len(runner.chaos_monkey.chaos), 2)
     self.assertTrue(all(c.group != 'net'
                         for c in runner.chaos_monkey.chaos))
开发者ID:FoldingSkyCorporation,项目名称:chaos-monkey,代码行数:10,代码来源:test_runner.py

示例13: test_random_chaos_passes_timeout

# 需要导入模块: from chaos_monkey import ChaosMonkey [as 别名]
# 或者: from chaos_monkey.ChaosMonkey import factory [as 别名]
 def test_random_chaos_passes_timeout(self):
     with patch('utility.check_output', autospec=True):
         with patch('runner.Runner._run_command',
                    autospec=True) as mock:
             with temp_dir() as directory:
                 runner = Runner(directory, ChaosMonkey.factory())
                 runner.random_chaos(run_timeout=3, enablement_timeout=2)
     self.assertEqual(mock.call_args_list[0][0][1], 2)
开发者ID:FoldingSkyCorporation,项目名称:chaos-monkey,代码行数:10,代码来源:test_runner.py

示例14: test_exclude_and_include_group

# 需要导入模块: from chaos_monkey import ChaosMonkey [as 别名]
# 或者: from chaos_monkey.ChaosMonkey import factory [as 别名]
 def test_exclude_and_include_group(self):
     group = ['kill']
     cm = ChaosMonkey.factory()
     cm.include_group('all')
     cm.exclude_group(group)
     self.assertTrue(all(c.group != 'kill' for c in cm.chaos))
     cm.include_group(['kill'])
     self.assertTrue(all(c.group == 'kill' for c in cm.chaos))
开发者ID:FoldingSkyCorporation,项目名称:chaos-monkey,代码行数:10,代码来源:test_chaos_monkey.py

示例15: test_filter_commands_include_groups

# 需要导入模块: from chaos_monkey import ChaosMonkey [as 别名]
# 或者: from chaos_monkey.ChaosMonkey import factory [as 别名]
 def test_filter_commands_include_groups(self):
     include_group = 'net,{}'.format(Kill.group)
     with temp_dir() as directory:
         runner = Runner(directory, ChaosMonkey.factory())
         runner.filter_commands(include_group=include_group)
     self.assertGreaterEqual(len(runner.chaos_monkey.chaos), 2)
     self.assertTrue(
         all(c.group == 'net' or c.group == Kill.group
             for c in runner.chaos_monkey.chaos))
开发者ID:FoldingSkyCorporation,项目名称:chaos-monkey,代码行数:11,代码来源:test_runner.py


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