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


Python SmContext.kill_everything方法代码示例

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


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

示例1: test_wait_on_assets_server

# 需要导入模块: from servicemanager.smcontext import SmContext [as 别名]
# 或者: from servicemanager.smcontext.SmContext import kill_everything [as 别名]
    def test_wait_on_assets_server(self):
        config_dir_override = os.path.join(os.path.dirname(__file__), "conf")
        sm_application = SmApplication(config_dir_override)
        context = SmContext(sm_application, None, False, False)
        service_resolver = ServiceResolver(sm_application)
        context.kill_everything()

        context.kill("FAKE_NEXUS")
        self.assertEqual(context.get_service("FAKE_NEXUS").status(), [])
        time.sleep(2)

        # start fake nexus
        self.assertEqual(context.get_service("FAKE_NEXUS").status(), [])
        response1 = actions.start_one(context, "FAKE_NEXUS", True, False, None, port=None)
        self.assertTrue(response1)
        self.assertIsNotNone(context.get_service("FAKE_NEXUS").status())
        time.sleep(5)

        port = None
        seconds_to_wait = 5
        append_args = None
        actions.start_and_wait(service_resolver, context, ["PYTHON_SIMPLE_SERVER_ASSETS_FRONTEND"], True, False, None, port, seconds_to_wait, append_args)
        self.assertIsNotNone(context.get_service("PYTHON_SIMPLE_SERVER_ASSETS_FRONTEND").status())
        context.kill("PYTHON_SIMPLE_SERVER_ASSETS_FRONTEND")
        context.kill("FAKE_NEXUS")
        time.sleep(15)

        self.assertEqual(context.get_service("PYTHON_SIMPLE_SERVER_ASSETS_FRONTEND").status(), [])
        self.assertEqual(context.get_service("FAKE_NEXUS").status(), [])
开发者ID:liquidarmour,项目名称:service-manager,代码行数:31,代码来源:tests.py

示例2: test_successful_play_from_jar_without_waiting_with_append_args

# 需要导入模块: from servicemanager.smcontext import SmContext [as 别名]
# 或者: from servicemanager.smcontext.SmContext import kill_everything [as 别名]
    def test_successful_play_from_jar_without_waiting_with_append_args(self):
        config_dir_override = os.path.join(os.path.dirname(__file__), "conf")
        sm_application = SmApplication(config_dir_override)
        context = SmContext(sm_application, None, False, False)
        service_resolver = ServiceResolver(sm_application)

        context.kill_everything()
        time.sleep(5)

        response1 = actions.start_one(context, "FAKE_NEXUS", True, False, None, None, None)
        self.assertTrue(response1)
        self.assertIsNotNone(context.get_service("FAKE_NEXUS").status())
        time.sleep(5)

        servicetostart = ["PLAY_NEXUS_END_TO_END_TEST"]
        appendArgs = {"PLAY_NEXUS_END_TO_END_TEST": ["-DFoo=Bar"]}
        fatJar = True
        release = False
        proxy = None
        port = None
        seconds_to_wait = None

        try:
            actions.start_and_wait(service_resolver, context, servicetostart, fatJar, release, proxy, port, seconds_to_wait, appendArgs)
            time.sleep(5)
            service = SmPlayService(context, "PLAY_NEXUS_END_TO_END_TEST")
            processes = SmProcess.processes_matching(service.pattern)
            self.assertEqual(len(processes), 1)
            self.assertTrue("-DFoo=Bar" in processes[0].args)
        finally:
            context.kill_everything()
开发者ID:liquidarmour,项目名称:service-manager,代码行数:33,代码来源:tests.py

示例3: test_failing_play_from_jar

# 需要导入模块: from servicemanager.smcontext import SmContext [as 别名]
# 或者: from servicemanager.smcontext.SmContext import kill_everything [as 别名]
    def test_failing_play_from_jar(self):

        config_dir_override = os.path.join(os.path.dirname(__file__), "conf")
        sm_application = SmApplication(config_dir_override)
        context = SmContext(sm_application, None, False, False)
        service_resolver = ServiceResolver(sm_application)

        context.kill_everything()
        time.sleep(5)

        response1 = actions.start_one(context, "FAKE_NEXUS", True, False, None, port=None)
        self.assertTrue(response1)
        self.assertIsNotNone(context.get_service("FAKE_NEXUS").status())
        time.sleep(5)

        try:
            servicetostart = ["BROKEN_PLAY_PROJECT"]
            actions.start_and_wait(
                service_resolver,
                context,
                servicetostart,
                fatjar=True,
                release=False,
                proxy=None,
                port=None,
                seconds_to_wait=2,
                append_args=None,
            )
            self.fail("Did not expect the project to startup.")
        except ServiceManagerException as sme:
            self.assertEqual("Timed out starting service(s): BROKEN_PLAY_PROJECT", sme.message)
        finally:
            context.kill_everything()
