def test_03_config_parameters(self): core.skip_ok_unless_installed('gratia-service') core.config['gratia.host'] = core.get_hostname() core.config['gratia.config.dir'] = '/etc/gratia' # The name of the gratia directory changed gratia_version = core.get_package_envra('gratia-service')[2] gratia_version_split = gratia_version.split('.') if self.tuple_cmp(gratia_version_split, ['1', '13', '5']) < 0: core.config['gratia.directory'] = "collector" else: core.config['gratia.directory'] = "services" core.config['certs.httpcert'] = '/etc/grid-security/http/httpcert.pem' core.config['certs.httpkey'] = '/etc/grid-security/http/httpkey.pem' filename = "/tmp/gratia_reader_pass." + str(os.getpid()) + ".txt" contents = "[client]\n" + "password=reader\n" files.write(filename, contents, backup=False) core.config['gratia.sql.file'] = filename core.config['gratia.sql.querystring'] = "\" | mysql --defaults-extra-file=\"" + core.config['gratia.sql.file'] + "\" --skip-column-names -B --unbuffered --user=reader --port=3306" core.config['gratia.tmpdir.prefix'] = "/var/lib/gratia/tmp/gratiafiles/" core.config['gratia.tmpdir.postfix'] = "_" + core.config['gratia.host'] + "_" + core.config['gratia.host'] + "_8880" core.config['gratia.log.file'] = "/var/log/gratia-service/gratia.log" core.state['gratia.log.stat'] = None
def record_cvmfs_version(self): core.state['cvmfs.version'] = tuple() cvmfs_version_string = core.get_package_envra('cvmfs')[2] cvmfs_version = tuple(cvmfs_version_string.split(".")) core.state['cvmfs.version'] = cvmfs_version
def test_01_condor_run_pbs(self): core.skip_ok_unless_installed('condor', 'blahp') core.skip_ok_unless_installed('torque-mom', 'torque-server', 'torque-scheduler', by_dependency=True) self.skip_bad_unless(core.state['jobs.env-set'], 'job environment not set') self.skip_bad_unless(service.is_running('condor'), 'condor not running') self.skip_bad_unless(service.is_running('pbs_server'), 'pbs not running') command = ('condor_run', '-u', 'grid', '-a', 'grid_resource=pbs', '-a', 'periodic_remove=JobStatus==5', '/bin/env') # Figure out whether the installed BLAHP package is the same as or later # than "blahp-1.18.11.bosco-4.osg*" (in the RPM sense), because it's the # first build in which the job environments are correctly passed to PBS. # The release following "osg" does not matter and it is easier to ignore # the OS major version. This code may be a useful starting point for a # more general library function. blahp_envra = core.get_package_envra('blahp') blahp_pbs_has_env_vars = (rpm.labelCompare( ['blahp', '1.18.11.bosco', '4.osg'], blahp_envra[1:4]) <= 0) self.run_job_in_tmp_dir(command, 'condor_run a Condor job', verify_environment=blahp_pbs_has_env_vars)
def test_03_config_parameters(self): core.skip_ok_unless_installed('gratia-service') core.config['gratia.host'] = core.get_hostname() core.config['gratia.config.dir'] = '/etc/gratia' # The name of the gratia directory changed gratia_version = core.get_package_envra('gratia-service')[2] gratia_version_split = gratia_version.split('.') if self.tuple_cmp(gratia_version_split, ['1', '13', '5']) < 0: core.config['gratia.directory'] = "collector" else: core.config['gratia.directory'] = "services" core.config['certs.httpcert'] = '/etc/grid-security/http/httpcert.pem' core.config['certs.httpkey'] = '/etc/grid-security/http/httpkey.pem' filename = "/tmp/gratia_reader_pass." + str(os.getpid()) + ".txt" contents = "[client]\n" + "password=reader\n" files.write(filename, contents, backup=False) core.config['gratia.sql.file'] = filename core.config['gratia.sql.querystring'] = "\" | mysql --defaults-extra-file=\"" + core.config['gratia.sql.file'] + "\" --skip-column-names -B --unbuffered --user=reader --port=3306" core.config['gratia.tmpdir.prefix'] = "/var/lib/gratia/tmp/gratiafiles/" core.config['gratia.tmpdir.postfix'] = "_" + core.config['gratia.host'] + "_" + core.config['gratia.host'] + "_8880" core.config['gratia.log.file'] = "/var/log/gratia-service/gratia.log" core.state['gratia.log.stat'] = None
def test_03_show_gratia_database_tables(self): core.skip_ok_unless_installed('gratia-service') command = "echo \"use gratia_osgtest;show tables;" + core.config['gratia.sql.querystring'] + "| wc -l", gratia_version = tuple(map(int, core.get_package_envra('gratia-service')[2].split('.'))) if gratia_version >= (1, 16, 3): expected_table_count = '82' else: expected_table_count = '81' self.assertEqual(True, self.isProbeDataValidInDatabase(command, 'Unable to install Gratia Database.', expected_table_count), 'Unable to install Gratia Database.')
def lockfile_path(): """The path to the condor lockfile (EL5 and EL6 only) Returns None on EL7. """ if core.el_release() >= 7: return None condor_lockfile = '/var/lock/subsys/condor_master' # The name of the lockfile changed in 7.8.8 if core.rpm_is_installed('condor'): condor_version = core.get_package_envra('condor')[2] condor_version_split = condor_version.split('.') if condor_version_split >= ['7', '8', '8']: condor_lockfile = '/var/lock/subsys/condor' return condor_lockfile
def test_03_show_gratia_database_tables(self): core.skip_ok_unless_installed('gratia-service') command = "echo \"use gratia_osgtest;show tables;" + core.config[ 'gratia.sql.querystring'] + "| wc -l", gratia_version = tuple( map(int, core.get_package_envra('gratia-service')[2].split('.'))) if gratia_version >= (1, 16, 3): expected_table_count = '82' else: expected_table_count = '81' self.assertEqual( True, self.isProbeDataValidInDatabase( command, 'Unable to install Gratia Database.', expected_table_count), 'Unable to install Gratia Database.')
def is_installed(): """Return True if the dependencies for setting up and using VOMS are installed. EL7 requires a minimum version of the voms-server package to get the service file fix from SOFTWARE-2357. """ for dep in 'voms-server', 'voms-clients', 'voms-mysql-plugin', mysql.client_rpm(), mysql.server_rpm(): if not core.dependency_is_installed(dep): return False # TODO: drop this check when 3.3 is completely EOL if core.el_release() >= 7: epoch, _, version, release, _ = core.get_package_envra('voms-server') if core.version_compare((epoch, version, release), '2.0.12-3.2') < 0: core.log_message("voms-server installed but too old (missing SOFTWARE-2357 fix)") return False return True
def is_installed(): """Return True if the dependencies for setting up and using VOMS are installed. EL7 requires a minimum version of the voms-server package to get the service file fix from SOFTWARE-2357. """ for dep in 'voms-server', 'voms-clients', 'voms-mysql-plugin', mysql.client_rpm( ), mysql.server_rpm(): if not core.dependency_is_installed(dep): return False # TODO: drop this check when 3.3 is completely EOL if core.el_release() >= 7: epoch, _, version, release, _ = core.get_package_envra('voms-server') if core.version_compare((epoch, version, release), '2.0.12-3.2') < 0: core.log_message( "voms-server installed but too old (missing SOFTWARE-2357 fix)" ) return False return True
def test_04_condor_run_pbs(self): core.skip_ok_unless_installed('condor', 'blahp', 'torque-mom', 'torque-server', 'torque-scheduler', 'globus-gatekeeper') self.skip_bad_unless(core.state['globus-gatekeeper.running'], 'gatekeeper not running') self.skip_bad_unless(core.state['jobs.env-set'], 'job environment not set') self.skip_bad_unless(core.state['condor.running-service'], 'condor not running') self.skip_bad_unless(core.state['torque.pbs-mom-running'] and core.state['torque.pbs-server-running'], 'pbs not running') command = ('condor_run', '-u', 'grid', '-a', 'grid_resource=pbs', '-a', 'periodic_remove=JobStatus==5', '/bin/env') # Figure out whether the installed BLAHP package is the same as or later # than "blahp-1.18.11.bosco-4.osg*" (in the RPM sense), because it's the # first build in which the job environments are correctly passed to PBS. # The release following "osg" does not matter and it is easier to ignore # the OS major version. This code may be a useful starting point for a # more general library function. blahp_envra = core.get_package_envra('blahp') blahp_pbs_has_env_vars = (rpm.labelCompare(['blahp', '1.18.11.bosco', '4.osg'], blahp_envra[1:4]) <= 0) self.run_job_in_tmp_dir(command, 'condor_run a Condor job', verify_environment=blahp_pbs_has_env_vars)