def main(): if len(sys.argv) == 2: installer = Installer() installer.install(separate_hook(sys.argv[1]), sys.argv[1]) else: print 'invailed argments' quit()
def ites(args): es = Elasticsearch(args.offline_dir, args.url) # create a running instance of Elasticsearch if needed if args.url is None: es_reset = args.es_full_reset or args.es_reset if es_reset: es_dir = os.path.abspath(es_reset) es.reset(es_dir, args.es_full_reset is not None) else: assert(args.root_dir) root_dir = os.path.abspath(args.root_dir) if not args.version: toks = args.driver.split("-") for i in range(3, len(toks)): if re.match("\d+\.\d+\.\d+", toks[-i]): version = "-".join(toks[len(toks) - i : -2]) else: version = args.version if not version: raise Exception("failed to determine Elasticsearch version to test against (params: driver: %s, " "version: %s)" % (args.driver, args.version)) es.spawn(version, root_dir, args.ephemeral) elif not es.is_listening(): raise Exception("no running prestaged Elasticsearch instance found.") else: print("Using pre-staged Elasticsearch.") # add test data into it if args.reindex or not (args.skip_indexing and args.skip_tests): if args.skip_indexing_tests: test_mode = TestData.MODE_NODATA elif args.skip_indexing: test_mode = TestData.MODE_NOINDEX elif args.reindex: test_mode = TestData.MODE_REINDEX else: test_mode = TestData.MODE_INDEX data = TestData(es, test_mode, args.offline_dir) data.load() # install the driver if args.driver: driver_path = os.path.abspath(args.driver) installer = Installer(driver_path) installer.install(args.ephemeral) # run the tests if not args.skip_tests: assert(data is not None) cluster_name = es.cluster_name() assert(len(cluster_name)) if args.dsn: Testing(es, data, cluster_name, args.dsn).perform() else: Testing(es, data, cluster_name, "Packing=JSON;Compression=on;").perform() Testing(es, data, cluster_name, "Packing=CBOR;Compression=off;").perform()
def prepare_build(self, binary): ''' Prepare the build for the test run ''' if self.options.install is not None: self.options.folder = Installer().install(binary, self.options.install) self.options.binary = self.options.folder + self.app_binary[sys.platform] else: folder = os.path.dirname(binary) self.options.folder = folder if not os.path.isdir(binary) else binary self.options.binary = binary
def ites(args): es = Elasticsearch(args.offline_dir) # create a running instance of Elasticsearch if needed if not args.pre_staged: if args.es_reset: es_dir = os.path.abspath(args.es_reset) es.reset(es_dir) else: assert (args.root_dir) root_dir = os.path.abspath(args.root_dir) if not args.version: toks = args.driver.split("-") for i in range(3, len(toks)): if re.match("\d+\.\d+\.\d+", toks[-i]): version = "-".join(toks[len(toks) - i:-2]) else: version = args.version if not version: raise Exception( "failed to determine Elasticsearch version to test against (params: driver: %s, " "version: %s)" % (args.driver, args.version)) es.spawn(version, root_dir, args.ephemeral) elif not es.is_listening(Elasticsearch.AUTH_PASSWORD): raise Exception("no running prestaged Elasticsearch instance found.") else: print("Using pre-staged Elasticsearch.") # add test data into it if args.reindex or not (args.skip_indexing and args.skip_tests): if args.skip_indexing: test_mode = TestData.MODE_NOINDEX elif args.reindex: test_mode = TestData.MODE_REINDEX else: test_mode = TestData.MODE_INDEX data = TestData(test_mode, args.offline_dir) data.load() # install the driver if args.driver: driver_path = os.path.abspath(args.driver) installer = Installer(driver_path) installer.install(args.ephemeral) # run the tests if not args.skip_tests: assert (data is not None) tests = Testing(data, args.dsn) tests.perform()
def test_Installer_methods(self): "Test various methods of the Installer class." installer = Installer(self.versions_txt, site=self.site) self.assertEqual( installer.stack_dir, '/nfs/farm/g/lsst/u1/software/redhat6-x86_64-64bit-gcc44/DMstack/v12_0' ) package_name = 'metrology-data-analysis' self.assertEqual(installer._env_var(package_name), 'METROLOGYDATAANALYSISDIR') self.assertEqual(installer._eups_config(), 'setup eotest\n') self.assertEqual( installer._schema_paths(), 'export LCATR_SCHEMA_PATH=${HARNESSEDJOBSDIR}/schemas:${LCATR_SCHEMA_PATH}\n' ) self.assertEqual( installer._jh_config(), '''export HARNESSEDJOBSDIR=${INST_DIR}/harnessed-jobs-0.3.49-slac export VIRTUAL_ENV=${INST_DIR} source ${INST_DIR}/Modules/3.2.10/init/bash export PATH=${INST_DIR}/bin:${PATH} export SITENAME=%s ''' % self.site) with warnings.catch_warnings(): warnings.filterwarnings('ignore') self.assertEqual( installer._python_configs(), '''export DATACATDIR=/afs/slac/u/gl/srs/datacat/dev/0.4/lib export DATACAT_CONFIG=/nfs/farm/g/lsst/u1/software/datacat/config.cfg export PYTHONPATH=${OFFLINEJOBSDIR}/python:${METROLOGYDATAANALYSISDIR}/python:${DATACATDIR}:${HARNESSEDJOBSDIR}/python::${PYTHONPATH} export MPLBACKEND=Agg ''') self.assertEqual( installer._package_env_vars(), '''export OFFLINEJOBSDIR=${INST_DIR}/offline-jobs-0.0.16 export METROLOGYDATAANALYSISDIR=${INST_DIR}/metrology-data-analysis-0.0.10 ''') self.assertEqual(set(installer.package_dirs.keys()), set(('metrology-data-analysis', 'offline-jobs')))
def main(): options = get_options() if options.install: Installer() return None local_conf = ConfigurationFolder(conf.CONFIGURATION_DIRECTORY) remote_conf = ConfigurationFolder(conf.REQUISITORY_LOCATION) if options.rm is not None: local_conf.remove_files(options.rm) remote_conf.remove_files(options.rm) return 0 elif options.status: return DiffTool(local_conf, remote_conf).display_diff() elif options.load: dest_config = local_conf src_config = remote_conf elif options.save: dest_config = remote_conf src_config = local_conf moved_files = src_config.retrieve_files() dest_config.save_files(moved_files, src_config.directory) return 0
def cleanup_build(self): # Always remove the build when it has been installed if self.options.install: Installer().uninstall(self.options.folder)