开发者ID:Jagordon,项目名称:service-manager,代码行数:35,代码来源:tests.py

示例4: test_successful_play_from_jar_without_waiting

# 需要导入模块: from servicemanager.smcontext import SmContext [as 别名]
# 或者: from servicemanager.smcontext.SmContext import kill_everything [as 别名]
    def test_successful_play_from_jar_without_waiting(self):
        config_dir_override = os.path.join(os.path.dirname(__file__), "conf")
        sm_application = SmApplication(config_dir_override)
        context = SmContext(sm_application, None, False, False)
        service_resolver = ServiceResolver(sm_application)

        context.kill_everything()
        time.sleep(5)

        response1 = actions.start_one(context, "FAKE_NEXUS", True, False, None, port=None)
        self.assertTrue(response1)
        self.assertIsNotNone(context.get_service("FAKE_NEXUS").status())
        time.sleep(5)

        fatJar = True
        release = False
        proxy = None
        port = None
        seconds_to_wait = None
        append_args = None

        try:
            servicetostart = ["PLAY_NEXUS_END_TO_END_TEST"]
            actions.start_and_wait(service_resolver, context, servicetostart, fatJar, release, proxy, port, seconds_to_wait, append_args)
        finally:
            context.kill_everything()
开发者ID:liquidarmour,项目名称:service-manager,代码行数:28,代码来源:tests.py

示例5: test_play_with_append_args

# 需要导入模块: from servicemanager.smcontext import SmContext [as 别名]
# 或者: from servicemanager.smcontext.SmContext import kill_everything [as 别名]
    def test_play_with_append_args(self):
        config_dir_override = os.path.join(os.path.dirname(__file__), "conf")
        context = SmContext(SmApplication(config_dir_override), None, False, False)
        context.kill_everything()

        # Start up fake nexus first
        response1 = actions.start_one(context, "FAKE_NEXUS", True, False, None, port=None)
        self.assertTrue(response1)
        self.assertIsNotNone(context.get_service("FAKE_NEXUS").status())
        time.sleep(5)

        server = smserverlogic.SmServer(SmApplication(config_dir_override, None))
        request = dict()
        request["testId"] = "foo"
        request["services"] = [
            {"serviceName": "PLAY_NEXUS_END_TO_END_TEST", "runFrom": "SNAPSHOT", "appendArgs": ["-Dfoo=bar"]}
        ]
        smserverlogic.SmStartRequest(server, request, True, False).process_request()
        time.sleep(5)
        self.assertEqual(len(context.get_service("PLAY_NEXUS_END_TO_END_TEST").status()), 1)
        service = SmPlayService(context, "PLAY_NEXUS_END_TO_END_TEST")
        processes = SmProcess.processes_matching(service.pattern)
        self.assertEqual(len(processes), 1)
        self.assertTrue("-Dfoo=bar" in processes[0].args)
        context.kill_everything()
        self.assertEqual(context.get_service("TEST_ONE").status(), [])
开发者ID:Jagordon,项目名称:service-manager,代码行数:28,代码来源:tests.py

示例6: test_external_with_invalid_append_args

# 需要导入模块: from servicemanager.smcontext import SmContext [as 别名]
# 或者: from servicemanager.smcontext.SmContext import kill_everything [as 别名]
 def test_external_with_invalid_append_args(self):
     config_dir_override = os.path.join(os.path.dirname(__file__), "conf")
     context = SmContext(SmApplication(config_dir_override), None, False, False)
     context.kill_everything()
     server = smserverlogic.SmServer(SmApplication(config_dir_override, None))
     request = dict()
     request["testId"] = "foo"
     request["services"] = [{"serviceName": "TEST_ONE", "runFrom": "SNAPSHOT", "appendArgs": ";echo foo"}]
     with pytest.raises(BadRequestException):
         smserverlogic.SmStartRequest(server, request, True, False).process_request()
