def test_stop_remote_server_wont_work_with_start(self):
     self.server.start()
     uri = 'http://%s:%s' % self.server.server_address
     try:
         self.assertEqual(test_remote_server(uri, log=False), True)
         self.assertEqual(stop_remote_server(uri, log=False), False)
         self.assertEqual(test_remote_server(uri, log=False), True)
     finally:
         self.server.stop()
     self.assertEqual(test_remote_server(uri, log=False), False)
 def test_stop_remote_server(self):
     with self._server_thread():
         uri = self._wait_until_started()
         self.assertEqual(test_remote_server(uri, log=False), True)
         self.assertEqual(stop_remote_server(uri, log=False), True)
         self._wait_until_stopped(uri)
         self.assertEqual(stop_remote_server(uri, log=False), True)
Exemple #3
0
 def test_stop_remote_server(self):
     with self._server_thread():
         uri = self._wait_until_started()
         self.assertEqual(test_remote_server(uri, log=False), True)
         self.assertEqual(stop_remote_server(uri, log=False), True)
         self._wait_until_stopped(uri)
         self.assertEqual(stop_remote_server(uri, log=False), True)
 def _wait_until_stopped(self, uri, timeout=5):
     max_time = time.time() + timeout
     while time.time() < max_time:
         if not test_remote_server(uri, log=False):
             return
         time.sleep(0.01)
     self.server.stop()
     raise AssertionError('Server did not stop in %s seconds.' % timeout)
Exemple #5
0
 def _wait_until_stopped(self, uri, timeout=5):
     max_time = time.time() + timeout
     while time.time() < max_time:
         if not test_remote_server(uri, log=False):
             return
         time.sleep(0.01)
     self.server.stop()
     raise AssertionError('Server did not stop in %s seconds.' % timeout)
 def test_start_and_stop(self):
     self.server.start()
     uri = 'http://%s:%s' % self.server.server_address
     try:
         self._run_remote_keyword(uri)
     finally:
         self.server.stop()
     self.assertEqual(test_remote_server(uri, log=False), False)
 def test_serve(self):
     self.assertEqual(self.server.server_port, 0)
     with self._server_thread():
         uri = self._wait_until_started()
         try:
             self._run_remote_keyword(uri)
         finally:
             self.server.stop()
         self._wait_until_stopped(uri)
         self.assertEqual(test_remote_server(uri, log=False), False)
Exemple #8
0
 def test_serve(self):
     self.assertEqual(self.server.server_port, 0)
     with self._server_thread():
         uri = self._wait_until_started()
         try:
             self._run_remote_keyword(uri)
         finally:
             self.server.stop()
         self._wait_until_stopped(uri)
         self.assertEqual(test_remote_server(uri, log=False), False)
Exemple #9
0
 def start_remote_server(self, server_name, bin, arguments):
     executable = self.__DEFAULT_PYTHON
     args = "Empty"
     if self.__ARGUMENTS in self.params[server_name].keys():
         args = " ".join(["--%s \"%s\"" % (k, v) for k, v in arguments.items() if k not in ["hostname", "username", "repo"]])
     username = self.params[server_name][self.__ARGUMENTS]["username"]
     hostname = self.params[server_name][self.__ARGUMENTS]["hostname"]
     repo = self.params[server_name][self.__ARGUMENTS]["repo"]
     cmd =f"ssh {username}@{hostname} \"cd {repo}; {executable} {bin} {args}\" 2>&1 "
     print(cmd)
     Popen(args=cmd, shell=True)
     time.sleep(2)
     server_uri = self.__URI.format(ip=self.params[server_name][self.__ARGUMENTS]["ip"],
                                    port=self.params[server_name][self.__ARGUMENTS]["port"])
     if test_remote_server(server_uri):
         pass
     return server_uri