Пример #1
0
    def test_04_modify_bestman_conf(self):
        core.skip_ok_unless_installed('bestman2-server', 'bestman2-client',
                                      'gums-service')

        bestman_rc_path = '/etc/bestman2/conf/bestman2.rc'
        old_port = 'securePort=8443'
        new_port = 'securePort=10443'
        files.replace(bestman_rc_path, old_port, new_port, backup=False)
        old_gridmap = 'GridMapFileName=/etc/bestman2/conf/grid-mapfile.empty'
        new_gridmap = 'GridMapFileName=/etc/grid-security/grid-mapfile'
        files.replace(bestman_rc_path, old_gridmap, new_gridmap, backup=False)
        files.replace(bestman_rc_path,
                      'eventLogLevel=INFO',
                      'eventLogLevel=DEBUG',
                      backup=False)
        core.system(('cat', bestman_rc_path))

        env_file = '/etc/sysconfig/bestman2'
        old_auth = 'BESTMAN_GUMS_ENABLED=yes'
        new_auth = 'BESTMAN_GUMS_ENABLED=no'
        files.replace(env_file, old_auth, new_auth, backup=False)

        log4j_path = '/etc/bestman2/properties/log4j.properties'
        log4j_contents = files.read(log4j_path, as_single_string=True)
        log4j_contents = log4j_contents.replace('FATAL', 'INFO')
        files.write(log4j_path, log4j_contents, backup=False)
Пример #2
0
 def test_09_copy_glexec_logs(self):
     core.skip_ok_unless_installed('gratia-probe-glexec', 'gratia-service')
     core.state['gratia.glexec-logs-copied'] = False
     glexec_log = '/usr/share/osg-test/gratia/glexec.log'
     dst_dir = '/var/log'
     self.assert_(self.copy_probe_logs(glexec_log, dst_dir), "glexec log copy failed.")
     core.state['gratia.glexec-logs-copied'] = True
Пример #3
0
 def test_28_copy_sge_logs(self):
     core.skip_ok_unless_installed('gratia-probe-sge', 'gratia-service')
     core.state['gratia.sge-logs-copied'] = False
     sge_log = '/usr/share/osg-test/gratia/accounting'
     dst_dir = '/var/log'
     self.assert_(self.copy_probe_logs(sge_log, dst_dir), "sge log copy failed.")
     core.state['gratia.sge-logs-copied'] = True
Пример #4
0
    def test_02_restore_config(self):
        core.skip_ok_unless_installed('condor', 'htcondor-ce', 'htcondor-ce-client')

        files.restore(core.config['condor-ce.condor-cfg'], 'condor-ce')
        files.restore(core.config['condor-ce.condor-ce-cfg'], 'condor-ce')
        if core.options.hostcert:
            files.restore(core.config['condor-ce.condorce_mapfile'], 'condor-ce')
Пример #5
0
    def test_01_xrdcp_local_to_server(self):
        core.skip_ok_unless_installed('xrootd', 'xrootd-client', by_dependency=True)
        if core.config['xrootd.gsi'] == "ON":
            core.skip_ok_unless_installed('globus-proxy-utils')
        self.skip_bad_unless(core.state['xrootd.started-server'] is True, 'Server not running')
        temp_dir = "/tmp/vdttest"
        hostname = socket.getfqdn()
        if core.config['xrootd.gsi'] == "ON":
            if not os.path.exists(temp_dir):
                os.mkdir(temp_dir)
                user = pwd.getpwnam(core.options.username)
                os.chown(temp_dir, user[2], user[3])
        else:
            temp_dir = tempfile.mkdtemp()
        os.chmod(temp_dir, 0o777)
        xrootd_url = 'root://%s:%d/%s/copied_file.txt' % (hostname, core.config['xrootd.port'], temp_dir)
        command = ('xrdcp', '--debug', '3', TestXrootd.__data_path, xrootd_url)

        status, stdout, stderr = core.system(command, user=True)

        fail = core.diagnose('xrdcp copy, local to URL',
                             command, status, stdout, stderr)
        file_copied = os.path.exists(os.path.join(temp_dir, 'copied_file.txt'))
        if core.config['xrootd.multiuser'] != "ON":
            shutil.rmtree(temp_dir)
        self.assertEqual(status, 0, fail)
        self.assert_(file_copied, 'Copied file missing')
Пример #6
0
    def test_06_voms_proxy_direct(self):
        core.state['voms.got-proxy'] = False
        core.skip_ok_unless_installed("voms-clients-cpp", by_dependency=True)
        # ^^ voms-proxy-direct is only in (our) voms-clients-cpp

        voms.proxy_direct()
        core.state['voms.got-proxy'] = True
Пример #7
0
    def test_02_cvmfs(self):
        core.skip_ok_unless_installed('cvmfs')
        core.skip_ok_unless_installed('cvmfs-keys', by_dependency=True)
        core.state['cvmfs.mounted'] = False

        command = ('ls', '/cvmfs')
        status, stdout, stderr = core.system(command, False)
        file_exists = os.path.exists('/cvmfs')
        self.assert_(file_exists, 'Cvmfs mount point missing')
        core.state['cvmfs.mounted'] = True

        cern_repo = 'cms.cern.ch'
        command = ('ls', '/cvmfs/' + cern_repo)
        status, stdout, stderr = core.system(command, False)

        # If the previous command failed, output better debug info
        if status != 0:
            self.debug_cvmfs(cern_repo)

        command = ('ls', self.__check_path)
        status, stdout, stderr = core.system(command, False)
        self.assert_(file_exists, 'Test cvmfs file missing')

        command = ('bash', '-c', 'source ' + self.__check_path)
        status, stdout, stderr = core.system(command, False)
        fail = core.diagnose('cvmfs example source a file on fs',
                             command, status, stdout, stderr)
        self.assertEqual(status, 0, fail)
Пример #8
0
    def test_01_request_condor_write_scitoken(self):
        core.state['token.condor_write_created'] = False
        core.config['token.condor_write'] = '/tmp/condor_write.scitoken'

        core.skip_ok_unless_installed('htcondor-ce', 'condor')
        self.skip_ok_if(
            core.PackageVersion('condor') <= '8.9.4',
            'HTCondor version does not support SciToken submission')
        self.skip_ok_if(os.path.exists(core.config['token.condor_write']),
                        'SciToken with HTCondor WRITE already exists')

        hostname = core.get_hostname()
        try:
            token = request_demo_scitoken('condor:/READ condor:/WRITE',
                                          audience=f'{hostname}:9619')
        except error.URLError as exc:
            self.fail(
                f"Failed to request token from demo.scitokens.org:\n{exc}")

        ids = (0, 0)
        if core.state['user.verified']:
            user = pwd.getpwnam(core.options.username)
            ids = (user.pw_uid, user.pw_gid)

        files.write(core.config['token.condor_write'],
                    core.to_str(token),
                    backup=False,
                    chown=ids)
        core.state['token.condor_write_created'] = True