开发者ID:liquidarmour,项目名称:service-manager,代码行数:12,代码来源:tests.py

示例7: test_assets_server

# 需要导入模块: from servicemanager.smcontext import SmContext [as 别名]
# 或者: from servicemanager.smcontext.SmContext import kill_everything [as 别名]
    def test_assets_server(self):
        context = SmContext(SmApplication(self.config_dir_override), None, False, False)
        context.kill_everything(True)

        self.startFakeNexus()

        actions.start_one(context, "PYTHON_SIMPLE_SERVER_ASSETS_FRONTEND", False, True, False, None, port=None)
        self.assertIsNotNone(context.get_service("PYTHON_SIMPLE_SERVER_ASSETS_FRONTEND").status())
        context.kill("PYTHON_SIMPLE_SERVER_ASSETS_FRONTEND", wait=True)

        self.assertEqual(context.get_service("PYTHON_SIMPLE_SERVER_ASSETS_FRONTEND").status(), [])
开发者ID:elabeca,项目名称:service-manager,代码行数:13,代码来源:test_actions.py

示例8: test_simple

# 需要导入模块: from servicemanager.smcontext import SmContext [as 别名]
# 或者: from servicemanager.smcontext.SmContext import kill_everything [as 别名]
 def test_simple(self):
     config_dir_override = os.path.join(os.path.dirname(__file__), "conf")
     context = SmContext(SmApplication(config_dir_override), None, False, False)
     context.kill_everything()
     server = smserverlogic.SmServer(SmApplication(config_dir_override, None))
     request = dict()
     request["testId"] = "foo"
     request["services"] = [{"serviceName": "TEST_ONE", "runFrom": "SNAPSHOT"},
                            {"serviceName": "DROPWIZARD_NEXUS_END_TO_END_TEST", "runFrom": "SNAPSHOT"},
                            {"serviceName": "PLAY_NEXUS_END_TO_END_TEST", "runFrom": "SNAPSHOT"}]
     smserverlogic.SmStartRequest(server, request, True, False).process_request()
     self.assertIsNotNone(context.get_service("TEST_ONE").status())
     # stop does not currently work for extern
     # smserverlogic.SmStopRequest(SERVER, request).process_request()
     context.kill_everything()
     self.assertEqual(context.get_service("TEST_ONE").status(), [])
开发者ID:liquidarmour,项目名称:service-manager,代码行数:18,代码来源:tests.py

示例9: test_wait_on_assets_server

# 需要导入模块: from servicemanager.smcontext import SmContext [as 别名]
# 或者: from servicemanager.smcontext.SmContext import kill_everything [as 别名]
    def test_wait_on_assets_server(self):
        sm_application = SmApplication(self.config_dir_override)
        context = SmContext(sm_application, None, False, False)
        service_resolver = ServiceResolver(sm_application)
        context.kill_everything(True)

        self.startFakeNexus()

        port = None
        seconds_to_wait = 5
        append_args = None
        actions.start_and_wait(service_resolver, context, ["PYTHON_SIMPLE_SERVER_ASSETS_FRONTEND"], False, True, False, None, port, seconds_to_wait, append_args)
        self.assertIsNotNone(context.get_service("PYTHON_SIMPLE_SERVER_ASSETS_FRONTEND").status())
        context.kill("PYTHON_SIMPLE_SERVER_ASSETS_FRONTEND", True)

        self.assertEqual(context.get_service("PYTHON_SIMPLE_SERVER_ASSETS_FRONTEND").status(), [])
开发者ID:elabeca,项目名称:service-manager,代码行数:18,代码来源:test_actions.py

示例10: test_ensure_multiple_instances_of_a_service_can_be_started_from_server

