本文整理汇总了Python中servicemanager.smcontext.SmContext类的典型用法代码示例。如果您正苦于以下问题:Python SmContext类的具体用法?Python SmContext怎么用?Python SmContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SmContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_start_and_stop_one_with_append_args
def test_start_and_stop_one_with_append_args(self):
config_dir_override = os.path.join(os.path.dirname(__file__), "conf")
context = SmContext(SmApplication(config_dir_override), None, False, False)
actions.start_one(context, "TEST_ONE", True, False, None, None, ["; echo 'Fin du sleep!!'"])
self.assertEquals(len(context.get_service("TEST_ONE").status()), 2) # it is two in this case because the append creates a forked process
context.kill("TEST_ONE")
self.assertEqual(context.get_service("TEST_ONE").status(), [])
示例2: test_start_and_stop_one
def test_start_and_stop_one(self):
config_dir_override = os.path.join(os.path.dirname(__file__), "conf")
context = SmContext(SmApplication(config_dir_override), None, False, False)
actions.start_one(context, "TEST_ONE", True, False, None, port=None)
self.assertEquals(len(context.get_service("TEST_ONE").status()), 1)
context.kill("TEST_ONE")
self.assertEqual(context.get_service("TEST_ONE").status(), [])
示例3: test_external_binary_config
def test_external_binary_config(self):
config_dir_override = os.path.join(os.path.dirname(__file__), "conf")
context = SmContext(SmApplication(config_dir_override), None, False, False)
starter = context.get_service_starter("FAKE_NEXUS", "foo", proxy=None)
expected = [ 'python', 'fakenexus.py']
cmd = starter.get_start_command("BINARY") #context will be ignored
self.assertEqual(cmd, expected)
示例4: test_python_binary_config
def test_python_binary_config(self):
config_dir_override = os.path.join(os.path.dirname(__file__), "conf")
context = SmContext(SmApplication(config_dir_override), None, False, False)
starter = context.get_service_starter("PYTHON_SIMPLE_SERVER_ASSETS_FRONTEND", "foo", proxy=None)
expected = [ 'get_start_command() not implemented for this type of service - fork and make a pull request :)' ]
cmd = starter.get_start_command("BINARY")
self.assertEqual(cmd, expected)
示例5: test_python_binary_config
def test_python_binary_config(self):
config_dir_override = os.path.join(os.path.dirname(__file__), "conf")
context = SmContext(SmApplication(config_dir_override), None, False, False)
starter = context.get_service_starter("PYTHON_SIMPLE_SERVER_ASSETS_FRONTEND", "foo", proxy=None)
expected = ['python -m SimpleHTTPServer 9032']
cmd = starter.get_start_command("BINARY")
self.assertEqual(cmd, expected)
示例6: test_python_server_offline
def test_python_server_offline(self):
context = SmContext(SmApplication(self.config_dir_override), None, True, False)
port = None
append_args = None
actions.start_one(context, "PYTHON_SIMPLE_SERVER_ASSETS_FRONTEND", False, True, False, None, port, 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(), [])
示例7: test_start_and_stop_one
def test_start_and_stop_one(self):
context = SmContext(SmApplication(self.config_dir_override), None, False, False)
result = actions.start_one(context, "TEST_ONE", False, True, False, None, port=None)
self.assertTrue(result)
self.waitForCondition((lambda : len(context.get_service("TEST_ONE").status())), 1)
context.kill("TEST_ONE", True)
self.assertEqual(context.get_service("TEST_ONE").status(), [])
示例8: test_python_server_offline
def test_python_server_offline(self):
config_dir_override = os.path.join(os.path.dirname(__file__), "conf")
context = SmContext(SmApplication(config_dir_override), None, True, False)
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")
time.sleep(5)
self.assertEqual(context.get_service("PYTHON_SIMPLE_SERVER_ASSETS_FRONTEND").status(), [])
示例9: test_play_source_config
def test_play_source_config(self):
config_dir_override = os.path.join(os.path.dirname(__file__), "conf")
context = SmContext(SmApplication(config_dir_override), None, False, False)
starter = context.get_service_starter("PLAY_NEXUS_END_TO_END_TEST", True, False, None, port=None)
expected = [
"play",
"start -Dhttp.port=8500 -Dservice.manager.serviceName=PLAY_NEXUS_END_TO_END_TEST -Dservice.manager.runFrom=True -DFoo=false",
]
self.assertEqual(starter.get_start_command("SOURCE"), expected)
示例10: test_dropwizard_from_source
def test_dropwizard_from_source(self):
sm_application = SmApplication(self.config_dir_override)
context = SmContext(sm_application, None, False, False)
service_resolver = ServiceResolver(sm_application)
servicetostart = "DROPWIZARD_NEXUS_END_TO_END_TEST"
actions.start_and_wait(service_resolver, context, [servicetostart], False, False, False, None, port=None, seconds_to_wait=90, append_args=None)
self.assertIsNotNone(context.get_service(servicetostart).status())
context.kill(servicetostart, True)
self.assertEqual(context.get_service(servicetostart).status(), [])
示例11: test_external_with_invalid_append_args
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()
示例12: test_dropwizard_from_jar
def test_dropwizard_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)
# start fake nexus
actions.start_one(context, "FAKE_NEXUS", True, False, None, port=None)
self.assertIsNotNone(context.get_service("FAKE_NEXUS").status())
time.sleep(5)
servicetostart = "DROPWIZARD_NEXUS_END_TO_END_TEST"
actions.start_and_wait(
service_resolver,
context,
[servicetostart],
True,
False,
None,
port=None,
seconds_to_wait=90,
append_args=None,
)
self.assertIsNotNone(context.get_service(servicetostart).status())
context.kill(servicetostart)
context.kill("FAKE_NEXUS")
time.sleep(5)
self.assertEqual(context.get_service(servicetostart).status(), [])
self.assertEqual(context.get_service("FAKE_NEXUS").status(), [])
示例13: test_dropwizard_from_source
def test_dropwizard_from_source(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)
servicetostart = "DROPWIZARD_NEXUS_END_TO_END_TEST"
actions.start_and_wait(service_resolver, context, [servicetostart], False, False, None, port=None, seconds_to_wait=90)
self.assertIsNotNone(context.get_service(servicetostart).status())
context.kill(servicetostart)
self.assertEqual(context.get_service(servicetostart).status(), [])
示例14: test_start_and_stop_one_duplicate
def test_start_and_stop_one_duplicate(self):
sm_application = SmApplication(self.config_dir_override)
context = SmContext(sm_application, None, False, False)
service_resolver = ServiceResolver(sm_application)
actions.start_and_wait(service_resolver, context, ["TEST_ONE"], False, False, False, None, port=None, seconds_to_wait=90, append_args=None)
self.assertIsNotNone(context.get_service("TEST_ONE").status())
result = actions.start_one(context, "TEST_ONE", False, True, False, None, port=None)
self.assertFalse(result)
context.kill("TEST_ONE", True)
self.assertEqual(context.get_service("TEST_ONE").status(), [])
示例15: test_play_from_source_default
def test_play_from_source_default(self):
sm_application = SmApplication(self.config_dir_override)
context = SmContext(sm_application, None, False, False)
service_resolver = ServiceResolver(sm_application)
servicetostart = "PLAY_NEXUS_END_TO_END_TEST"
port = None
secondsToWait = 90
append_args = None
actions.start_and_wait(service_resolver, context, [servicetostart], False, False, False, None, port, secondsToWait, append_args)
self.assertIsNotNone(context.get_service(servicetostart).status())
context.kill(servicetostart, True)
self.assertEqual(context.get_service(servicetostart).status(), [])