Пример #9
0
    def test_01_configure_xrootd(self):
        core.config['xrootd.tpc.config-1'] = '/etc/xrootd/xrootd-third-party-copy-1.cfg'
        core.config['xrootd.tpc.config-2'] = '/etc/xrootd/xrootd-third-party-copy-2.cfg'
        core.config['xrootd.tpc.basic-config'] = '/etc/xrootd/config.d/36-osg-test-tpc.cfg'
        core.state['xrootd.started-http-server-1'] = False
        core.state['xrootd.started-http-server-2'] = False
        core.state['xrootd.tpc.backups-exist'] = False

        self.skip_ok_unless(core.options.adduser, 'user not created')
        core.skip_ok_unless_installed('globus-proxy-utils', by_dependency=True)

        user = pwd.getpwnam("xrootd")

        files.write(core.config['xrootd.tpc.config-1'],
                     XROOTD_CFG_TEXT,
                     owner='xrootd', backup=True, chown=(user.pw_uid, user.pw_gid))
        files.write(core.config['xrootd.tpc.config-2'],
                     XROOTD_CFG_TEXT,
                     owner='xrootd', backup=True, chown=(user.pw_uid, user.pw_gid))
        files.write('/etc/xrootd/config.d/40-osg-standalone.cfg', XROOTD_STANDALONE_TXT,
                     owner='xrootd', backup=True, chown=(user.pw_uid, user.pw_gid))
        files.write(core.config['xrootd.tpc.basic-config'],
                     XROOTD_MACAROON_TXT,
                     owner='xrootd', backup=True, chown=(user.pw_uid, user.pw_gid))

        core.state['xrootd.tpc.backups-exist'] = True
Пример #10
0
    def test_01_create_macaroons(self):
        core.config['xrootd.tpc.macaroon-1'] = None
        core.config['xrootd.tpc.macaroon-2'] = None
        core.skip_ok_unless_installed('x509-scitokens-issuer-client', by_dependency=True)
        self.skip_bad_unless(core.state['proxy.valid'], 'requires a proxy cert')
        uid = pwd.getpwnam(core.options.username)[2]
        usercert = '/tmp/x509up_u%d' % uid
        userkey = '/tmp/x509up_u%d' % uid
        
        core.config['xrootd.tpc.url-1'] = "https://" + core.get_hostname() + ":9001" + "/usr/share/osg-test/test_gridftp_data.txt".strip()
        command = ('macaroon-init', core.config['xrootd.tpc.url-1'], '20', 'ALL')

        status, stdout, stderr = core.system(command, user=True)
        fail = core.diagnose('Obtain Macaroon 1',
                             command, status, stdout, stderr)
        self.assertEqual(status, 0, fail)
        core.config['xrootd.tpc.macaroon-1'] = stdout.strip()

        core.config['xrootd.tpc.url-2'] = "https://" + core.get_hostname() + ":9002" + "/tmp/test_gridftp_data_tpc.txt".strip()
        command = ('macaroon-init', core.config['xrootd.tpc.url-2'], '20', 'ALL')
        status, stdout, stderr = core.system(command, user=True)
        fail = core.diagnose('Obtain Macaroon 2',
                             command, status, stdout, stderr)
        self.assertEqual(status, 0, fail)
        core.config['xrootd.tpc.macaroon-2'] = stdout.strip()
Пример #11
0
    def test_04_copy_server_to_local_uberftp_parallel(self):
        core.skip_ok_unless_installed(*self.required_rpms)
        self.skip_bad_unless(core.state['gridftp.running-server'] is True,
                             'GridFTP not running')

        hostname = socket.getfqdn()
        temp_dir_source = tempfile.mkdtemp()
        temp_dir_dest = tempfile.mkdtemp()
        os.chmod(temp_dir_source, 0777)
        os.chmod(temp_dir_dest, 0777)
        filename = 'testfile_10MB'
        full_path = (os.path.join(temp_dir_source, filename))
        command = ('dd', 'if=/dev/zero', 'of=' + full_path, 'bs=10485760',
                   'count=1')
        core.check_system(command, 'Create test file with dd', user=True)

        ftp_cmd = ('cd %s; lcd %s; get %s' %
                   (temp_dir_source, temp_dir_dest, filename))
        command = ('uberftp', '-parallel', '10', hostname, ftp_cmd)
        status, stdout, stderr = core.system(command, True)
        fail = core.diagnose('UberFTP copy, local to URL', command, status,
                             stdout, stderr)
        file_copied = os.path.exists(os.path.join(temp_dir_dest, filename))
        shutil.rmtree(temp_dir_source)
        shutil.rmtree(temp_dir_dest)
        self.assertEqual(status, 0, fail)
        self.assert_(file_copied, 'Copied file missing')
Пример #12
0
    def test_02_scitoken_mapping(self):
        core.state['condor-ce.wrote-mapfile'] = False
        core.skip_ok_unless_installed('condor', 'htcondor-ce')
        self.skip_ok_if(
            core.PackageVersion('condor') <= '8.9.4',
            'HTCondor version does not support SciToken submission')

        condorce_version = core.PackageVersion('htcondor-ce')
        scitoken_mapping = 'SCITOKENS {issuer} {local_user}\n'

        # Write the mapfile to the admin mapfile directory with the regex format for the issuer
        # required by 'CERTIFICATE_MAPFILE_ASSUME_HASH_KEYS = True'
        # https://github.com/htcondor/htcondor-ce/pull/425
        if condorce_version >= '5.1.0':
            match_str = r'/https:\/\/demo.scitokens.org,.*/'
            core.config[
                'condor-ce.mapfile'] = '/etc/condor-ce/mapfiles.d/01-osg-test.conf'
        else:
            match_str = '"https://demo.scitokens.org"'
            core.config['condor-ce.mapfile'] = '/etc/condor-ce/condor_mapfile'
            mapfile_contents = files.read(core.config['condor-ce.mapfile'],
                                          as_single_string=True)
            scitoken_mapping += mapfile_contents

        files.write(core.config['condor-ce.mapfile'],
                    scitoken_mapping.format(issuer=match_str,
                                            local_user=core.options.username),
                    owner='condor-ce',
                    chmod=0o644)
        core.state['condor-ce.wrote-mapfile'] = True
Пример #13
0
    def test_04_start_condorce(self):
        if core.el_release() >= 7:
            core.config[
                'condor-ce.lockfile'] = '/var/lock/condor-ce/htcondor-ceLock'
        else:
            core.config['condor-ce.lockfile'] = '/var/lock/subsys/condor-ce'
        core.state['condor-ce.started-service'] = False
        core.state['condor-ce.schedd-ready'] = False

        core.skip_ok_unless_installed('condor', 'htcondor-ce',
                                      'htcondor-ce-client')
        core.config['condor-ce.collectorlog'] = condor.ce_config_val(
            'COLLECTOR_LOG')

        if service.is_running('condor-ce'):
            core.state['condor-ce.schedd-ready'] = True
            self.skip_ok('already running')

        stat = core.get_stat(core.config['condor-ce.collectorlog'])

        service.check_start('condor-ce', timeout=20)

        if condor.wait_for_daemon(core.config['condor-ce.collectorlog'], stat,
                                  'Schedd', 300.0):
            core.state['condor-ce.schedd-ready'] = True
Пример #14
0
 def setUp(self):
     self.skip_ok_unless(core.state['proxy.created']
                         or core.state['voms.got-proxy'])
     core.skip_ok_unless_installed('bestman2-server', 'bestman2-client',
                                   'gums-service')
     self.skip_bad_unless(core.state['bestman.server-running'],
                          'bestman server not running')
