Beispiel #1
0
    def _start_from_sources(self):

        service_data = self.context.service_data(self.service_name)
        assets_path = self.context.application.workspace + service_data["location"]

        cmd_with_params = self.service_data["sources"]["cmd"]
        force_pushdir(assets_path)
        run_from_file = open("RUNNING_FROM", 'w')
        run_from_file.write(self.run_from)
        run_from_file.close()

        makedirs_if_not_exists("logs")
        seconds_remaining = SmPythonServiceStarter.PROCESS_STARTUP_TIMEOUT_SECONDS

        with open("logs/stdout.txt", "wb") as out, open("logs/stderr.txt", "wb") as err:
            subprocess.Popen(cmd_with_params, shell=False, env=os.environ.copy(), stdout=out, stderr=err, close_fds=True)

        while seconds_remaining > 0 and not len(SmProcess.processes_matching("grunt")) > 0:
            time.sleep(1)
            seconds_remaining -= 1
            if seconds_remaining < 10 or seconds_remaining % 5 == 0:
                self.log("Waiting for Assets service to start: %s second%s before timeout" % (
                    seconds_remaining, "s" if seconds_remaining > 1 else ""))
        if len(SmProcess.processes_matching("grunt")) == 1:
            process = SmProcess.processes_matching("grunt")
            for i, v in enumerate(process):
                    return v.pid
    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)
    def _start_from_sources(self):

        service_data = self.context.service_data(self.service_name)
        assets_path = self.context.application.workspace + service_data["location"]

        cmd_with_params = self.service_data["sources"]["cmd"]
        force_pushdir(assets_path)
        run_from_file = open("RUNNING_FROM", 'w')
        run_from_file.write(self.run_from)
        run_from_file.close()

        makedirs_if_not_exists("logs")
        seconds_remaining = SmPythonServiceStarter.PROCESS_STARTUP_TIMEOUT_SECONDS

        with open("logs/stdout.txt", "wb") as out, open("logs/stderr.txt", "wb") as err:
            subprocess.Popen(cmd_with_params, shell=False, env=os.environ.copy(), stdout=out, stderr=err, close_fds=True)

        while seconds_remaining > 0 and not len(SmProcess.processes_matching("grunt")) > 0:
            time.sleep(1)
            seconds_remaining -= 1
            if seconds_remaining < 10 or seconds_remaining % 5 == 0:
                self.log("Waiting for Assets service to start: %s second%s before timeout" % (
                    seconds_remaining, "s" if seconds_remaining > 1 else ""))
        if len(SmProcess.processes_matching("grunt")) == 1:
            process = SmProcess.processes_matching("grunt")
            for i, v in enumerate(process):
                    return v.pid
    def status(self, all_processes=None):
        processes = SmProcess.processes_matching(self.pattern, all_processes)

        def _status_for_process(process):
            port = process.extract_integer_argument(
                "-D%s=(\d*)" % self.get_port_argument(), self.default_port)
            test_id = process.extract_argument(
                "-Dservice.manager.testId=([^ ]+)", "")
            run_from = process.extract_argument(
                "-Dservice.manager.runFrom=([^ ]+)", "")
            features = process.extract_arguments("-Dfeature.([^ =]+)=true", "")
            healthcheck = (SmServiceStatus.HEALTHCHECK_PASS
                           if self.run_healthcheck(process) else
                           SmServiceStatus.HEALTHCHECK_BOOT)
            return SmServiceStatus.for_process(
                self.service_name,
                process,
                port,
                test_id,
                run_from,
                features,
                healthcheck,
            )

        return list(map(_status_for_process, processes))
Beispiel #5
0
    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()
