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')
def test_02_initate_tpc(self): core.skip_ok_unless_installed('xrootd', 'xrootd-scitokens', 'x509-scitokens-issuer-client', by_dependency=True) headers = {} command = ('curl', '-A', 'Test', "-vk", "-X", "COPY", '-H', "Authorization: Bearer %s" % core.config['xrootd.tpc.macaroon-1'], '-H', "Source: %s" % core.config['xrootd.tpc.url-1'], '-H', 'Overwrite: T', '-H', 'Copy-Header: Authorization: Bearer %s'% core.config['xrootd.tpc.macaroon-2'], core.config['xrootd.tpc.url-2']) status, stdout, stderr = core.system(command, user=True) fail = core.diagnose('Initiate third party copy', command, status, stdout, stderr) file_copied = os.path.exists("/tmp/test_gridftp_data_tpc.txt") self.assert_(file_copied, 'Copied file missing') chechskum_match = files.checksum_files_match("/tmp/test_gridftp_data_tpc.txt", "/usr/share/osg-test/test_gridftp_data.txt") self.assert_(chechskum_match, 'Files have same contents')
def test_02_initate_tpc(self): core.skip_ok_unless_installed('x509-scitokens-issuer-client', by_dependency=True) self.skip_bad_if(core.config['xrootd.tpc.macaroon-1'] is None, 'Macaroon 1 creation failed earlier') self.skip_bad_if(core.config['xrootd.tpc.macaroon-2'] is None, 'Macaroon 2 creation failed earlier') headers = {} command = ('curl', '-A', 'Test', "-vk", "-X", "COPY", '-H', "Authorization: Bearer %s" % core.config['xrootd.tpc.macaroon-1'], '-H', "Source: %s" % core.config['xrootd.tpc.url-1'], '-H', 'Overwrite: T', '-H', 'Copy-Header: Authorization: Bearer %s'% core.config['xrootd.tpc.macaroon-2'], core.config['xrootd.tpc.url-2']) status, stdout, stderr = core.system(command, user=True) fail = core.diagnose('Initiate third party copy', command, status, stdout, stderr) file_copied = os.path.exists("/tmp/test_gridftp_data_tpc.txt") self.assert_(file_copied, 'Copied file missing') chechskum_match = files.checksum_files_match("/tmp/test_gridftp_data_tpc.txt", "/usr/share/osg-test/test_gridftp_data.txt") self.assert_(chechskum_match, 'Files have same contents')
def test_07_xrootd_fetch_from_auth_cache(self): core.skip_ok_unless_installed('globus-proxy-utils', by_dependency=True) self.skip_bad_unless(core.state['proxy.valid'], 'requires a proxy cert') name, contents = self.testfiles[2] path = os.path.join(getcfg("OriginAuthExport"), name) os.environ["XrdSecGSISRVNAMES"] = "*" dest_file = '/tmp/testfileXrootdFromAuthCache' result, _, _ = \ core.check_system(["xrdcp", "-d1","-f", "root://%s:%d/%s" % (core.get_hostname(),getcfg("CacheHTTPSPort"), path), 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')
def test_06_xrootd_fetch_from_origin_auth(self): core.skip_ok_unless_installed('globus-proxy-utils', by_dependency=True) self.skip_bad_unless(core.state['proxy.valid'], 'requires a proxy cert') name, contents = self.testfiles[0] path = os.path.join(getcfg("OriginAuthExport"), name) dest_file = '/tmp/testfileFromOriginAuth' os.environ["XrdSecGSISRVNAMES"] = "*" result, _, _ = core.check_system( [ "xrdcp", "-d1", '-f', "root://localhost:%d/%s" % (getcfg("OriginAuthXrootPort"), path), dest_file ], "Checking xrootd copy from authenticated origin", 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 directly downloaded file have the same contents')