Пример #15
0
    def test_03_xrootd_fuse(self):
        # This tests xrootd-fuse using a mount in /mnt
        core.skip_ok_unless_installed('xrootd', 'xrootd-client', by_dependency=True)
        self.skip_ok_unless(os.path.exists("/mnt"), "/mnt did not exist")
        self.skip_ok_if(core.config['xrootd.gsi'] == "ON", 'fuse incompatible with GSI')

        if not os.path.exists(TestXrootd.__fuse_path):
            os.mkdir(TestXrootd.__fuse_path)
        hostname = socket.getfqdn()
        #command = ('xrootdfs',TestXrootd.__fuse_path,'-o','rdr=xroot://localhost:1094//tmp','-o','uid=xrootd')
        command = ('mount', '-t', 'fuse', '-o', 'rdr=xroot://localhost:1094//tmp,uid=xrootd', 'xrootdfs',
                   TestXrootd.__fuse_path)
        command_str = ' '.join(command)

        #For some reason, sub process hangs on fuse processes, use os.system
        #status, stdout, stderr = core.system(command_str,shell=True)
        os.system(command_str)

        # Copy a file in and see if it made it into the fuse mount
        xrootd_url = 'root://%s/%s/copied_file.txt' % (hostname, "/tmp")
        command = ('xrdcp', '--debug', '3', TestXrootd.__data_path, xrootd_url)
        core.system(command, user=True)

        command = ('ls', "/tmp/copied_file.txt")
        core.check_system(command, "Checking file is copied to xrootd fuse mount correctly", user=True)


        command = ('umount', TestXrootd.__fuse_path)
        core.system(command)
        os.rmdir(TestXrootd.__fuse_path)
        files.remove("/tmp/copied_file.txt")
Пример #16
0
    def test_02_osg_version(self):
        core.skip_ok_unless_installed('osg-version')

        command = ('osg-version',)

        # First we verify that osg-version runs
        stdout = core.check_system(command, 'osg-version')[0]

        # Then we pull out the version number from the output
        version_pattern = re.compile(r'(\d+\.\d+\.\d+)')
        matches = version_pattern.search(stdout)

        # Is there a version number?
        self.assert_(matches is not None)
        osg_version = matches.group(1)

        # Get the version number from the RPM
        command = ('rpm', '-q', 'osg-version')
        stdout = core.check_system(command, "osg-version RPM version")[0]
        matches = version_pattern.search(stdout)
        self.assert_(matches is not None)

        # Verify that the versions match
        osg_version_rpm_version = matches.group(1)
        self.assert_(osg_version == osg_version_rpm_version)
Пример #17
0
 def test_02_setup_selinux_port(self):
     if not core.state['selinux.mode']:
         self.skip_ok('SELinux disabled')
     core.skip_ok_unless_installed('policycoreutils-python')
     port = core.config['gsisshd.port']
     core.check_system(['semanage', 'port', '--add', '-t', 'ssh_port_t', '--proto', 'tcp', port],
                       message="Allow [gsi]sshd to use port %s" % port)
Пример #18
0
    def test_01_web100clt(self):
        core.skip_ok_unless_installed('ndt-client')

        command = ('web100clt', '-v')
        stdout = core.check_system(command, 'NDT client')[0]
        self.assert_(re.search('ndt.+version', stdout, re.IGNORECASE)
                     is not None)
Пример #19
0
    def test_01_backup_mysql(self):
        if not core.options.backupmysql:
            return

        core.skip_ok_unless_installed(mysql.client_rpm(), mysql.server_rpm())
        core.config['mysql.datadir'] = None
        core.config['mysql.backup'] = None

        mysql.start() # Need mysql up to determine its datadir

        command = ('mysql', '-sNe', "SHOW VARIABLES where Variable_name='datadir';")
        mysql_cfg = core.check_system(command, 'dump mysql config')[0]
        core.config['mysql.datadir'] = re.match('datadir\s*(.+?)\/\s*$', mysql_cfg).group(1)
        self.assert_(core.config['mysql.datadir'] is not None, 'could not extract MySQL datadir')

        # Backup the old mysql folder
        mysql.stop()
        backup = core.config['mysql.datadir'] + '-backup'
        self.assert_(not os.path.exists(backup), 'mysql-backup already exists')
        try:
            shutil.move(core.config['mysql.datadir'], backup)
        except IOError, e:
            if e.errno == 2:
                # Folder doesn't exist so we don't have to worry about backups
                pass
Пример #20
0
 def test_06_execute_gridftptransfer_probedriver(self):
     core.state['gratia.gridftp-transfer-running'] = False
     core.skip_ok_unless_installed('gratia-probe-gridftp-transfer',
                                   'gratia-service',
                                   'globus-gridftp-server-progs',
                                   'globus-ftp-client',
                                   'globus-proxy-utils',
                                   'globus-gass-copy-progs')
     self.skip_ok_unless(core.state['gridftp.started-server'],
                         'gridftp server not running')
     self.skip_bad_unless(core.state['gratia.gridftp-logs-copied'],
                          'gridftp logs not copied')
     if os.path.exists(core.config['gratia.log.file']):
         core.state['gratia.log.stat'] = core.get_stat(
             core.config['gratia.log.file'])
         core.log_message('stat.st_ino is: ' +
                          str(core.state['gratia.log.stat'].st_ino))
         core.log_message('stat.st_size is: ' +
                          str(core.state['gratia.log.stat'].st_size))
     if core.package_version_compare('gratia-probe-gridftp-transfer',
                                     '1.17.0-1') >= 0:
         probe_script = 'gridftp-transfer_meter'
     else:
         probe_script = 'GridftpTransferProbeDriver'
     command = ('/usr/share/gratia/gridftp-transfer/%s' % probe_script, )
     core.check_system(command, 'Unable to execute %s.' % probe_script)
     core.config['gratia.gridftp-temp-dir'] = core.config['gratia.tmpdir.prefix'] + "subdir.gridftp-transfer" + \
                                              core.config['gratia.tmpdir.postfix']
     if core.state['gratia.database-installed'] == True:
         result = self.isProbeOutboxDirEmpty(
             core.config['gratia.gridftp-temp-dir'])
         self.assert_(result, 'gridftp-transfer outbox check failed.')
     core.state['gratia.gridftp-transfer-running'] = True
Пример #21
0
    def test_05_start_pbs(self):
        core.state['pbs_server.started-service'] = False
        core.state['torque.nodes-up'] = False

        core.skip_ok_unless_installed(*self.required_rpms, by_dependency=True)
        self.skip_bad_unless(service.is_running('trqauthd'), 'pbs_server requires trqauthd')
        self.skip_ok_if(service.is_running('pbs_server'), 'pbs server already running')

        server_log = '/var/log/torque/server_logs/' + date.today().strftime('%Y%m%d')
        try:
            server_log_stat = os.stat(server_log)
        except OSError:
            server_log_stat = None

        service.check_start('pbs_server')

        # Wait until the server is up before writing the rest of the config
        core.monitor_file(server_log, server_log_stat, '.*Server Ready.*', 60.0)
        core.check_system("echo '%s' | qmgr %s" % (self.pbs_config, core.get_hostname()),
                          "Configuring pbs server",
                          shell=True)

        # wait up to 5 minutes for the server to recognize the node
        start_time = time.time()
        while (time.time() - start_time) < 600:
            command = ('/usr/bin/qnodes', '-s', core.get_hostname())
            stdout, _, fail = core.check_system(command, 'Get pbs node info')
            self.assert_(stdout.find('error') == -1, fail)
            if stdout.find('state = free'):
                core.state['torque.nodes-up'] = True
                break
        if not core.state['torque.nodes-up']:
            self.fail('PBS nodes not coming up')
Пример #22
0
    def test_07_checkdatabase_gridftptransfer_probedriver(self):
        core.skip_ok_unless_installed('gratia-probe-gridftp-transfer',
                                      'gratia-service')
        self.skip_bad_if(
            core.state['gratia.gridftp-transfer-running'] == False,
            'gridftp transfer probe not running')

        self.assertEqual(
            True, self.isProbeInfoProcessed('gridftp-transfer'),
            'Sentinel signifying that Probe Information was processed NOT found.'
        )

        command = "echo \"use gratia_osgtest; select sum(Njobs) from MasterTransferSummary;" + \
                  core.config['gratia.sql.querystring'],
        probe_validation_msg = 'Unable to query Gratia Database MasterTransferSummary table'
        self.assertEqual(
            True,
            self.isProbeDataValidInDatabase(command,
                                            probe_validation_msg,
                                            atLeastOneRecord=True),
            'Failed Probe Data Validation in Database.')

        command = "echo \"use gratia_osgtest; select sum(TransferSize) from MasterTransferSummary;" + \
                  core.config['gratia.sql.querystring'],
        self.assertEqual(
            True,
            self.isProbeDataValidInDatabase(command,
                                            probe_validation_msg,
                                            atLeastOneRecord=True),
            'Failed Probe Data Validation in Database.')