Beispiel #6
0
    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(), [])
    def stop(self):
        processes = SmProcess.processes_matching(self.pattern)

        for process in processes:
            kill_pid(self.context, process.ppid)
            kill_pid(self.context, process.pid)
            print "name: %s\tppid: %s\tpid: %s\tuptime: %s" % (self.service_name, process.ppid, process.pid, process.uptime)
    def test_play_with_append_args(self):
        context = self.createContext()
        self.startFakeNexus()

        server = smserverlogic.SmServer(
            SmApplication(self.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()

        self.waitForCondition(
            lambda: 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(True)
        self.assertEqual(
            context.get_service("PLAY_NEXUS_END_TO_END_TEST").status(), [])
Beispiel #9
0
 def stop(self, wait=False):
     for process in SmProcess.processes_matching(self.pattern):
         kill_pid(self.context, process.ppid, wait=wait)
         kill_pid(self.context, process.pid, wait=wait)
         print "name: %s\tppid: %s\tpid: %s\tuptime: %s" % (
             self.service_name, process.ppid, process.pid, process.uptime)
     self.post_stop()
Beispiel #10
0
    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()
Beispiel #11
0
 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(), [])
    def stop(self):
        processes = SmProcess.processes_matching(self.pattern)

        for process in processes:
            kill_pid(self.context, process.ppid)
            kill_pid(self.context, process.pid)
            print "name: %s\tppid: %s\tpid: %s\tuptime: %s" % (
                self.service_name, process.ppid, process.pid, process.uptime)
    def is_started_on_default_port(self):
        processes = SmProcess.processes_matching(self.pattern)
        default_port_argument = "-D%s=%d" % (self.get_port_argument, self.default_port)

        for process in processes:
            if process.has_argument(default_port_argument):
                return True

        return False
    def status(self, all_processes=None):
        processes = SmProcess.processes_matching(self.pattern, all_processes)

        def _status_for_process(process):
            port = process.extract_integer_argument('-D%s=(\d*)' % self.get_port_argument(), self.default_port)
            test_id = process.extract_argument('-Dservice.manager.testId=([^ ]+)', "")
            run_from = process.extract_argument('-Dservice.manager.runFrom=([^ ]+)', "")
            features = process.extract_arguments('-Dfeature.([^ =]+)=true', "")
            healthcheck = SmServiceStatus.HEALTHCHECK_PASS if self.run_healthcheck(process) else SmServiceStatus.HEALTHCHECK_BOOT
            return SmServiceStatus.for_process(self.service_name, process, port, test_id, run_from, features, healthcheck)

        return map(_status_for_process, processes)
Beispiel #15
0
    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)
Beispiel #16
0
    def stop(self, wait=False):

        procs = SmProcess.processes_matching(SmPythonService.get_pattern(self),
                                             None)

        if len(procs) == 0:
            return

        self.log("Stopping '%s'..." % (self.service_data["name"]), True)

        for proc in procs:
            kill_pid(self.context, proc.pid, wait=wait)
            self.log("PID  %d killed" % proc.pid, True)
Beispiel #17
0
    def status(self):
        processes = SmProcess.processes_matching(SmPythonService.get_pattern(self))

        if len(processes) == 0:
            return []

        if len(processes) > 1:
            self.log("POSSIBLE PROBLEM: Found more than one process")

        def _status_for_process(process):
            healthcheck = SmServiceStatus.HEALTHCHECK_PASS if self.run_healthcheck(None) else SmServiceStatus.HEALTHCHECK_BOOT
            return SmServiceStatus.for_process(self.service_name, process, self.default_port, "", "", "", healthcheck)

        return map(_status_for_process, processes)
Beispiel #18
0
    def test_external_with_append_args(self):
        context = self.createContext()
        server = smserverlogic.SmServer(SmApplication(self.config_dir_override, None))
        request = dict()
        request["testId"] = "foo"
        request["services"] = [{"serviceName": "TEST_FOUR", "runFrom": "SNAPSHOT", "appendArgs": ["2"]}]
        smserverlogic.SmStartRequest(server, request, True, False, False, True).process_request()
        self.assertIsNotNone(context.get_service("TEST_FOUR").status())
        pattern = context.application.services["TEST_FOUR"]["pattern"]

        self.waitForCondition(lambda: len(SmProcess.processes_matching(pattern)), 1)

        context.kill_everything(True)
        self.assertEqual(context.get_service("TEST_FOUR").status(), [])
    def status(self):
        processes = SmProcess.processes_matching(SmPythonService.get_pattern(self))

        if len(processes) == 0:
            return []

        if len(processes) > 1:
            self.log("POSSIBLE PROBLEM: Found more than one process")

        def _status_for_process(process):
            healthcheck = SmServiceStatus.HEALTHCHECK_PASS if self.run_healthcheck(None) else SmServiceStatus.HEALTHCHECK_BOOT
            return SmServiceStatus.for_process(self.service_name, process, self.default_port, "", "", "", healthcheck)

        return map(_status_for_process, processes)
Beispiel #20
0
    def test_external_with_append_args(self):
        context = self.createContext()
        server = smserverlogic.SmServer(SmApplication(self.config_dir_override, None))
        request = dict()
        request["testId"] = "foo"
        request["services"] = [{"serviceName": "TEST_FOUR", "runFrom": "SNAPSHOT", "appendArgs": ["2"]}]
        smserverlogic.SmStartRequest(server, request, True, False, False, True).process_request()
        self.assertIsNotNone(context.get_service("TEST_FOUR").status())
        pattern = context.application.services["TEST_FOUR"]["pattern"]

        self.waitForCondition(lambda : len(SmProcess.processes_matching(pattern)), 1)

        context.kill_everything(True)
        self.assertEqual(context.get_service("TEST_FOUR").status(), [])
Beispiel #21
0
def _wait_for_services(context, service_names, seconds_to_wait):

    waiting_for_services = []

    for service_name in service_names:
        if "healthcheck" in context.service_data(service_name):
            waiting_for_services += [context.get_service(service_name)]

    if not seconds_to_wait:
        seconds_to_wait = 0

    end_time = _now() + seconds_to_wait

    while waiting_for_services and _now() < end_time:

        services_to_check = list(waiting_for_services)

        for service in services_to_check:

            if _now() >= end_time:
                break

            processes = SmProcess.processes_matching(service.pattern)
            if all(map(service.run_healthcheck, processes)):
                print(("Service '%s' has started successfully" %
                       service.service_name))
                waiting_for_services.remove(service)
            else:
                seconds_remaining = end_time - _now()
                if seconds_remaining % 5 == 0 or seconds_remaining < 10:
                    print((
                        "Waiting for %s to start, %s second%s before timeout" %
                        (
                            service.service_name,
                            seconds_remaining,
                            "s" if seconds_to_wait != 1 else "",
                        )))

        if waiting_for_services:
            time.sleep(1)

    if waiting_for_services:
        services_timed_out = []
        for service in waiting_for_services:
            services_timed_out += [service.service_name]
        raise ServiceManagerException("Timed out starting service(s): %s" %
                                      ", ".join(services_timed_out))
    def status(self, all_processes=None):
        processes = SmProcess.processes_matching(self.pattern, all_processes)

        if len(processes) == 0:
            return []

        if len(processes) > 1:
            self.log("POSSIBLE PROBLEM: Found more than one process")

        def _status_for_process(process):
            hc_result = self.run_healthcheck(process)
            healthcheck = SmServiceStatus.HEALTHCHECK_NONE
            if hc_result is not None:
                healthcheck = SmServiceStatus.HEALTHCHECK_PASS if self.run_healthcheck(process) else SmServiceStatus.HEALTHCHECK_BOOT
            return SmServiceStatus.for_process(self.service_name, process, "", "", "", "", healthcheck)


        return map(_status_for_process, processes)
Beispiel #23
0
 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(), [])
