• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python unittest_support.create_component_pool_for_one_host函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中unittest_support.create_component_pool_for_one_host函数的典型用法代码示例。如果您正苦于以下问题:Python create_component_pool_for_one_host函数的具体用法?Python create_component_pool_for_one_host怎么用?Python create_component_pool_for_one_host使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: test_should_stop_services_then_reboot_then_start_services

    def test_should_stop_services_then_reboot_then_start_services(self,
                                                                  dump_plan,
                                                                  state_reboot,
                                                                  state_metalogic):
        components = create_component_pool_for_one_host(add_services=True)
        state_reboot.return_value = components
        state_metalogic.return_value = state_reboot.return_value

        reboot(uris=["host://foobar42"])

        dump_plan_calls = dump_plan.call_args_list
        self.assertEqual(len(dump_plan_calls), 1, "More than one plan for reboot was serialized! (potential overwrite)")
        dump_plan_call = dump_plan_calls[0]
        dump_plan_call_name, dump_plan_args = dump_plan_call[0]
        actual_reboot_plan = dump_plan_args

        # Careful, there's no missing comma here (string concatenation)
        expected_actions = [
            Action("update", "host://foobar42", "state", "rebooted",
                   kwargs={"reboot_required": True, "upgrade_packages": False},
                   preconditions=[
                       TargetState("service://foobar42/bazservice", "state", "down"),
                       TargetState("service://foobar42/barservice", "state", "down")]),
            Action("start", "service://foobar42/barservice", "state", "up",
                   preconditions=[
                       TargetState("host://foobar42", "state", "rebooted")]),
            Action("start", "service://foobar42/bazservice", "state", "up",
                   preconditions=[
                       TargetState("host://foobar42", "state", "rebooted")]),
            Action("stop", "service://foobar42/barservice", "state", "down"),
            Action("stop", "service://foobar42/bazservice", "state", "down")
        ]

        assert_actual_plan_matches_expected_actions(self, expected_actions, actual_reboot_plan)
开发者ID:Woi,项目名称:yadtshell,代码行数:34,代码来源:reboot_tests.py


示例2: test_should_render_update_needed_when_host_is_not_uptodate

    def test_should_render_update_needed_when_host_is_not_uptodate(self,
                                                                   component_pool):
        component_pool.return_value = create_component_pool_for_one_host(
            host_state=yadtshell.settings.UPDATE_NEEDED)

        info_matrix = self._call_info_and_render_output_to_string()

        self.assert_in(' u  host uptodate', info_matrix)
开发者ID:andante-project,项目名称:yadtshell,代码行数:8,代码来源:info_tests.py


示例3: test_should_update_host_when_host_is_not_uptodate

    def test_should_update_host_when_host_is_not_uptodate(self, components, action_plan, apply_instructions, dump_action_plan, action):
        components.return_value = create_component_pool_for_one_host(
            host_state=yadtshell.settings.UPDATE_NEEDED,
            next_artefacts_present=True)

        compare_versions()

        action.assert_called_with('update', 'host://foobar42', 'state', 'uptodate')
开发者ID:marco-hoyer,项目名称:yadtshell,代码行数:8,代码来源:update_tests.py


示例4: test_should_stop_all_services_without_preconditions

    def test_should_stop_all_services_without_preconditions(self, state):
        state.return_value = create_component_pool_for_one_host(add_services=True)

        stop_plan = yadtshell._reboot.create_plan_to_stop_all_services_on(["host://foobar42"])

        for stop_action in stop_plan.list_actions:
            self.assertEqual(stop_action.cmd, "stop")
            self.assertEqual(stop_action.preconditions, set([]))
开发者ID:Woi,项目名称:yadtshell,代码行数:8,代码来源:reboot_tests.py


示例5: test_should_not_update_anything_when_hosts_are_uptodate

    def test_should_not_update_anything_when_hosts_are_uptodate(self, components, action_plan, apply_instructions, dump_action_plan):
        components.return_value = create_component_pool_for_one_host(
            host_state=yadtshell.settings.UPTODATE)

        compare_versions()

        dump_action_plan.assert_called_with('update', action_plan.return_value)
        action_plan.assert_called_with('start', set([]))
开发者ID:marco-hoyer,项目名称:yadtshell,代码行数:8,代码来源:update_tests.py


示例6: test_should_render_reboot_now

    def test_should_render_reboot_now(self,
                                      component_pool):
        component_pool.return_value = create_component_pool_for_one_host(
            host_state=yadtshell.settings.UPDATE_NEEDED,
            host_reboot_now=True)

        info_matrix = self._call_info_and_render_output_to_string()

        self.assert_in(' R  reboot required', info_matrix)