Пример #23
0
    def test_01_configure_xrootd(self):
        core.config['xrootd.tpc.config-1'] = '/etc/xrootd/xrootd-third-party-copy-1.cfg'
        core.config['xrootd.tpc.config-2'] = '/etc/xrootd/xrootd-third-party-copy-2.cfg'
        core.config['xrootd.tpc.http-port1'] = HTTP_PORT1
        core.config['xrootd.tpc.http-port2'] = HTTP_PORT2
        core.state['xrootd.started-http-server-1'] = False
        core.state['xrootd.started-http-server-2'] = False
        core.state['xrootd.tpc.backups-exist'] = False

        self.skip_ok_unless(core.options.adduser, 'user not created')
        core.skip_ok_unless_installed('globus-proxy-utils', 'xrootd', 'xrootd-scitokens', by_dependency=True)

        user = pwd.getpwnam("xrootd")

        lcmaps_packages = ('lcmaps', 'lcmaps-db-templates', 'xrootd-lcmaps', 'vo-client', 'vo-client-lcmaps-voms')
        if all([core.rpm_is_installed(x) for x in lcmaps_packages]):
            core.log_message("Using xrootd-lcmaps authentication")
            sec_protocol = '-authzfun:libXrdLcmaps.so -authzfunparms:--loglevel,5'
            sec_protocol += ',--policy,authorize_only'
        else:
            core.log_message("Using XRootD mapfile authentication")
            sec_protocol = '-gridmap:/etc/grid-security/xrd/xrdmapfile'

        files.write(core.config['xrootd.tpc.config-1'],
                     XROOTD_CFG_TEXT % (sec_protocol, core.config['xrootd.tpc.http-port1'], core.config['xrootd.tpc.http-port1']),
                     owner='xrootd', backup=True, chown=(user.pw_uid, user.pw_gid))
        files.write(core.config['xrootd.tpc.config-2'],
                     XROOTD_CFG_TEXT % (sec_protocol, core.config['xrootd.tpc.http-port2'], core.config['xrootd.tpc.http-port2']),
                     owner='xrootd', backup=True, chown=(user.pw_uid, user.pw_gid))
        core.state['xrootd.tpc.backups-exist'] = True
Пример #24
0
    def test_11_checkdatabase_glexec_meter(self):
        core.skip_ok_unless_installed('gratia-probe-glexec', 'gratia-service')
        self.skip_bad_if(core.state['gratia.glexec_meter-running'] == False)

        self.assertEqual(
            True, self.isProbeInfoProcessed('glexec'),
            'Sentinel signifying Probe Information was processed NOT found.')

        command = "echo \"use gratia_osgtest; select Njobs from MasterSummaryData where ProbeName like 'glexec%';" \
                  + core.config['gratia.sql.querystring'],
        self.assertEqual(
            True,
            self.isProbeDataValidInDatabase(
                command,
                'Unable to query Gratia Database MasterSummaryData table.',
                '4'), 'Failed Probe Data Validation in Database.')

        command = "echo \"use gratia_osgtest; select WallDuration from MasterSummaryData where ProbeName like 'glexec%';" \
                  + core.config['gratia.sql.querystring'],
        self.assertEqual(
            True,
            self.isProbeDataValidInDatabase(
                command,
                'Unable to query Gratia Database MasterSummaryData table.',
                '302'), 'Failed Probe Data Validation in Database.')
Пример #25
0
    def test_04_xrootd_fuse(self):
        # This tests xrootd-fuse using a mount in /mnt
        core.skip_ok_unless_installed('xrootd', 'xrootd-client', by_dependency=True)
        self.skip_ok_unless(os.path.exists("/mnt"), "/mnt did not exist")
        self.skip_ok_if(core.config['xrootd.gsi'] == "ON", 'fuse incompatible with GSI')

        if not os.path.exists(TestXrootd.__fuse_path):
            os.mkdir(TestXrootd.__fuse_path)
        hostname = socket.getfqdn()
        #command = ('xrootdfs',TestXrootd.__fuse_path,'-o','rdr=xroot://localhost:1094//tmp','-o','uid=xrootd')
        command = ('mount', '-t', 'fuse', '-o', 'rdr=xroot://localhost:1094//tmp,uid=xrootd', 'xrootdfs',
                   TestXrootd.__fuse_path)
        command_str = ' '.join(command)

        #For some reason, sub process hangs on fuse processes, use os.system
        #status, stdout, stderr = core.system(command_str,shell=True)
        os.system(command_str)

        # Copy a file in and see if it made it into the fuse mount
        xrootd_url = 'root://%s/%s/copied_file.txt' % (hostname, "/tmp")
        command = ('xrdcp', '--debug', '3', TestXrootd.__data_path, xrootd_url)
        core.system(command, user=True)

        command = ('ls', "/tmp/copied_file.txt")
        core.check_system(command, "Checking file is copied to xrootd fuse mount correctly", user=True)


        command = ('umount', TestXrootd.__fuse_path)
        core.system(command)
        os.rmdir(TestXrootd.__fuse_path)
        files.remove("/tmp/copied_file.txt")
Пример #26
0
 def test_18_execute_condor_meter(self):
     core.state['gratia.condor-meter-running'] = False
     core.skip_ok_unless_installed('gratia-probe-condor', 'gratia-service',
                                   'htcondor-ce-condor')
     self.skip_bad_if(core.state['gratia.condor-logs-copied'] == False)
     self.skip_bad_unless(core.state['condor-ce.started-service'],
                          'condor-ce not running')
     self.skip_bad_unless(core.state['condor.running-service'],
                          message='Condor service not running')
     if os.path.exists(core.config['gratia.log.file']):
         core.state['gratia.log.stat'] = core.get_stat(
             core.config['gratia.log.file'])
         core.log_message('stat.st_ino is: ' +
                          str(core.state['gratia.log.stat'].st_ino))
         core.log_message('stat.st_size is: ' +
                          str(core.state['gratia.log.stat'].st_size))
     command = ('/usr/share/gratia/condor/condor_meter', )
     core.check_system(command, 'Unable to execute condor_meter.')
     core.config['gratia.condor-temp-dir'] = core.config['gratia.tmpdir.prefix'] + "subdir.condor" + \
                                             core.config['gratia.tmpdir.postfix']
     if core.state['gratia.database-installed'] == True:
         result = self.isProbeOutboxDirEmpty(
             core.config['gratia.condor-temp-dir'])
         self.assert_(result, 'condor outbox check failed.')
     core.state['gratia.condor-meter-running'] = True
