Browse Source

Need to stop apache server before every test as it runs as root user

root 9 years ago
parent
commit
1ed8d8d2e7
1 changed files with 3 additions and 2 deletions
  1. 3 2
      toolset/benchmark/benchmarker.py

+ 3 - 2
toolset/benchmark/benchmarker.py

@@ -125,7 +125,6 @@ class Benchmarker:
     self.__setup_server()
     self.__setup_server()
     self.__setup_database()
     self.__setup_database()
     self.__setup_client()
     self.__setup_client()
-    self.__setup_misc()    
 
 
     ## Check if wrk (and wrk-pipeline) is installed and executable, if not, raise an exception
     ## Check if wrk (and wrk-pipeline) is installed and executable, if not, raise an exception
     #if not (os.access("/usr/local/bin/wrk", os.X_OK) and os.access("/usr/local/bin/wrk-pipeline", os.X_OK)):
     #if not (os.access("/usr/local/bin/wrk", os.X_OK) and os.access("/usr/local/bin/wrk-pipeline", os.X_OK)):
@@ -381,7 +380,7 @@ class Benchmarker:
   ############################################################
   ############################################################
   # Clean up any processes that run with root privileges
   # Clean up any processes that run with root privileges
   ############################################################
   ############################################################
-  def __setup_misc(self):
+  def __cleanup_leftover_processes_before_test(self):
     p = subprocess.Popen(self.database_ssh_string, stdin=subprocess.PIPE, shell=True)
     p = subprocess.Popen(self.database_ssh_string, stdin=subprocess.PIPE, shell=True)
     p.communicate("""
     p.communicate("""
       sudo /etc/init.d/apache2 stop
       sudo /etc/init.d/apache2 stop
@@ -584,6 +583,8 @@ class Benchmarker:
           ])
           ])
           print "database connection test results:\n" + "\n".join(st[1])
           print "database connection test results:\n" + "\n".join(st[1])
 
 
+        self.__cleanup_leftover_processes_before_test();
+
         if self.__is_port_bound(test.port):
         if self.__is_port_bound(test.port):
           # This can happen sometimes - let's try again
           # This can happen sometimes - let's try again
           self.__stop_test(out)
           self.__stop_test(out)