Ejemplo n.º 1
0
 def test_full_run_ztestsuite(self):
   """
   Tests the new use of ztest and zetestsuite
   :return:
   """
   runtime.reset_collector()
   ztestsuite = SampleTestSuite()
   ztestsuite.zopkio()
Ejemplo n.º 2
0
 def test_copy_log_naarad_logs_speced_per_id(self):
   """
   Create a single log file and set "naarad_logs" method to return
   this file and test that is gets copied as expected
   """    #first set things up
   #create a temp dir for logs
   import tempfile
   localhost_logs_dir = tempfile.mkdtemp()
   try:
     localhost_log_file = os.path.join(localhost_logs_dir, "unittest.log")
     ztestsuite = SampleTestSuite(Mock_Deployer())
     ztestsuite.naarad_logs = lambda unique_id: [localhost_log_file]
     self.__test_copy_log_speced_per_id(ztestsuite, localhost_log_file)
   finally:
     #cleanup
     shutil.rmtree( localhost_logs_dir)
Ejemplo n.º 3
0
 def test_copy_log_process_logs_deprecated(self):
   """
   Create a single log file and set "process_logs" method
   with DEPRECATED signature to return
   this file and test that is gets copied as expected
   """
   #first set things up
   #create a temp dir for logs
   import tempfile
   localhost_logs_dir = tempfile.mkdtemp()
   try:
     localhost_log_file = os.path.join(localhost_logs_dir, "unittest.log")
     ztestsuite = SampleTestSuite(Mock_Deployer())
     ztestsuite.process_logs = lambda : {"ztestsuite.unittest-srv":[localhost_log_file]}
     self.__test_copy_logs_deprecated(ztestsuite, localhost_log_file)
   finally:
     shutil.rmtree( localhost_logs_dir)
Ejemplo n.º 4
0
 def test_copy_log_machine_logs_flag_off(self):
   """
   Create a single log file and set "machine_logs" method to return
   this file and test that is gets copied as expected
   """
   #first set things up
   #create a temp dir for logs
   import tempfile
   localhost_logs_dir = tempfile.mkdtemp()
   try:
     localhost_log_file = os.path.join(localhost_logs_dir, "unittest.log")
     ztestsuite = SampleTestSuite(Mock_Deployer())
     ztestsuite.machine_logs = lambda unique_id: [localhost_log_file]
     ztestsuite.should_fetch_logs = lambda:False
     self.__test_copy_log_speced_per_id(ztestsuite, localhost_log_file, False)
   finally:
     shutil.rmtree( localhost_logs_dir)
Ejemplo n.º 5
0
 def test_copy_log_naarad_logs_speced_per_id(self):
     """
 Create a single log file and set "naarad_logs" method to return
 this file and test that is gets copied as expected
 """    #first set things up
     #create a temp dir for logs
     import tempfile
     localhost_logs_dir = tempfile.mkdtemp()
     try:
         localhost_log_file = os.path.join(localhost_logs_dir,
                                           "unittest.log")
         ztestsuite = SampleTestSuite(Mock_Deployer())
         ztestsuite.naarad_logs = lambda unique_id: [localhost_log_file]
         self.__test_copy_log_speced_per_id(ztestsuite, localhost_log_file,
                                            False)
     finally:
         #cleanup
         shutil.rmtree(localhost_logs_dir)
Ejemplo n.º 6
0
 def test_copy_log_process_logs_deprecated(self):
     """
 Create a single log file and set "process_logs" method
 with DEPRECATED signature to return
 this file and test that is gets copied as expected
 """
     #first set things up
     #create a temp dir for logs
     import tempfile
     localhost_logs_dir = tempfile.mkdtemp()
     try:
         localhost_log_file = os.path.join(localhost_logs_dir,
                                           "unittest.log")
         ztestsuite = SampleTestSuite(Mock_Deployer())
         ztestsuite.process_logs = lambda: {
             "ztestsuite.unittest-srv": [localhost_log_file]
         }
         self.__test_copy_logs_deprecated(ztestsuite, localhost_log_file)
     finally:
         shutil.rmtree(localhost_logs_dir)
Ejemplo n.º 7
0
 def test_copy_logs_empty_default(self):
     #first set things up
     runtime.reset_all()
     ztestsuite = SampleTestSuite()
     runtime.set_active_config(Config("unittestconfig", {}))
     runner = TestRunner(ztestsuite=ztestsuite)
     #create a temp dir for logs
     import tempfile
     logs_dir = tempfile.mkdtemp()
     runner.set_logs_dir(logs_dir)
     runner._copy_logs()
     try:
         #no logs specified on default, so should not have any files
         self.assertTrue(os.listdir(logs_dir) == [])
     except:
         raise
     finally:
         #cleanup
         shutil.rmtree(logs_dir)