开发者ID:andante-project,项目名称:yadtshell,代码行数:9,代码来源:info_tests.py


示例7: test_should_render_uptodate_when_host_is_uptodate

    def test_should_render_uptodate_when_host_is_uptodate(self,
                                                          component_pool):
        component_pool.return_value = create_component_pool_for_one_host(
            host_state=yadtshell.settings.UPTODATE)

        info_matrix = self._call_info_and_render_output_to_string()

        self.assert_in(' |  host uptodate', info_matrix)
        self.assert_in('1/1 hosts uptodate', info_matrix)
开发者ID:andante-project,项目名称:yadtshell,代码行数:9,代码来源:info_tests.py


示例8: test_should_stop_all_services

    def test_should_stop_all_services(self, state):
        state.return_value = create_component_pool_for_one_host(add_services=True)

        stop_plan = yadtshell._reboot.create_plan_to_stop_all_services_on(["host://foobar42"])

        self.assertEqual(stop_plan.dump(),
                         'stop [2 items, workers *undefined*, 0 errors tolerated]:\n'
                         '    stop the service://foobar42/barservice, set state to "down"\n'
                         '    stop the service://foobar42/bazservice, set state to "down"\n')
开发者ID:Woi,项目名称:yadtshell,代码行数:9,代码来源:reboot_tests.py


示例9: test_should_render_missing_artefact_problems

    def test_should_render_missing_artefact_problems(self,
                                                     component_pool):
        component_pool.return_value = create_component_pool_for_one_host(
            missing_artefact=True)

        info_matrix = self._call_info_and_render_output_to_string()

        self.assert_in(
            "config problem: missing artefact://foobar42/missing",
            info_matrix)
开发者ID:andante-project,项目名称:yadtshell,代码行数:10,代码来源:info_tests.py


示例10: test_should_render_cache_in_red_when_it_is_old

    def test_should_render_cache_in_red_when_it_is_old(self,
                                                       component_pool,
                                                       cache_age):
        cache_age.return_value = 900
        component_pool.return_value = create_component_pool_for_one_host(
            host_state=yadtshell.settings.UPDATE_NEEDED)

        info_matrix = self._call_info_and_render_output_to_string()

        self.assert_in("queried ${BG_RED}${WHITE}${BOLD}  900  ${NORMAL} seconds ago",
                       info_matrix)
开发者ID:andante-project,项目名称:yadtshell,代码行数:11,代码来源:info_tests.py


示例11: test_should_start_services_unconditionally_when_other_host_is_rebooted

    def test_should_start_services_unconditionally_when_other_host_is_rebooted(self, state):
        components = create_component_pool_for_one_host(add_services=True)
        state.return_value = components

        start_plan = yadtshell._reboot.create_plan_to_start_services_after_rebooting(["service://foobar42/barservice", "service://foobar42/bazservice"],
                                                                                     ["host://foobar43"], components)

        self.assertEqual(start_plan.dump(),
                         'start [2 items, workers *undefined*, 0 errors tolerated]:\n'
                         '    start the service://foobar42/barservice, set state to "up"\n'
                         '    start the service://foobar42/bazservice, set state to "up"\n')
开发者ID:Woi,项目名称:yadtshell,代码行数:11,代码来源:reboot_tests.py


示例12: test_should_render_stopped_services

    def test_should_render_stopped_services(self,
                                            component_pool):
        component_pool.return_value = create_component_pool_for_one_host(
            host_state=yadtshell.settings.UPTODATE,
            add_services=True,
            service_state=yadtshell.settings.DOWN)

        info_matrix = self._call_info_and_render_output_to_string()

        self.assert_in(' O  service barservice', info_matrix)
        self.assert_in(' O  service bazservice', info_matrix)
开发者ID:andante-project,项目名称:yadtshell,代码行数:11,代码来源:info_tests.py


示例13: test_should_render_artefact_problems_when_state_is_not_up

    def test_should_render_artefact_problems_when_state_is_not_up(self,
                                                                  component_pool):
        component_pool.return_value = create_component_pool_for_one_host(
            host_state=yadtshell.settings.UPDATE_NEEDED,
            artefact_state=yadtshell.settings.MISSING)

        info_matrix = self._call_info_and_render_output_to_string()

        self.assert_in('''
problems
${RED}${BOLD}   missing${NORMAL}  artefact://foobar42/yit/0:0.0.1
${RED}${BOLD}   missing${NORMAL}  artefact://foobar42/foo/0:0.0.0

''', info_matrix)
开发者ID:marco-hoyer,项目名称:yadtshell,代码行数:14,代码来源:info_tests.py


