Exemplo n.º 1
0
 def createSuiteLog(self):
     # /srv/slapgrid/slappartXX/srv/var/log/testnode/az-mlksjfmlk234Sljssdflkj23KSdfslj/suite.log
     alphabets = string.digits + string.letters
     rand_part = "".join(random.choice(alphabets) for i in xrange(32))
     random_suite_folder_id = "%s-%s" % (self.reference, rand_part)
     suite_log_directory = os.path.join(self.log_directory, random_suite_folder_id)
     SlapOSControler.createFolders(suite_log_directory)
     self.suite_log_path = os.path.join(suite_log_directory, "suite.log")
     return self.getSuiteLogPath(), random_suite_folder_id
Exemplo n.º 2
0
 def createSuiteLog(self):
     # /srv/slapgrid/slappartXX/srv/var/log/testnode/az-mlksjfmlk234Sljssdflkj23KSdfslj/suite.log
     alphabets = string.digits + string.letters
     rand_part = ''.join(random.choice(alphabets) for i in xrange(32))
     random_suite_folder_id = '%s-%s' % (self.reference, rand_part)
     suite_log_directory = os.path.join(self.log_directory,
                                        random_suite_folder_id)
     SlapOSControler.createFolders(suite_log_directory)
     self.suite_log_path = os.path.join(suite_log_directory, 'suite.log')
     return self.getSuiteLogPath(), random_suite_folder_id
Exemplo n.º 3
0
 def runTestSuite(self, node_test_suite, portal_url, log=None):
     config = self.testnode.config
     parameter_list = []
     run_test_suite_path_list = glob.glob("%s/*/bin/runTestSuite" % self.slapos_controler.instance_root)
     if not len(run_test_suite_path_list):
         raise ValueError("No runTestSuite provided in installed partitions.")
     run_test_suite_path = run_test_suite_path_list[0]
     run_test_suite_revision = node_test_suite.revision
     # Deal with Shebang size limitation
     invocation_list = self.testnode._dealShebang(run_test_suite_path)
     invocation_list.extend(
         [
             run_test_suite_path,
             "--test_suite",
             node_test_suite.test_suite,
             "--revision",
             node_test_suite.revision,
             "--test_suite_title",
             node_test_suite.test_suite_title,
             "--node_quantity",
             config["node_quantity"],
             "--master_url",
             portal_url,
         ]
     )
     firefox_bin_list = glob.glob("%s/soft/*/parts/firefox/firefox-slapos" % config["slapos_directory"])
     if len(firefox_bin_list):
         parameter_list.append("--firefox_bin")
     xvfb_bin_list = glob.glob("%s/soft/*/parts/xserver/bin/Xvfb" % config["slapos_directory"])
     if len(xvfb_bin_list):
         parameter_list.append("--xvfb_bin")
     supported_paramater_set = self.testnode.process_manager.getSupportedParameterSet(
         run_test_suite_path, parameter_list
     )
     if "--firefox_bin" in supported_paramater_set:
         invocation_list.extend(["--firefox_bin", firefox_bin_list[0]])
     if "--xvfb_bin" in supported_paramater_set:
         invocation_list.extend(["--xvfb_bin", xvfb_bin_list[0]])
     # TODO : include testnode correction ( b111682f14890bf )
     if hasattr(node_test_suite, "additional_bt5_repository_id"):
         additional_bt5_path = os.path.join(
             node_test_suite.working_directory, node_test_suite.additional_bt5_repository_id
         )
         invocation_list.extend(["--bt5_path", additional_bt5_path])
     # From this point, test runner becomes responsible for updating test
     # result. We only do cleanup if the test runner itself is not able
     # to run.
     SlapOSControler.createFolder(node_test_suite.test_suite_directory, clean=True)
     self.testnode.process_manager.spawn(
         *invocation_list, cwd=node_test_suite.test_suite_directory, log_prefix="runTestSuite", get_output=False
     )
Exemplo n.º 4
0
 def createSuiteLog(self):
     # /srv/slapgrid/slappartXX/srv/var/log/testnode/az-mlksjfmlk234Sljssdflkj23KSdfslj/suite.log
     alphabets = string.digits + string.letters
     rand_part = ''.join(random.choice(alphabets) for i in xrange(32))
     random_suite_folder_id = '%s-%s' % (self.reference, rand_part)
     suite_log_directory = os.path.join(self.log_directory,
                                        random_suite_folder_id)
     SlapOSControler.createFolders(suite_log_directory)
     # XXX copy the whole content of the log viewer app
     for fname in glob.glob(
             os.path.join(os.path.dirname(__file__), 'js-logtail', '*')):
         shutil.copy(fname, suite_log_directory)
     self.suite_log_path = os.path.join(suite_log_directory, 'suite.log')
     return self.getSuiteLogPath(), random_suite_folder_id