# 需要导入模块: from servicemanager.smcontext import SmContext [as 别名]
# 或者: from servicemanager.smcontext.SmContext import kill_everything [as 别名]
    def test_ensure_multiple_instances_of_a_service_can_be_started_from_server(self):
        config_dir_override = os.path.join(os.path.dirname(__file__), "conf")
        context = SmContext(SmApplication(config_dir_override), None, False, False)
        context.kill_everything()
        server = smserverlogic.SmServer(SmApplication(config_dir_override, None))

        # start fake nexus
        self.assertEqual(context.get_service("FAKE_NEXUS").status(), [])
        response1 = actions.start_one(context, "FAKE_NEXUS", True, False, None, port=None)
        self.assertTrue(response1)
        self.assertIsNotNone(context.get_service("FAKE_NEXUS").status())
        time.sleep(5)

        first_request = dict()
        first_request["testId"] = "multiple-instance-unit-test-1"
        first_request["services"] = [
            {"serviceName": "TEST_ONE", "runFrom": "SNAPSHOT"},
            {"serviceName": "DROPWIZARD_NEXUS_END_TO_END_TEST", "runFrom": "SNAPSHOT"},
            {"serviceName": "PLAY_NEXUS_END_TO_END_TEST", "runFrom": "SNAPSHOT"},
        ]
        request = smserverlogic.SmStartRequest(server, first_request, True, False)
        request.process_request()

        time.sleep(5)
        self.assertEqual(len(context.get_service("TEST_ONE").status()), 1)
        self.assertEqual(len(context.get_service("DROPWIZARD_NEXUS_END_TO_END_TEST").status()), 1)
        self.assertEqual(len(context.get_service("PLAY_NEXUS_END_TO_END_TEST").status()), 1)

        second_request = dict()
        second_request["testId"] = "multiple-instance-unit-test-2"
        second_request["services"] = [
            {"serviceName": "TEST_ONE", "runFrom": "SNAPSHOT"},
            {"serviceName": "DROPWIZARD_NEXUS_END_TO_END_TEST", "runFrom": "SNAPSHOT"},
            {"serviceName": "PLAY_NEXUS_END_TO_END_TEST", "runFrom": "SNAPSHOT"},
        ]
        smserverlogic.SmStartRequest(server, second_request, True, False).process_request()
        time.sleep(5)
        self.assertEqual(len(context.get_service("TEST_ONE").status()), 2)
        self.assertEqual(len(context.get_service("DROPWIZARD_NEXUS_END_TO_END_TEST").status()), 2)
        self.assertEqual(len(context.get_service("PLAY_NEXUS_END_TO_END_TEST").status()), 2)

        # stop does not currently work for extern
        # smserverlogic.SmStopRequest(SERVER, request).process_request()
        context.kill_everything()
        self.assertEqual(context.get_service("TEST_ONE").status(), [])
        context.kill("FAKE_NEXUS")
开发者ID:Jagordon,项目名称:service-manager,代码行数:48,代码来源:tests.py

示例11: test_external_with_append_args

# 需要导入模块: from servicemanager.smcontext import SmContext [as 别名]
# 或者: from servicemanager.smcontext.SmContext import kill_everything [as 别名]
 def test_external_with_append_args(self):
     config_dir_override = os.path.join(os.path.dirname(__file__), "conf")
     context = SmContext(SmApplication(config_dir_override), None, False, False)
     context.kill_everything()
     server = smserverlogic.SmServer(SmApplication(config_dir_override, None))
     request = dict()
     request["testId"] = "foo"
     request["services"] = [{"serviceName": "TEST_ONE", "runFrom": "SNAPSHOT", "appendArgs": [";echo foo"]}]
     smserverlogic.SmStartRequest(server, request, True, False).process_request()
     self.assertIsNotNone(context.get_service("TEST_ONE").status())
     pattern = context.application.services["TEST_ONE"]["pattern"]
     processes = SmProcess.processes_matching(pattern)
     # stop does not currently work for extern
     # smserverlogic.SmStopRequest(SERVER, request).process_request()
     self.assertEqual(len(processes), 2) #we expect two proecesses to be spawned because of the appended command
     self.assertTrue(";echo" in processes[0].args or ";echo" in processes[1].args)
     context.kill_everything()
     self.assertEqual(context.get_service("TEST_ONE").status(), [])
开发者ID:liquidarmour,项目名称:service-manager,代码行数:20,代码来源:tests.py

示例12: test_failing_play_from_jar

# 需要导入模块: from servicemanager.smcontext import SmContext [as 别名]
# 或者: from servicemanager.smcontext.SmContext import kill_everything [as 别名]
    def test_failing_play_from_jar(self):

        sm_application = SmApplication(self.config_dir_override)
        context = SmContext(sm_application, None, False, False)
        service_resolver = ServiceResolver(sm_application)

        context.kill_everything(True)

        self.startFakeNexus()

        try:
            servicetostart = ["BROKEN_PLAY_PROJECT"]
            actions.start_and_wait(service_resolver, context, servicetostart, source=False, fatjar=True, release=False, proxy=None, port=None, seconds_to_wait=2, append_args=None)
            self.fail("Did not expect the project to startup.")
        except ServiceManagerException as sme:
            self.assertEqual("Timed out starting service(s): BROKEN_PLAY_PROJECT", sme.message)
        finally:
            context.kill_everything(True)