Пример #27
0
    def test_15_checkdatabase_dcache_storage(self):
        core.skip_ok_unless_installed('gratia-probe-dcache-storage', 'gratia-service')
        self.skip_ok_if(core.state['gratia.dcache-whitelisted-error'], 'caught whitelisted error')
        self.skip_bad_unless(core.state['gratia.dcache-storage-running'])

        self.assertEqual(True, self.isProbeInfoProcessed('dCache-storage'),
                         'Sentinel signifying that Probe Information was processed NOT found.')

        command = "echo \"use gratia_osgtest; " + \
                  "select TotalSpace from StorageElementRecord where ProbeName like 'dCache-storage%';" + \
                  core.config['gratia.sql.querystring'],
        status, total_space, _ = core.system(command, shell=True)
        self.assertEqual(status, 0, 'Unable to query Gratia Database TotalSpace from StorageElementRecord table.')

        command = "echo \"use gratia_osgtest; " + \
                  "select FreeSpace from StorageElementRecord where ProbeName like 'dCache-storage%';" + \
                  core.config['gratia.sql.querystring'],
        status, free_space, _ = core.system(command, shell=True)
        self.assertEqual(status, 0, 'Unable to query Gratia Database FreeSpace from StorageElementRecord table.')

        command = "echo \"use gratia_osgtest; " + \
                  "select UsedSpace from StorageElementRecord where ProbeName like 'dCache-storage%';" + \
                  core.config['gratia.sql.querystring'],
        status, used_space, _ = core.system(command, shell=True)
        self.assertEqual(status, 0, 'Unable to query Gratia Database UsedSpace from StorageElementRecord table.')

        #Need to assert only after converting string to long...
        self.assert_(long(total_space) == (long(free_space) + long(used_space)))
Пример #28
0
    def test_19_checkdatabase_condor_meter(self):
        core.skip_ok_unless_installed('gratia-probe-condor', 'gratia-service')
        self.skip_bad_if(core.state['gratia.condor-meter-running'] == False,
                         'Condor-meter is not running.')

        self.assertEqual(
            True, self.isProbeInfoProcessed('condor'),
            'Sentinel signifying that Probe Information was processed NOT found.'
        )

        command = "echo \"use gratia_osgtest; " + \
                  "select sum(Njobs) from MasterSummaryData where ProbeName like 'condor%';" + \
                  core.config['gratia.sql.querystring'],
        self.assertEqual(
            True,
            self.isProbeDataValidInDatabase(
                command,
                'Unable to query Gratia Database Njobs from MasterSummaryData table.',
                atLeastOneRecord=True),
            'Failed Probe Data Validation in Database.')

        command = "echo \"use gratia_osgtest; " + \
                  "select sum(WallDuration) from MasterSummaryData where ProbeName like 'condor%';" + \
                  core.config['gratia.sql.querystring'],
        self.assertEqual(
            True,
            self.isProbeDataValidInDatabase(
                command,
                'Unable to query WallDuration from MasterSummaryData table.',
                atLeastOneRecord=True),
            'Failed Probe Data Validation in Database.')
Пример #29
0
 def test_05_pbs_trace(self):
     self.general_requirements()
     self.skip_bad_unless(core.state['condor-ce.schedd-ready'], 'CE schedd not ready to accept jobs')
     core.skip_ok_unless_installed('torque-mom', 'torque-server', 'torque-scheduler', 'torque-client', 'munge',
                                   by_dependency=True)
     self.skip_ok_unless(service.is_running('pbs_server'), 'pbs service not running')
     self.run_blahp_trace('pbs')
Пример #30
0
    def test_01_cvmfs_probe(self):
        default_local = '/etc/cvmfs/default.local'
        probe_repos = ",".join([
            'atlas.cern.ch',
            'cms.cern.ch',
            'oasis.opensciencegrid.org'])
        # Test depends on oasis-config to access the oasis.opensciencegrid.org
        # repo. This is an external service, so the requirement should be
        # removed as part of SOFTWARE-1108.
        core.skip_ok_unless_installed('cvmfs')
        core.skip_ok_unless_installed('cvmfs-keys', 'oasis-config', by_dependency=True)


        command = ('cat', default_local)
        status, stdout, stderr = core.system(command, False)

        # Dave Dykstra suggested running cvmfs probe against a different
        # set of repositories than are currently set up, so we modify them
        # just for this test. (See SOFTWARE-1097)

        # In the future, this test might be removed since we do not want
        # to depend on external services, and it's redundant to probe the
        # repos that we have already mounted.
        files.replace(
            default_local,
            'CVMFS_REPOSITORIES=cms.cern.ch',
            'CVMFS_REPOSITORIES=' + probe_repos,
            owner='cvmfsprobe')
        try:
            command = ('cvmfs_config', 'probe')
            status, stdout, stderr = core.system(command, False)
            self.assertEqual(status, 0, core.diagnose('cvmfs probe', command, status, stdout, stderr))
        finally:
            files.restore(default_local, 'cvmfsprobe')
Пример #31
0
    def test_02_xrdcp_server_to_local(self):
        core.skip_ok_unless_installed('xrootd', 'xrootd-client', by_dependency=True)
        if core.config['xrootd.gsi'] == "ON":
            core.skip_ok_unless_installed('globus-proxy-utils')
        self.skip_bad_unless(core.state['xrootd.started-server'] is True, 'Server not running')

        hostname = socket.getfqdn()
        temp_source_dir = tempfile.mkdtemp()
        temp_target_dir = tempfile.mkdtemp()
        os.chmod(temp_source_dir, 0777)
        os.chmod(temp_target_dir, 0777)
        f = open(temp_source_dir + "/copied_file.txt", "w")
        f.write("This is some test data for an xrootd test.")
        f.close()
        xrootd_url = 'root://%s/%s/copied_file.txt' % (hostname, temp_source_dir)
        local_path = temp_target_dir + '/copied_file.txt'
        command = ('xrdcp', '--debug', '3', xrootd_url, local_path)

        status, stdout, stderr = core.system(command, user=True)

        fail = core.diagnose('Xrootd xrdcp copy, URL to local',
                             command, status, stdout, stderr)
        file_copied = os.path.exists(local_path)
        shutil.rmtree(temp_source_dir)
        shutil.rmtree(temp_target_dir)

        self.assertEqual(status, 0, fail)
        self.assert_(file_copied, 'Copied file missing')
Пример #32
0
    def test_02_cvmfs(self):
        core.skip_ok_unless_installed('cvmfs')
        core.skip_ok_unless_installed('cvmfs-keys', by_dependency=True)
        core.state['cvmfs.mounted'] = False

        command = ('ls', '/cvmfs')
        status, stdout, stderr = core.system(command, False)
        file_exists = os.path.exists('/cvmfs')
        self.assert_(file_exists, 'Cvmfs mount point missing')
        core.state['cvmfs.mounted'] = True

        cern_repo = 'cms.cern.ch'
        command = ('ls', '/cvmfs/' + cern_repo)
        status, stdout, stderr = core.system(command, False)

        # If the previous command failed, output better debug info
        if status != 0:
            self.debug_cvmfs(cern_repo)

        command = ('ls', self.__check_path)
        status, stdout, stderr = core.system(command, False)
        self.assert_(file_exists, 'Test cvmfs file missing')

        command = ('bash', '-c', 'source ' + self.__check_path)
        status, stdout, stderr = core.system(command, False)
        fail = core.diagnose('cvmfs example source a file on fs',
                             command, status, stdout, stderr)
        self.assertEqual(status, 0, fail)
Пример #33
0
 def test_08_https_fetch_from_auth_cache(self):
     core.skip_ok_unless_installed('globus-proxy-utils',
                                   'gfal2-plugin-http',
                                   'gfal2-util',
                                   'gfal2-plugin-file',
                                   by_dependency=True)
     self.skip_bad_unless(core.state['proxy.valid'],
                          'requires a proxy cert')
     name, contents = self.testfiles[3]
     path = os.path.join(getcfg("OriginAuthExport"), name)
     dest_file = '/tmp/testfileHTTPsFromAuthCache'
     uid = pwd.getpwnam(core.options.username)[2]
     usercert = '/tmp/x509up_u%d' % uid
     userkey = '/tmp/x509up_u%d' % uid
     result, _, _ = \
         core.check_system(["gfal-copy", "-vf",
                            "--cert", usercert, "--key", userkey,
                            "https://%s:%d%s" % (core.get_hostname(),getcfg("CacheHTTPSPort"), path),
                            "file://%s"%dest_file],
                           "Checking xrootd copy from Authenticated cache", user=True)
     origin_file = os.path.join(getcfg("OriginRootdir"),
                                getcfg("OriginAuthExport").lstrip("/"),
                                name)
     checksum_match = files.checksum_files_match(origin_file, dest_file)
     self.assert_(
         checksum_match,
         'Origin and file downloaded via cache have the same contents')