示例14: test_should_render_host_locked_by_me

    def test_should_render_host_locked_by_me(self,
                                             component_pool):
        component_pool.return_value = create_component_pool_for_one_host(
            host_locked_by_me=True)

        info_matrix = self._call_info_and_render_output_to_string()

        self.assert_in('''
${BG_YELLOW}${BOLD}
  foobar42 is locked by me
   Reason: yes we can (lock the host)
${NORMAL}
''', info_matrix)

        self.assert_in(' l  host access', info_matrix)
开发者ID:andante-project,项目名称:yadtshell,代码行数:15,代码来源:info_tests.py


示例15: test_should_render_readonly_services

    def test_should_render_readonly_services(self,
                                             component_pool):
        component_pool.return_value = create_component_pool_for_one_host(add_readonly_services=True)

        info_matrix = self._call_info_and_render_output_to_string()

        rendered_ro_services = '''
  foobar42

  |  readonly-service ro_up (needed by me you)
  O  readonly-service ro_down (needed by something a_dog)
'''

        self.assert_in(rendered_ro_services,
                       info_matrix)
开发者ID:andante-project,项目名称:yadtshell,代码行数:15,代码来源:info_tests.py


示例16: test_should_render_host_locked_by_other

    def test_should_render_host_locked_by_other(self,
                                                component_pool):
        component_pool.return_value = create_component_pool_for_one_host(
            host_locked_by_other=True)

        info_matrix = self._call_info_and_render_output_to_string()

        self.assert_in('''
${BG_RED}${WHITE}${BOLD}
       host://foobar42 is locked by foobar
   Reason: yes we can (lock the host)
${NORMAL}
''', info_matrix)

        self.assert_in(' L  host access', info_matrix)
开发者ID:yadt,项目名称:yadtshell,代码行数:15,代码来源:info_tests.py


示例17: test_should_render_colored_readonly_services

    def test_should_render_colored_readonly_services(self,
                                                     component_pool):
        yadtshell._info.calculate_info_view_settings = lambda *args: {'color': 'yes'}
        component_pool.return_value = create_component_pool_for_one_host(add_readonly_services=True)

        info_matrix = self._call_info_and_render_output_to_string()

        rendered_ro_services = '''
  foobar42

  ${BG_GREEN}${WHITE}${BOLD}|${NORMAL}  readonly-service ro_up (needed by me you)
  ${BG_RED}${WHITE}${BOLD}O${NORMAL}  readonly-service ro_down (needed by something a_dog)
'''

        self.assert_in(rendered_ro_services,
                       info_matrix)
开发者ID:andante-project,项目名称:yadtshell,代码行数:16,代码来源:info_tests.py


示例18: test_should_render_matrix_for_one_host

    def test_should_render_matrix_for_one_host(self,
                                               component_pool,
                                               mock_time):
        mock_time.return_value = 1
        component_pool.return_value = create_component_pool_for_one_host(
            host_state=yadtshell.settings.UPDATE_NEEDED)

        info_matrix = self._call_info_and_render_output_to_string()

        expected = '''
${BOLD}yadt info | test${NORMAL}

target status
  foobar42                                       yit  0:0.0.1
                       (next) ${REVERSE}foo${NORMAL}  0:0.0.${REVERSE}0${NORMAL}

  f
  o
  o
  b
  a
  r
  4
  2

  u  host uptodate
  |  reboot required
  |  host access

legend: | up(todate),accessible  O down  ? unknown  io? ignored (up,down,unknown)
        lL locked by me/other  u update pending
        rR reboot needed (after update/due to new kernel)

queried ${BG_GREEN}${WHITE}${BOLD}  0  ${NORMAL} seconds ago

status:   0%   0% | 0/0 services up, 0/1 hosts uptodate
'''

        self.assert_in(expected, info_matrix)
        self.assertEqual(expected, info_matrix)
开发者ID:andante-project,项目名称:yadtshell,代码行数:40,代码来源:info_tests.py


示例19: test_should_stop_no_services_when_host_has_no_services

    def test_should_stop_no_services_when_host_has_no_services(self, state):
        state.return_value = create_component_pool_for_one_host()

        stop_plan = yadtshell._reboot.create_plan_to_stop_all_services_on(["host://foobar42"])

        self.assertEqual(stop_plan.actions, ())
开发者ID:Woi,项目名称:yadtshell,代码行数:6,代码来源:reboot_tests.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python unittestzero.Assert类代码示例发布时间:2022-05-27
下一篇:
Python unittestX.makeSuite函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap