def teardown_suite(self):
     """Teardown suite environment: Debug symbols test suite"""
     kill_all_processes()
     # If there are failed test cases, save the contents of the installation directories.
     # This must be done not more than once per suite run to save space,
     # therefore it shouldn't be done in a @collect_crash_data method.
     if self.there_are_failed_tests():
         if self.installer.cfg.debug_install_prefix.exists():
             archive = shutil.make_archive(
                 "debug_package_installation_dir",
                 "gztar",
                 self.installer.cfg.debug_install_prefix,
                 self.installer.cfg.debug_install_prefix,
             )
             attach.file(archive, "Debug package installation directory",
                         "application/x-tar", "tgz")
         if self.installer.cfg.install_prefix.exists():
             archive = shutil.make_archive(
                 "server_package_installation_dir",
                 "gztar",
                 self.installer.cfg.install_prefix,
                 self.installer.cfg.install_prefix,
             )
             attach.file(archive, "Server package installation directory",
                         "application/x-tar", "tgz")
 def save_test_data(self):
     """save test data"""
     test_dir = DebuggerTestSuite.TEST_DATA_DIR
     if test_dir.exists():
         archive = shutil.make_archive("debug_symbols_test_dir", "gztar",
                                       test_dir, test_dir)
         attach.file(archive, "Debug symbols test suite directory",
                     "application/x-tar", "tgz")
Exemplo n.º 3
0
 def save_data_dir(self):
     """upload a system database directory into the report"""
     inst = self.installers["enterprise"][0][1]
     data_dir = inst.cfg.dbdir
     if data_dir.exists():
         with shutil.make_archive("datadir", "bztar", data_dir,
                                  data_dir) as archive:
             attach.file(archive, "data directory archive",
                         "application/x-bzip2", "tar.bz2")
 def save_data_dir(self):
     """save data dir and logs in case a test failed"""
     kill_all_processes()
     if self.starter.basedir.exists():
         archive = shutil.make_archive(
             f"LicenseManagerSingleServerTestSuite(v. {self.base_cfg.version})",
             "bztar", self.starter.basedir)
         attach.file(archive, "test dir archive", "application/x-bzip2",
                     "tar.bz2")
     else:
         print("test basedir doesn't exist, won't create report tar")
Exemplo n.º 5
0
 def add_logfile_to_report(self):
     """Add log to allure report"""
     logfile = str(self.logfile)
     attach.file(
         logfile,
         "Log file(name: {name}, PID:{pid}, port: {port}, type: {type})".
         format(name=self.name,
                pid=self.pid,
                port=self.port,
                type=self.type_str),
         AttachmentType.TEXT,
     )
Exemplo n.º 6
0
    def zip_test_dir(self):
        """stores the test directory for later analysis"""
        build_number = os.environ.get("BUILD_NUMBER")
        if build_number:
            build_number = "_" + build_number
        else:
            build_number = ""
        ver = self.cfg.version
        if self.new_cfg:
            ver += "_" + self.new_cfg.version

        filename = "%s_%s%s%s" % (
            FNRX.sub("", self.testrun_name),
            self.__class__.__name__,
            ver,
            build_number,
        )
        if self.basecfg.base_test_dir.exists():
            archive = shutil.make_archive(filename, "bztar", self.basecfg.base_test_dir, self.basedir)
            attach.file(archive, "test dir archive", "application/x-bzip2", "tar.bz2")
        else:
            print("test basedir doesn't exist, won't create report tar")
 def copy_packages_to_result(self, installers):
     """copy packages in test to the report directory (including debug symbols)"""
     if not installers[0][1].find_crash(installers[0][0].base_test_dir):
         return
     for installer_set in installers:
         for package in [
             installer_set[1].server_package,
             installer_set[1].debug_package,
             installer_set[1].client_package,
         ]:
             if package is not None:
                 print(Path.cwd())
                 print(
                     "Copying package into result: "
                     + str(installer_set[1].cfg.package_dir / package)
                     + " => "
                     + str(Path.cwd())
                 )
                 shutil.copyfile(installer_set[1].cfg.package_dir / package, Path.cwd() / package)
                 attach.file(
                     Path.cwd() / package,
                     "source archive used in tests: " + str(package),
                     installer_set[1].extension,
                 )
Exemplo n.º 8
0
 def add_logfile_to_report(self):
     """Add starter log to allure report"""
     logfile = str(self.log_file)
     attach.file(logfile, "Starter log file", AttachmentType.TEXT)