Пример #34
0
    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
Пример #35
0
    def test_09_basic_grid_proxy(self):
        """
        Use voms-proxy-init to create a basic grid proxy (without VOMS attributes)
        if we don't already have one.  We may need this for tests in other modules.
        """
        core.skip_ok_unless_installed("voms-clients", by_dependency=True)
        # ^^ not using voms.can_make_proxy - any voms-clients implementation can make a basic proxy
        self.skip_ok_if(core.state['proxy.valid'], "Already have a proxy")
        self.skip_ok_unless(core.state.get('user.verified', False), "No user")
        self.skip_ok_unless(
            os.path.isfile(core.state['user.cert_path'])
            and os.path.isfile(core.state['user.key_path']),
            "No user cert/key")

        password = core.options.password + '\n'
        core.check_system(['voms-proxy-init', '-rfc'],
                          'Run voms-proxy-init w/o VO',
                          user=True,
                          stdin=password)
        core.check_system(['voms-proxy-info'],
                          "Check resulting proxy",
                          user=True)
        core.state['proxy.valid'] = True
        core.state[
            'voms.got-proxy'] = False  # got a proxy but without VOMS attrs
Пример #36
0
 def setUp(self):
     core.skip_ok_unless_installed("osg-xrootd-standalone",
                                   by_dependency=True)
     self.skip_ok_if(core.rpm_is_installed("xcache"),
                     "xcache configs conflict with xrootd tests")
     self.skip_ok_unless(core.state['xrootd.is-configured'],
                         "xrootd is not configured")
Пример #37
0
    def test_05_start_tomcat(self):
        core.skip_ok_unless_installed(tomcat.pkgname())
        core.state['tomcat.started'] = False
        catalina_log = tomcat.catalinafile()

        initial_stat = core.get_stat(catalina_log)

        tomcat_sentinel = r'Server startup in \d+ ms'
        # Bump log level
        core.config['tomcat.logging-conf'] = os.path.join(tomcat.sysconfdir(), 'logging.properties')
        files.append(core.config['tomcat.logging-conf'], 'org.apache.catalina.level = %s\n' % 'FINER',
                     owner='tomcat', backup=True)

        old_str  =  "1catalina.org.apache.juli.FileHandler.prefix = catalina."
        repl_str = ("1catalina.org.apache.juli.FileHandler.prefix = catalina\n"
                    "1catalina.org.apache.juli.FileHandler.rotatable = false")
        files.replace(core.config['tomcat.logging-conf'], old_str, repl_str,
                      owner='tomcat', backup=False)

        service.check_start(tomcat.pkgname())
        if core.options.nightly:
            timeout = 3600.0
        else:
            timeout = 1200.0
        line, gap = core.monitor_file(catalina_log, initial_stat, tomcat_sentinel, timeout)
        self.assert_(line is not None, 'Tomcat did not start within the %d min window' % int(timeout/60))
        core.state['tomcat.started'] = True
        core.log_message('Tomcat started after %.1f seconds' % gap)
Пример #38
0
    def test_06_remove_trustmanager(self):
        core.skip_ok_unless_installed(tomcat.pkgname(), 'emi-trustmanager-tomcat')

        # mv -f /etc/tomcat5/server.xml.old-trustmanager /etc/tomcat5/server.xml
        old_tm = os.path.join(tomcat.sysconfdir(), 'server.xml.old-trustmanager')
        new_tm = os.path.join(tomcat.sysconfdir(), 'server.xml')
        if os.path.exists(old_tm) and os.path.isdir(os.path.dirname(new_tm)):
            shutil.move(old_tm, new_tm)

        # rm -f /usr/share/tomcat5/server/lib/bcprov*.jar
        files.remove(os.path.join(tomcat.serverlibdir(), 'bcprov*.jar'))

        # rm -f /usr/share/tomcat5/server/lib/log4j*.jar
        files.remove(os.path.join(tomcat.serverlibdir(), 'log4j*.jar'))

        # rm -f /usr/share/tomcat5/server/lib/trustmanager-*.jar
        files.remove(os.path.join(tomcat.serverlibdir(), 'trustmanager-*.jar'))

        # rm -f /etc/tomcat5/log4j-trustmanager.properties
        files.remove(os.path.join(tomcat.sysconfdir(), 'log4j-trustmanager.properties'))

        # rm -f /var/lib/trustmanager-tomcat/server.xml
        files.remove('/var/lib/trustmanager-tomcat/server.xml')

        core.log_message('EMI trustmanager removed')
Пример #39
0
    def test_01_cvmfs_probe(self):
        default_local = '/etc/cvmfs/default.local'
        probe_repos = ",".join([
            'atlas.cern.ch',
            'cms.cern.ch',
            'oasis.opensciencegrid.org'])
        # Test depends on oasis-config to access the oasis.opensciencegrid.org
        # repo. This is an external service, so the requirement should be
        # removed as part of SOFTWARE-1108.
        core.skip_ok_unless_installed('cvmfs')
        core.skip_ok_unless_installed('cvmfs-keys', 'oasis-config', by_dependency=True)


        command = ('cat', default_local)
        status, stdout, stderr = core.system(command, False)

        # Dave Dykstra suggested running cvmfs probe against a different
        # set of repositories than are currently set up, so we modify them
        # just for this test. (See SOFTWARE-1097)

        # In the future, this test might be removed since we do not want
        # to depend on external services, and it's redundant to probe the
        # repos that we have already mounted.
        files.replace(
            default_local,
            'CVMFS_REPOSITORIES=cms.cern.ch',
            'CVMFS_REPOSITORIES=' + probe_repos,
            owner='cvmfsprobe')
        try:
            command = ('cvmfs_config', 'probe')
            status, stdout, stderr = core.system(command, False)
            self.assertEqual(status, 0, core.diagnose('cvmfs probe', command, status, stdout, stderr))
        finally:
            files.restore(default_local, 'cvmfsprobe')
Пример #40
0
    def test_02_osg_version(self):
        core.skip_ok_unless_installed('osg-version')

        command = ('osg-version',)

        # First we verify that osg-version runs
        stdout = core.check_system(command, 'osg-version')[0]

        # Then we pull out the version number from the output
        version_pattern = re.compile(r'(\d+\.\d+\.\d+)')
        matches = version_pattern.search(stdout)

        # Is there a version number?
        self.assert_(matches is not None)
        osg_version = matches.group(1)

        # Get the version number from the RPM
        command = ('rpm', '-q', 'osg-version')
        stdout = core.check_system(command, "osg-version RPM version")[0]
        matches = version_pattern.search(stdout)
        self.assert_(matches is not None)

        # Verify that the versions match
        osg_version_rpm_version = matches.group(1)
        self.assert_(osg_version == osg_version_rpm_version)
Пример #41
0
 def test_14_config_gram_gateway(self):
     core.config['osg-info-services.gateway-file'] = '/etc/osg/config.d/10-gateway.ini'
     core.skip_ok_unless_installed(['osg-info-services', 'osg-ce'])
     files.replace_regexpr(core.config['osg-info-services.gateway-file'],
                           'gram_gateway_enabled = *',
                           'gram_gateway_enabled = True',
                           owner='root')