Beispiel #24
0
    def status(self, all_processes=None):
        processes = SmProcess.processes_matching(self.pattern, all_processes)

        if len(processes) == 0:
            return []

        if len(processes) > 1:
            self.log("POSSIBLE PROBLEM: Found more than one process")

        def _status_for_process(process):
            hc_result = self.run_healthcheck(process)
            healthcheck = SmServiceStatus.HEALTHCHECK_NONE
            if hc_result is not None:
                healthcheck = SmServiceStatus.HEALTHCHECK_PASS if self.run_healthcheck(
                    process) else SmServiceStatus.HEALTHCHECK_BOOT
            return SmServiceStatus.for_process(self.service_name, process, "",
                                               "", "", "", healthcheck)

        return map(_status_for_process, processes)
Beispiel #25
0
    def test_play_with_append_args(self):
        context = self.createContext()
        self.startFakeNexus()

        server = smserverlogic.SmServer(SmApplication(self.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, False, True).process_request()

        self.waitForCondition(lambda : 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(True)
        self.assertEqual(context.get_service("PLAY_NEXUS_END_TO_END_TEST").status(), [])
def _wait_for_services(context, service_names, seconds_to_wait):

    waiting_for_services = []

    for service_name in service_names:
        if "healthcheck" in context.service_data(service_name):
            waiting_for_services += [context.get_service(service_name)]

    if not seconds_to_wait:
        seconds_to_wait = 0

    end_time = _now() + seconds_to_wait

    while waiting_for_services and _now() < end_time:

        services_to_check = list(waiting_for_services)

        for service in services_to_check:

            if _now() >= end_time:
                break

            processes = SmProcess.processes_matching(service.pattern)
            if all(map(service.run_healthcheck, processes)):
                print "Service '%s' has started successfully" % service.service_name
                waiting_for_services.remove(service)
            else:
                seconds_remaining = end_time - _now()
                if seconds_remaining % 5 == 0 or seconds_remaining < 10:
                    print "Waiting for %s to start, %s second%s before timeout" % (service.service_name, seconds_remaining, "s" if seconds_to_wait != 1 else "")

        if waiting_for_services:
            time.sleep(1)

    if waiting_for_services:
        services_timed_out = []
        for service in waiting_for_services:
            services_timed_out += [service.service_name]
        raise ServiceManagerException("Timed out starting service(s): %s" % ", ".join(services_timed_out))
Beispiel #27
0
    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(), [])
Beispiel #28
0
 def is_started_on_default_port(self):
     return len(
         SmProcess.processes_matching(
             SmPythonService.get_pattern(self))) > 0
 def is_started_on_default_port(self):
     return len(SmProcess.processes_matching(SmPythonService.get_pattern(self))) > 0
Beispiel #30
0
 def stop(self, wait=False):
     for process in SmProcess.processes_matching(self.pattern):
         kill_pid(self.context, process.ppid, wait=wait)
         kill_pid(self.context, process.pid, wait=wait)
         self.context.log("name: %s\tppid: %s\tpid: %s\tuptime: %s" % (self.service_name, process.ppid, process.pid, process.uptime), True)
     self.post_stop()
 def is_started_on_default_port(self):
     return len(SmProcess.processes_matching(self.pattern)) > 0
Beispiel #32
0
 def is_started_on_default_port(self):
     return len(SmProcess.processes_matching(self.pattern)) > 0
 def test_whole_arg_string_is_matched(self):
     args = ["foo", "bar", "baz"]
     assert_that(
       SmProcess.find_in_command_line(args, re.compile("foo bar")), is_(True)
     )
 def process(self, cmdline):
     return SmProcess(ppid=10,
                      pid=1,
                      uptime=30,
                      mem=10,
                      args=cmdline.split())