Beispiel #1
0
    def __init__(
        self,
        runner_type,
        abort_on_error,
        installer_set,
        selenium,
        selenium_driver_args,
        testrun_name: str,
        ssl: bool,
        use_auto_certs: bool,
    ):
        # global OTHER_SH_OUTPUT, RESULTS_TXT
        #if not cfg.scenario.exists():
        #    cfg.scenario.write_text(yaml.dump(TestConfig()))
        #    raise Exception("have written %s with default config" % str(cfg.scenario))

        super().__init__(runner_type,
                         abort_on_error,
                         installer_set,
                         RunnerProperties('TESTING', 1, 1, True, ssl, use_auto_certs),
                         selenium, selenium_driver_args, "xx")
        self.scenarios = []
        for scenario in self.cfg.scenario.iterdir():
            if scenario.is_file():
                parse_scenario(scenario, self.scenarios)
            else:
                print('no: ' + str(scenario))
        pp.pprint(self.scenarios)
        self.success = False
        self.starter_instances = []
        self.jwtdatastr = str(timestamp())
        self.slot_lock = Lock()
        self.available_slots = psutil.cpu_count() / 4 # TODO well threadripper..
        self.used_slots = 0
Beispiel #2
0
    def active_failover_detect_hosts(self):
        """ detect hosts for the active failover """
        if not self.instance.is_running():
            raise Exception(timestamp() + "my instance is gone! " +
                            self.basedir)
        # this is the way to detect the master starter...
        lfs = self.get_log_file()
        if lfs.find('Just became master') >= 0:
            self.is_master = True
        else:
            self.is_master = False
        regx = re.compile(r'Starting resilientsingle on port (\d*) .*')
        match = regx.search(lfs)
        if match is None:
            raise Exception(timestamp() + "Unable to get my host state! " +
                            self.basedir + " - " + lfs)

        self.frontend_port = match.groups()[0]
 def __init__(self, runner_type, cfg, old_inst, new_cfg, new_inst,
              selenium, selenium_driver_args):
     super().__init__(runner_type,
                      cfg, old_inst, new_cfg, new_inst,
                      'CLUSTER', 400, 600,
                      selenium, selenium_driver_args)
     #self.basecfg.frontends = []
     self.starter_instances = []
     self.jwtdatastr = str(timestamp())
     self.create_test_collection = ""
Beispiel #4
0
 def active_failover_detect_host_now_follower(self):
     """ detect whether we successfully respawned the instance,
         and it became a follower"""
     if not self.instance.is_running():
         raise Exception(timestamp() + "my instance is gone! " +
                         self.basedir)
     lfs = self.get_log_file()
     if lfs.find('resilientsingle up and running as follower') >= 0:
         self.is_master = False
         return True
     return False
Beispiel #5
0
 def wait_for_logfile(self):
     """ wait for our instance to create a logfile """
     counter = 0
     keep_going = True
     logging.info('Looking for log file.\n')
     while keep_going:
         if not self.instance.is_running():
             raise Exception(timestamp() + "my instance is gone!" +
                             self.basedir)
         if counter == 20:
             raise Exception("logfile did not appear: " +
                             str(self.log_file))
         counter += 1
         logging.info('counter = ' + str(counter))
         if self.log_file.exists():
             logging.info('Found: ' + str(self.log_file) + '\n')
             keep_going = False
         time.sleep(1)
    def __init__(self, runner_type, cfg, old_inst, new_cfg, new_inst, selenium,
                 selenium_driver_args):
        global OTHER_SH_OUTPUT, RESULTS_TXT
        if not cfg.scenario.exists():
            cfg.scenario.write_text(yaml.dump(TestConfig()))
            raise Exception("have written %s with default config" %
                            str(cfg.scenario))

        with open(cfg.scenario) as fileh:
            self.scenario = yaml.load(fileh, Loader=yaml.Loader)

        super().__init__(runner_type, cfg, old_inst, new_cfg, new_inst,
                         'CLUSTER', 9999999, 99999999, selenium,
                         selenium_driver_args)
        self.success = False
        self.starter_instances = []
        self.jwtdatastr = str(timestamp())
        RESULTS_TXT = Path('/tmp/results.txt').open('w')
        OTHER_SH_OUTPUT = Path('/tmp/errors.txt').open('w')
Beispiel #7
0
    def __init__(
        self,
        runner_type,
        abort_on_error,
        installer_set,
        selenium,
        selenium_driver_args,
        testrun_name: str,
        ssl: bool,
        use_auto_certs: bool,
    ):
        super().__init__(
            runner_type,
            abort_on_error,
            installer_set,
            RunnerProperties("CLUSTER", 400, 600, True, ssl, use_auto_certs),
            selenium,
            selenium_driver_args,
            testrun_name,
        )
        # self.basecfg.frontends = []
        self.starter_instances = []
        self.jwtdatastr = str(timestamp())
        self.create_test_collection = ""
        self.min_replication_factor = 2
        self.check_collections_in_sync = (
            "check whether all collections are in sync",
            """
let colInSync=true;
do {
  colInSync=true;
  arango.GET('/_api/replication/clusterInventory').collections.forEach(col => {
    colInSync &= col.allInSync;
    if (!col.allInSync) { print(col); }
  });
  require('internal').sleep(1);
  print('.');
} while (!colInSync);
            """,
        )
Beispiel #8
0
    def __init__(
        self,
        runner_type,
        abort_on_error,
        installer_set,
        selenium,
        selenium_driver_args,
        testrun_name: str,
        ssl: bool,
        use_auto_certs: bool,
    ):
        global OTHER_SH_OUTPUT, RESULTS_TXT
        cfg = installer_set[0][0]
        if not cfg.scenario.exists():
            cfg.scenario.write_text(yaml.dump(TestConfig()))
            raise Exception("have written %s with default config" %
                            str(cfg.scenario))

        with open(cfg.scenario, encoding='utf8') as fileh:
            self.scenario = yaml.load(fileh, Loader=yaml.Loader)

        super().__init__(
            runner_type,
            abort_on_error,
            installer_set,
            RunnerProperties("CLUSTER", 9999999, 99999999, False, ssl,
                             use_auto_certs),
            selenium,
            selenium_driver_args,
            testrun_name,
        )
        self.success = False
        self.starter_instances = []
        self.jwtdatastr = str(timestamp())
        RESULTS_TXT = Path("/tmp/results.txt").open("w", encoding='utf8')
        OTHER_SH_OUTPUT = Path("/tmp/errors.txt").open("w", encoding='utf8')