Пример #42
0
    def test_01_web100clt(self):
        core.skip_ok_unless_installed('ndt-client')

        command = ('web100clt', '-v')
        stdout = core.check_system(command, 'NDT client')[0]
        self.assert_(re.search('ndt.+version', stdout, re.IGNORECASE)
                     is not None)
Пример #43
0
 def test_03_grid_proxy_init(self):
     core.state['proxy.created'] = False
     core.skip_ok_unless_installed('globus-proxy-utils')
     command = ('grid-proxy-init', '-debug')
     password = core.options.password + '\n'
     core.check_system(command, 'Normal grid-proxy-init', user=True, stdin=password)
     core.state['proxy.created'] = True
Пример #44
0
    def proxy_info(self,msg):
        core.skip_ok_unless_installed('voms-admin-server', 'voms-admin-client', 'voms-clients', by_dependency=True)
        self.skip_bad_unless(core.state['voms.got-proxy'], 'no proxy')

        command = ('voms-proxy-info', '-all')
        stdout = core.check_system(command, 'Run voms-proxy-info', user=True)[0]
        self.assert_(('/%s/Role=NULL' % (core.config['voms.vo'])) in stdout, msg)
Пример #45
0
    def test_01_setup_cvmfs(self):
        core.skip_ok_unless_installed('cvmfs')

        self.record_cvmfs_version()
        self.setup_fuse()
        self.setup_automount()
        self.setup_cvmfs()
Пример #46
0
 def test_05_pbs_trace(self):
     core.skip_ok_unless_installed('torque-mom', 'torque-server', 'torque-scheduler', 'torque-client', 'munge',
                                   by_dependency=True)
     self.skip_ok_unless(service.is_running('pbs_server'), 'pbs service not running')
     self.check_schedd_ready()
     self.check_write_creds()
     self.run_blahp_trace('pbs')
Пример #47
0
    def test_04_copy_server_to_local_uberftp_parallel(self):
        core.skip_ok_unless_installed(*self.required_rpms)
        self.skip_bad_unless(core.state['gridftp.running-server'] is True, 'GridFTP not running')

        hostname = socket.getfqdn()
        temp_dir_source = tempfile.mkdtemp()
        temp_dir_dest = tempfile.mkdtemp()
        os.chmod(temp_dir_source, 0o777)
        os.chmod(temp_dir_dest, 0o777)
        filename = 'testfile_10MB'
        full_path = (os.path.join(temp_dir_source, filename))
        command = ('dd', 'if=/dev/zero', 'of=' + full_path, 'bs=10485760',
                   'count=1')
        core.check_system(command, 'Create test file with dd', user=True)

        ftp_cmd = ('cd %s; lcd %s; get %s' %
                   (temp_dir_source, temp_dir_dest, filename))
        command = ('uberftp', '-parallel','10', hostname, ftp_cmd)
        status, stdout, stderr = core.system(command, True)
        fail = core.diagnose('UberFTP copy, local to URL',
                             command, status, stdout, stderr)
        file_copied = os.path.exists(os.path.join(temp_dir_dest, filename))
        shutil.rmtree(temp_dir_source)
        shutil.rmtree(temp_dir_dest)
        self.assertEqual(status, 0, fail)
        self.assert_(file_copied, 'Copied file missing')
Пример #48
0
 def test_06_slurm_trace(self):
     core.skip_ok_unless_installed(core.SLURM_PACKAGES)
     self.skip_bad_unless(core.state['condor-ce.schedd-ready'], 'CE schedd not ready to accept jobs')
     self.skip_ok_unless(service.is_running(core.config['slurm.service-name']), 'slurm service not running')
     self.check_schedd_ready()
     self.check_write_creds()
     self.run_blahp_trace('slurm')
Пример #49
0
    def test_03_xrdcp_server_to_local(self):
        core.skip_ok_unless_installed('xrootd', 'xrootd-client', by_dependency=True)
        if core.config['xrootd.gsi'] == "ON":
            core.skip_ok_unless_installed('globus-proxy-utils')
        self.skip_bad_unless(core.state['xrootd.started-server'] is True, 'Server not running')

        hostname = socket.getfqdn()
        temp_source_dir = tempfile.mkdtemp()
        temp_target_dir = tempfile.mkdtemp()
        os.chmod(temp_source_dir, 0o777)
        os.chmod(temp_target_dir, 0o777)
        f = open(temp_source_dir + "/copied_file.txt", "w")
        f.write("This is some test data for an xrootd test.")
        f.close()
        xrootd_url = 'root://%s:%d/%s/copied_file.txt' % (hostname, core.config['xrootd.port'], temp_source_dir)
        local_path = temp_target_dir + '/copied_file.txt'
        command = ('xrdcp', '--debug', '3', xrootd_url, local_path)

        status, stdout, stderr = core.system(command, user=True)

        fail = core.diagnose('Xrootd xrdcp copy, URL to local',
                             command, status, stdout, stderr)
        file_copied = os.path.exists(local_path)
        shutil.rmtree(temp_source_dir)
        shutil.rmtree(temp_target_dir)

        self.assertEqual(status, 0, fail)
        self.assert_(file_copied, 'Copied file missing')
Пример #50
0
    def test_01_backup_mysql(self):
        if not core.options.backupmysql:
            return

        core.skip_ok_unless_installed(mysql.client_rpm(), mysql.server_rpm())
        core.config['mysql.datadir'] = None
        core.config['mysql.backup'] = None

        mysql.start()  # Need mysql up to determine its datadir

        command = ('mysql', '-sNe',
                   "SHOW VARIABLES where Variable_name='datadir';")
        mysql_cfg = core.check_system(command, 'dump mysql config')[0]
        core.config['mysql.datadir'] = re.match('datadir\s*(.+?)\/\s*$',
                                                mysql_cfg).group(1)
        self.assert_(core.config['mysql.datadir'] is not None,
                     'could not extract MySQL datadir')

        # Backup the old mysql folder
        mysql.stop()
        backup = core.config['mysql.datadir'] + '-backup'
        self.assert_(not os.path.exists(backup), 'mysql-backup already exists')
        try:
            shutil.move(core.config['mysql.datadir'], backup)
        except IOError, e:
            if e.errno == 2:
                # Folder doesn't exist so we don't have to worry about backups
                pass
Пример #51
0
 def test_03_modify_sudoers(self):
     core.skip_ok_unless_installed('bestman2-server', 'bestman2-client')
     sudoers_path = '/etc/sudoers'
     contents = files.read(sudoers_path)
     srm_cmd = 'Cmnd_Alias SRM_CMD = /bin/rm, /bin/mkdir, /bin/rmdir, /bin/mv, /bin/cp, /bin/ls'
     srm_usr = '******'
     bestman_perm = 'bestman   ALL=(SRM_USR) NOPASSWD: SRM_CMD'
     require_tty = 'Defaults    requiretty'
     had_srm_cmd_line = False
     had_requiretty_commented = False
     for line in contents:
         if require_tty in line:
             if line.startswith("#"):
                 had_requiretty_commented = True
         if srm_cmd in line:
             had_srm_cmd_line =  True
     new_contents = []
     for line in contents:
         if not had_requiretty_commented:
             if line.strip() == require_tty.strip():
                 new_contents += '#'+line+'\n'
             else:
                 new_contents += line.strip()+'\n'
     if not had_srm_cmd_line:
         new_contents += srm_cmd+'\n'
         new_contents += srm_usr+'\n'
         new_contents += bestman_perm+'\n'
     if not had_srm_cmd_line or not had_requiretty_commented:
         files.write(sudoers_path, new_contents, owner='bestman')