Exemplo n.º 5
0
 def createSuiteLog(self):
   # /srv/slapgrid/slappartXX/srv/var/log/testnode/az-mlksjfmlk234Sljssdflkj23KSdfslj/suite.log
   alphabets = string.digits + string.letters
   rand_part = ''.join(random.choice(alphabets) for i in xrange(32))
   random_suite_folder_id = '%s-%s' % (self.reference, rand_part)
   suite_log_directory = os.path.join(self.log_directory,
                                      random_suite_folder_id)
   SlapOSControler.createFolders(suite_log_directory)
   # XXX copy the whole content of the log viewer app
   for fname in glob.glob(os.path.join(os.path.dirname(__file__), 'js-logtail', '*')):
     shutil.copy(fname, suite_log_directory)
   self.suite_log_path = os.path.join(suite_log_directory,
                                      'suite.log')
   return self.getSuiteLogPath(), random_suite_folder_id
Exemplo n.º 6
0
 def runTestSuite(self, node_test_suite, portal_url, log=None):
     config = self.testnode.config
     parameter_list = []
     slapos_controler = self._getSlapOSControler(
         self.testnode.working_directory)
     run_test_suite_path_list = sorted(glob.glob("%s/*/bin/runTestSuite" % \
         slapos_controler.instance_root))
     if not len(run_test_suite_path_list):
         raise ValueError(
             'No runTestSuite provided in installed partitions.')
     run_test_suite_path = run_test_suite_path_list[0]
     run_test_suite_revision = node_test_suite.revision
     # Deal with Shebang size limitation
     invocation_list = dealShebang(run_test_suite_path)
     invocation_list.extend([
         run_test_suite_path, '--test_suite', node_test_suite.test_suite,
         '--revision', node_test_suite.revision, '--test_suite_title',
         node_test_suite.test_suite_title, '--node_quantity',
         config['node_quantity'], '--master_url', portal_url
     ])
     firefox_bin_list = glob.glob("%s/soft/*/parts/firefox/firefox-slapos" % \
         config["slapos_directory"])
     if len(firefox_bin_list):
         parameter_list.append('--firefox_bin')
     xvfb_bin_list = glob.glob("%s/soft/*/parts/xserver/bin/Xvfb" % \
         config["slapos_directory"])
     if len(xvfb_bin_list):
         parameter_list.append('--xvfb_bin')
     supported_paramater_set = self.testnode.process_manager.getSupportedParameterSet(
         run_test_suite_path, parameter_list)
     if '--firefox_bin' in supported_paramater_set:
         invocation_list.extend(["--firefox_bin", firefox_bin_list[0]])
     if '--xvfb_bin' in supported_paramater_set:
         invocation_list.extend(["--xvfb_bin", xvfb_bin_list[0]])
     # TODO : include testnode correction ( b111682f14890bf )
     if hasattr(node_test_suite, 'additional_bt5_repository_id'):
         additional_bt5_path = os.path.join(
             node_test_suite.working_directory,
             node_test_suite.additional_bt5_repository_id)
         invocation_list.extend(["--bt5_path", additional_bt5_path])
     # From this point, test runner becomes responsible for updating test
     # result. We only do cleanup if the test runner itself is not able
     # to run.
     SlapOSControler.createFolder(node_test_suite.test_suite_directory,
                                  clean=True)
     self.testnode.process_manager.spawn(
         *invocation_list,
         cwd=node_test_suite.test_suite_directory,
         log_prefix='runTestSuite',
         get_output=False)
Exemplo n.º 7
0
 def _checkData(self):
     if getattr(self, "working_directory", None) is not None:
         if not (self.working_directory.endswith(os.path.sep + self.reference)):
             self.working_directory = os.path.join(self.working_directory, self.reference)
         SlapOSControler.createFolder(self.working_directory)
         self.test_suite_directory = os.path.join(self.working_directory, "test_suite")
         self.custom_profile_path = os.path.join(self.working_directory, "software.cfg")
     if getattr(self, "vcs_repository_list", None) is not None:
         for vcs_repository in self.vcs_repository_list:
             buildout_section_id = vcs_repository.get("buildout_section_id", None)
             repository_id = buildout_section_id or vcs_repository.get("url").split("/")[-1].split(".")[0]
             repository_path = os.path.join(self.working_directory, repository_id)
             vcs_repository["repository_id"] = repository_id
             vcs_repository["repository_path"] = repository_path
Exemplo n.º 8
0
 def _getSlapOSControler(self, working_directory):
     """
 Create a SlapOSControler
 """
     return SlapOSControler.SlapOSControler(working_directory,
                                            self.testnode.config,
                                            self.testnode.log)
