def check_data_impl_sh(self, arangosh): """ check for data on the installation """ if self.has_makedata_data: success = arangosh.check_test_data(self.name) if not success[0]: if not self.cfg.verbose: print(success[1]) eh.ask_continue_or_exit( "has data failed for {0.name}".format(self), self.basecfg.interactive, False)
def js_set_passvoid(self, user, passvoid): """connect to the instance, and set a passvoid for the user""" js_set_passvoid_str = 'require("org/arangodb/users").update("%s", "%s");' % ( user, passvoid, ) logging.debug("script to be executed: " + str(js_set_passvoid_str)) res = self.run_command(["set passvoid", js_set_passvoid_str], self.cfg.verbose) logging.debug("set passvoid check result: " + str(res)) if not res: eh.ask_continue_or_exit("setting passvoid failed", self.cfg.interactive) return res
def hotbackup_create_nonbackup_data(self): """ create a collection with documents after taking a backup to verify its not in the backup """ logging.info("creating volatile testdata") js_script_string = """ db._create("this_collection_will_not_be_backed_up"); db.this_collection_will_not_be_backed_up.save( {"this": "document will be gone"}); """ logging.debug("script to be executed: " + str(js_script_string)) res = self.run_command(["create volatile data", js_script_string], True) # self.cfg.verbose) logging.debug("data create result: " + str(res)) if not res: eh.ask_continue_or_exit("creating volatile testdata failed", self.cfg.interactive) return res
def js_version_check(self): """run a version check command; this can double as password check""" logging.info("running version check") semdict = dict(self.cfg.semver.to_dict()) version = "{major}.{minor}.{patch}".format(**semdict) js_script_string = """ const version = db._version().substring(0, {1}); if (version != "{0}") {{ throw `version check failed: ${{version}} (current) !- {0} (requested)` }} """.format( version, len(version) ) logging.debug("script to be executed: " + str(js_script_string)) res = self.run_command(["check version", js_script_string], self.cfg.verbose) logging.debug("version check result: " + str(res)) if not res: eh.ask_continue_or_exit("version check failed", self.cfg.interactive) return res
def make_data_impl(self): """ upload testdata into the deployment, and check it """ assert self.makedata_instances logging.debug("makedata instances") for i in self.makedata_instances: logging.debug(str(i)) interactive = self.basecfg.interactive for starter in self.makedata_instances: assert starter.arangosh arangosh = starter.arangosh #must be writabe that the setup may not have already data if not arangosh.read_only and not self.has_makedata_data: success = arangosh.create_test_data(self.name) if not success[0]: if not self.cfg.verbose: print(success[1]) eh.ask_continue_or_exit( "make data failed for {0.name}".format(self), interactive, False) self.has_makedata_data = True self.check_data_impl_sh(arangosh)