Пример #52
0
    def test_06_remove_trustmanager(self):
        core.skip_ok_unless_installed(tomcat.pkgname(),
                                      'emi-trustmanager-tomcat')

        # mv -f /etc/tomcat5/server.xml.old-trustmanager /etc/tomcat5/server.xml
        old_tm = os.path.join(tomcat.sysconfdir(),
                              'server.xml.old-trustmanager')
        new_tm = os.path.join(tomcat.sysconfdir(), 'server.xml')
        if os.path.exists(old_tm) and os.path.isdir(os.path.dirname(new_tm)):
            shutil.move(old_tm, new_tm)

        # rm -f /usr/share/tomcat5/server/lib/bcprov*.jar
        files.remove(os.path.join(tomcat.serverlibdir(), 'bcprov*.jar'))

        # rm -f /usr/share/tomcat5/server/lib/log4j*.jar
        files.remove(os.path.join(tomcat.serverlibdir(), 'log4j*.jar'))

        # rm -f /usr/share/tomcat5/server/lib/trustmanager-*.jar
        files.remove(os.path.join(tomcat.serverlibdir(), 'trustmanager-*.jar'))

        # rm -f /etc/tomcat5/log4j-trustmanager.properties
        files.remove(
            os.path.join(tomcat.sysconfdir(), 'log4j-trustmanager.properties'))

        # rm -f /var/lib/trustmanager-tomcat/server.xml
        files.remove('/var/lib/trustmanager-tomcat/server.xml')

        core.log_message('EMI trustmanager removed')
Пример #53
0
    def test_14_execute_dcache_storage(self):
        # Malformed XML errors due to network issues (SOFTWARE-1748)
        core.state['gratia.dcache-whitelisted-error'] = False
        whitelisted_errors = ['The element type "metric" must be terminated by the matching end-tag "</metric>".',
                              'XML document structures must start and end within the same entity.']

        core.skip_ok_unless_installed('gratia-probe-dcache-storage', 'gratia-service')
        core.state['gratia.dcache-storage-running'] = False
        self.skip_bad_if(core.state['gratia.dcache-logs-copied'] == False)
        if os.path.exists(core.config['gratia.log.file']):
            core.state['gratia.log.stat'] = os.stat(core.config['gratia.log.file'])
            core.log_message('stat.st_ino is: ' + str(core.state['gratia.log.stat'].st_ino))
            core.log_message('stat.st_size is: ' + str(core.state['gratia.log.stat'].st_size))
        command = ('/usr/share/gratia/dCache-storage/dCache-storage_meter.cron.sh',)
        status, stdout, stderr = core.system(command)
        if status != 0:
            for error in whitelisted_errors:
                if error in stdout:
                    core.state['gratia.dcache-whitelisted-error'] = True
                    break
            if not core.state['gratia.dcache-whitelisted-error']:
                self.fail(core.diagnose('Unable to execute dCache-storage.', command, status, stdout, stderr))

        core.config['gratia.dcache-temp-dir'] = core.config['gratia.tmpdir.prefix'] + "subdir.dCache-storage" + \
                                                core.config['gratia.tmpdir.postfix']
        if core.state['gratia.database-installed'] == True:
            result = self.isProbeOutboxDirEmpty(core.config['gratia.dcache-temp-dir'])
            self.assert_(result, 'dCache-storage outbox check failed.')
        core.state['gratia.dcache-storage-running'] = True
Пример #54
0
    def test_024_rsv_control_bad_arg(self):
        core.skip_ok_unless_installed('rsv')

        command = ('rsv-control', '--kablooey')
        ret, _, _ = core.system(command, 'rsv-control --kablooey')
        self.assert_(ret != 0)
        return
Пример #55
0
 def test_24_copy_pbs_logs(self):
     core.skip_ok_unless_installed('gratia-probe-pbs-lsf', 'gratia-service')
     core.state['gratia.pbs-logs-copied'] = False
     pbs_log = '/usr/share/osg-test/gratia/20130603'
     dst_dir = '/var/spool/pbs/server_priv/accounting'
     self.assert_(self.copy_probe_logs(pbs_log, dst_dir), "pbs log copy failed.")
     core.state['gratia.pbs-logs-copied'] = True
Пример #56
0
    def test_072_switch_to_service_cert(self):
        core.skip_ok_unless_installed('rsv', 'globus-gatekeeper')

        # We put this in its own test so that even if there is a failure we
        # will switch back to the service proxy.
        self.use_service_cert()
        return
Пример #57
0
    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
Пример #58
0
    def test_01_xrdcp_local_to_server(self):
        core.skip_ok_unless_installed('xrootd', 'xrootd-client', by_dependency=True)
        if core.config['xrootd.gsi'] == "ON":
            core.skip_ok_unless_installed('globus-proxy-utils')
        self.skip_bad_unless(core.state['xrootd.started-server'] is True, 'Server not running')

        hostname = socket.getfqdn()
        if core.config['xrootd.gsi'] == "ON":
            temp_dir = "/tmp/vdttest"
            if not os.path.exists(temp_dir):
                os.mkdir(temp_dir)
                user = pwd.getpwnam(core.options.username)
                os.chown(temp_dir, user[2], user[3])
        else:
            temp_dir = tempfile.mkdtemp()
        os.chmod(temp_dir, 0777)
        xrootd_url = 'root://%s/%s/copied_file.txt' % (hostname, temp_dir)
        command = ('xrdcp', '--debug', '3', TestXrootd.__data_path, xrootd_url)

        status, stdout, stderr = core.system(command, user=True)

        fail = core.diagnose('xrdcp copy, local to URL',
                             command, status, stdout, stderr)
        file_copied = os.path.exists(os.path.join(temp_dir, 'copied_file.txt'))
        shutil.rmtree(temp_dir)

        self.assertEqual(status, 0, fail)
        self.assert_(file_copied, 'Copied file missing')
Пример #59
0
 def test_06_slurm_trace(self):
     self.general_requirements()
     core.skip_ok_unless_installed(core.SLURM_PACKAGES)
     self.skip_bad_unless(service.is_running('munge'), 'slurm requires munge')
     self.skip_bad_unless(core.state['condor-ce.schedd-ready'], 'CE schedd not ready to accept jobs')
     self.skip_ok_unless(service.is_running(core.config['slurm.service-name']), 'slurm service not running')
     self.run_blahp_trace('slurm')
Пример #60
0
 def test_03_modify_sudoers(self):
     core.skip_ok_unless_installed('bestman2-server', 'bestman2-client',
                                   'gums-service')
     sudoers_path = '/etc/sudoers'
     contents = files.read(sudoers_path)
     srm_cmd = 'Cmnd_Alias SRM_CMD = /bin/rm, /bin/mkdir, /bin/rmdir, /bin/mv, /bin/cp, /bin/ls'
     srm_usr = '******'
     bestman_perm = 'bestman   ALL=(SRM_USR) NOPASSWD: SRM_CMD'
     require_tty = 'Defaults    requiretty'
     had_srm_cmd_line = False
     had_requiretty_commented = False
     for line in contents:
         if require_tty in line:
             if line.startswith("#"):
                 had_requiretty_commented = True
         if srm_cmd in line:
             had_srm_cmd_line = True
     new_contents = []
     for line in contents:
         if not had_requiretty_commented:
             if line.strip() == require_tty.strip():
                 new_contents += '#' + line + '\n'
             else:
                 new_contents += line.strip() + '\n'
     if not had_srm_cmd_line:
         new_contents += srm_cmd + '\n'
         new_contents += srm_usr + '\n'
         new_contents += bestman_perm + '\n'
     if not had_srm_cmd_line or not had_requiretty_commented:
         files.write(sudoers_path, new_contents, owner='bestman')