Exemplo n.º 9
0
  def runTestSuite(self, node_test_suite, portal_url, log=None):
    config = self.testnode.config
    slapos_controler = self._getSlapOSControler(self.testnode.working_directory)
    run_test_suite_path_list = sorted(glob.glob("%s/*/bin/runTestSuite" % \
        slapos_controler.instance_root))
    if not len(run_test_suite_path_list):
      raise ValueError('No runTestSuite provided in installed partitions.')
    run_test_suite_path = run_test_suite_path_list[0]
    # Deal with Shebang size limitation
    invocation_list = dealShebang(run_test_suite_path)
    invocation_list += (run_test_suite_path,
      '--master_url', portal_url,
      '--revision', node_test_suite.revision,
      '--test_suite', node_test_suite.test_suite,
      '--test_suite_title', node_test_suite.test_suite_title)
    supported_parameter_set = set(self.testnode.process_manager
      .getSupportedParameterList(run_test_suite_path))
    parts = os.path.dirname(os.path.dirname(run_test_suite_path))
    parts += '/software_release/parts/'
    for option in (
        ('--firefox_bin', parts + 'firefox/firefox-slapos'),
        ('--frontend_url', config['frontend_url']),
        ('--node_quantity', config['node_quantity']),
        ('--xvfb_bin', parts + 'xserver/bin/Xvfb'),
        ):
      if option[0] in supported_parameter_set:
        invocation_list += option

    # TODO : include testnode correction ( b111682f14890bf )
    if hasattr(node_test_suite,'additional_bt5_repository_id'):
      additional_bt5_path = os.path.join(
              node_test_suite.working_directory,
              node_test_suite.additional_bt5_repository_id)
      invocation_list.extend(["--bt5_path", additional_bt5_path])
    # From this point, test runner becomes responsible for updating test
    # result. We only do cleanup if the test runner itself is not able
    # to run.
    SlapOSControler.createFolder(node_test_suite.test_suite_directory,
                                 clean=True)
    self.testnode.process_manager.spawn(*invocation_list,
                          cwd=node_test_suite.test_suite_directory,
                          log_prefix='runTestSuite', get_output=False)
Exemplo n.º 10
0
 def runTestSuite(self, node_test_suite, portal_url):
   config = self.config
   parameter_list = []
   run_test_suite_path_list = glob.glob("%s/*/bin/runTestSuite" % \
       self.slapos_controler.instance_root)
   if not len(run_test_suite_path_list):
     raise ValueError('No runTestSuite provided in installed partitions.')
   run_test_suite_path = run_test_suite_path_list[0]
   run_test_suite_revision = node_test_suite.revision
   # Deal with Shebang size limitation
   invocation_list = self._dealShebang(run_test_suite_path)
   invocation_list.extend([run_test_suite_path,
                          '--test_suite', node_test_suite.test_suite,
                          '--revision', node_test_suite.revision,
                          '--test_suite_title', node_test_suite.test_suite_title,
                          '--node_quantity', config['node_quantity'],
                          '--master_url', portal_url])
   firefox_bin_list = glob.glob("%s/soft/*/parts/firefox/firefox-slapos" % \
       config["slapos_directory"])
   if len(firefox_bin_list):
     parameter_list.append('--firefox_bin')
   xvfb_bin_list = glob.glob("%s/soft/*/parts/xserver/bin/Xvfb" % \
       config["slapos_directory"])
   if len(xvfb_bin_list):
     parameter_list.append('--xvfb_bin')
   supported_paramater_set = self.process_manager.getSupportedParameterSet(
                          run_test_suite_path, parameter_list)
   if '--firefox_bin' in supported_paramater_set:
     invocation_list.extend(["--firefox_bin", firefox_bin_list[0]])
   if '--xvfb_bin' in supported_paramater_set:
     invocation_list.extend(["--xvfb_bin", xvfb_bin_list[0]])
   bt5_path_list = config.get("bt5_path")
   if bt5_path_list not in ('', None,):
     invocation_list.extend(["--bt5_path", bt5_path_list])
   # From this point, test runner becomes responsible for updating test
   # result. We only do cleanup if the test runner itself is not able
   # to run.
   SlapOSControler.createFolder(node_test_suite.test_suite_directory,
                                clean=True)
   self.process_manager.spawn(*invocation_list,
                         cwd=node_test_suite.test_suite_directory,
                         log_prefix='runTestSuite', get_output=False)