开发者ID:elabeca,项目名称:service-manager,代码行数:20,代码来源:test_actions.py

示例13: test_successful_play_from_jar_without_waiting

# 需要导入模块: from servicemanager.smcontext import SmContext [as 别名]
# 或者: from servicemanager.smcontext.SmContext import kill_everything [as 别名]
    def test_successful_play_from_jar_without_waiting(self):
        sm_application = SmApplication(self.config_dir_override)
        context = SmContext(sm_application, None, False, False)
        service_resolver = ServiceResolver(sm_application)

        context.kill_everything(True)

        self.startFakeNexus()

        fatJar = True
        release = False
        proxy = None
        port = None
        seconds_to_wait = None
        append_args = None

        try:
            servicetostart = ["PLAY_NEXUS_END_TO_END_TEST"]
            actions.start_and_wait(service_resolver, context, servicetostart, False, fatJar, release, proxy, port, seconds_to_wait, append_args)
        finally:
            context.kill_everything(True)
开发者ID:elabeca,项目名称:service-manager,代码行数:23,代码来源:test_actions.py

示例14: test_successful_play_from_jar_without_waiting_with_append_args

# 需要导入模块: from servicemanager.smcontext import SmContext [as 别名]
# 或者: from servicemanager.smcontext.SmContext import kill_everything [as 别名]
    def test_successful_play_from_jar_without_waiting_with_append_args(self):
        sm_application = SmApplication(self.config_dir_override)
        context = SmContext(sm_application, None, False, False)
        service_resolver = ServiceResolver(sm_application)

        context.kill_everything(True)

        self.startFakeNexus()

        servicetostart = ["PLAY_NEXUS_END_TO_END_TEST"]
        appendArgs = {"PLAY_NEXUS_END_TO_END_TEST": ["-DFoo=Bar"]}
        fatJar = True
        release = False
        proxy = None
        port = None
        seconds_to_wait = None

        actions.start_and_wait(service_resolver, context, servicetostart, False, fatJar, release, proxy, port, seconds_to_wait, appendArgs)
        service = SmPlayService(context, "PLAY_NEXUS_END_TO_END_TEST")
        self.waitForCondition(lambda : len(SmProcess.processes_matching(service.pattern)), 1)
        processes = SmProcess.processes_matching(service.pattern)
        self.assertTrue("-DFoo=Bar" in processes[0].args)
开发者ID:elabeca,项目名称:service-manager,代码行数:24,代码来源:test_actions.py

示例15: test_assets_server

# 需要导入模块: from servicemanager.smcontext import SmContext [as 别名]
# 或者: from servicemanager.smcontext.SmContext import kill_everything [as 别名]
    def test_assets_server(self):
        config_dir_override = os.path.join(os.path.dirname(__file__), "conf")
        context = SmContext(SmApplication(config_dir_override), None, False, False)
        context.kill_everything()

        context.kill("FAKE_NEXUS")
        self.assertEqual(context.get_service("FAKE_NEXUS").status(), [])
        time.sleep(2)

        # start fake nexus
        self.assertEqual(context.get_service("FAKE_NEXUS").status(), [])
        response1 = actions.start_one(context, "FAKE_NEXUS", True, False, None, port=None)
        self.assertTrue(response1)
        self.assertIsNotNone(context.get_service("FAKE_NEXUS").status())
        time.sleep(5)

        actions.start_one(context, "PYTHON_SIMPLE_SERVER_ASSETS_FRONTEND", True, False, None, port=None)
        self.assertIsNotNone(context.get_service("PYTHON_SIMPLE_SERVER_ASSETS_FRONTEND").status())
        context.kill("PYTHON_SIMPLE_SERVER_ASSETS_FRONTEND")
        context.kill("FAKE_NEXUS")
        time.sleep(15)

        self.assertEqual(context.get_service("PYTHON_SIMPLE_SERVER_ASSETS_FRONTEND").status(), [])
        self.assertEqual(context.get_service("FAKE_NEXUS").status(), [])
开发者ID:liquidarmour,项目名称:service-manager,代码行数:26,代码来源:tests.py


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