Exemplo n.º 11
0
 def _checkData(self):
     if getattr(self, "working_directory", None) is not None:
         if not (self.working_directory.endswith(os.path.sep +
                                                 self.reference)):
             self.working_directory = os.path.join(self.working_directory,
                                                   self.reference)
         SlapOSControler.createFolder(self.working_directory)
         self.test_suite_directory = os.path.join(self.working_directory,
                                                  "test_suite")
         self.custom_profile_path = os.path.join(self.working_directory,
                                                 'software.cfg')
     if getattr(self, "vcs_repository_list", None) is not None:
         for vcs_repository in self.vcs_repository_list:
             buildout_section_id = vcs_repository.get(
                 'buildout_section_id', None)
             repository_id = buildout_section_id or \
                             vcs_repository.get('url').split('/')[-1].split('.')[0]
             repository_path = os.path.join(self.working_directory,
                                            repository_id)
             vcs_repository['repository_id'] = repository_id
             vcs_repository['repository_path'] = repository_path
Exemplo n.º 12
0
    def __init__(self, testnode):
        self.testnode = testnode
        self.slapos_controler = SlapOSControler.SlapOSControler(
            self.testnode.working_directory, self.testnode.config)
        # Create the slapos account configuration file and dir
        key = self.testnode.taskdistribution.getSlaposAccountKey()
        certificate = self.testnode.taskdistribution.getSlaposAccountCertificate(
        )
        # Get Slapos Master Url
        self.slapos_url = ''
        try:
            self.slapos_url = self.testnode.taskdistribution.getSlaposUrl()
            if not self.slapos_url:
                self.slapos_url = self.testnode.config['server_url']
        except:
            self.slapos_url = self.testnode.config['server_url']

        # Get Slapos Master url used for api rest (using hateoas)
        self.slapos_api_rest_url = self.testnode.taskdistribution.getSlaposHateoasUrl(
        )

        logger.info("SlapOS Master url is: %s", self.slapos_url)
        logger.info("SlapOS Master hateoas url is: %s",
                    self.slapos_api_rest_url)

        self.key_path, self.cert_path, config_path = self.slapos_controler.createSlaposConfigurationFileAccount(
            key, certificate, self.slapos_url, self.testnode.config)
        self.slapos_communicator = None
        # Dict containing used to store which SR is not yet correctly installed.
        # looks like: {'comp_id1':'SR_urlA', 'comp_id2':'SR_urlA',..}
        self.remaining_software_installation_dict = {}

        # Protection to prevent installation of softwares after checking
        self.authorize_supply = True
        self.authorize_request = False
        # Used to simulate SlapOS answer (used as a queue)
        self.last_slapos_answer = []
        self.last_slapos_answer_request = []
        # Use *.host.vifib.net frontend
        self.frontend_software = 'http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD:/software/apache-frontend/software.cfg'
        self.frontend_instance_guid = 'SOFTINST-9238'
        self.exec_env = os.environ.copy()
Exemplo n.º 13
0
    def __init__(self, testnode):
        self.testnode = testnode
        self.log = self.testnode.log

        self.slapos_controler = SlapOSControler.SlapOSControler(
            self.testnode.working_directory, self.testnode.config, self.log)
        # Create the slapos account configuration file and dir
        key = self.testnode.test_suite_portal.getSlaposAccountKey()
        certificate = self.testnode.test_suite_portal.getSlaposAccountCertificate(
        )

        # Get Slapos Master Url
        self.slapos_url = ''
        try:
            self.slapos_url = self.testnode.test_suite_portal.getSlaposUrl()
            if not self.slapos_url:
                self.slapos_url = self.testnode.config['server_url']
        except:
            self.slapos_url = self.testnode.config['server_url']

        # Get Slapos Master url used for api rest (using hateoas)
        self.slapos_api_rest_url = self.testnode.test_suite_portal.getSlaposHateoasUrl(
        )

        self.log("SlapOS Master url is: %s" % self.slapos_url)
        self.log("SlapOS Master hateoas url is: %s" % self.slapos_api_rest_url)

        self.key_path, self.cert_path, config_path = self.slapos_controler.createSlaposConfigurationFileAccount(
            key, certificate, self.slapos_url, self.testnode.config)
        self.slapos_communicator = None
        # Dict containing used to store which SR is not yet correctly installed.
        # looks like: {'comp_id1':'SR_urlA', 'comp_id2':'SR_urlA',..}
        self.remaining_software_installation_dict = {}

        # Protection to prevent installation of softwares after checking
        self.authorize_supply = True
        self.authorize_request = False
        # Used to simulate SlapOS answer (used as a queue)
        self.last_slapos_answer = []
        self.last_slapos_answer_request = []
Exemplo n.º 14
0
 def __init__(self, testnode):
     self.testnode = testnode
     self.slapos_controler = SlapOSControler.SlapOSControler(
         self.testnode.working_directory, self.testnode.config,
         self.testnode.log)