Skip to content

Commit c9331ca

Browse files
author
efajardo
committed
Adding the xrdcp tests
1 parent a918acc commit c9331ca

File tree

2 files changed

+49
-5
lines changed

2 files changed

+49
-5
lines changed

osgtest/tests/test_155_stashcache.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
PARAMS_CFG_CONTENTS = "\n".join("setenv {0} = {1}\nset {0} = {1}".format(k, v)
3838
for k, v in PARAMS.items()) + "\n"
3939

40+
4041
PRE_CFG_PATH = "/etc/xrootd/config.d/11-pre.cfg"
4142
PRE_CFG_CONTENTS = """
4243
set DisableOsgMonitoring = 1
@@ -52,6 +53,7 @@
5253
5354
pss.origin localhost:$(OriginAuthXrootPort)
5455
xrd.protocol http:$(CacheHTTPSPort) libXrdHttp.so
56+
setenv XrdSecGSISRVNAMES=*
5557
else if named stash-cache
5658
xrd.port $(CacheXrootPort)
5759
set rootdir = $(CacheRootdir)
@@ -77,10 +79,15 @@
7779
"""
7880

7981
CACHE_AUTHFILE_PATH = PARAMS["StashCacheAuthfile"]
80-
CACHE_AUTHFILE_CONTENTS = "u * / rl\n"
82+
CACHE_AUTHFILE_CONTENTS = "u b64f6609.0 /osgtest/PROTECTED rl\n"
83+
8184

8285
CACHE_PUBLIC_AUTHFILE_PATH = PARAMS["StashCachePublicAuthfile"]
83-
CACHE_PUBLIC_AUTHFILE_CONTENTS = "u * / rl\n"
86+
CACHE_PUBLIC_AUTHFILE_CONTENTS = """
87+
u * /osgtest/PROTECTED -rl \
88+
/ rl
89+
"""
90+
8491

8592
ORIGIN_AUTHFILE_PATH = PARAMS["StashOriginAuthfile"]
8693
ORIGIN_AUTHFILE_CONTENTS = "u * /osgtest/PROTECTED rl\n"

osgtest/tests/test_460_stashcache.py

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ class TestStashCache(OSGTestCase):
2727
for x in range(4)
2828
]
2929

30-
def assertCached(self, name, contents):
30+
def assertCached(self, name, contents, auth=False):
31+
OriginExport = getcfg("OriginExport")
32+
if auth:
33+
OriginExport = getcfg("OriginAuthExport")
3134
fpath = os.path.join(getcfg("CacheRootdir"), getcfg("OriginExport").lstrip("/"), name)
3235
self.assertTrue(os.path.exists(fpath),
3336
name + " not cached")
@@ -47,16 +50,20 @@ def setUp(self):
4750
by_dependency=True)
4851
if core.rpm_is_installed("xcache"):
4952
self.skip_ok_if(core.PackageVersion("xcache") < "1.0.2", "needs xcache 1.0.2+")
50-
self.skip_bad_unless_running("xrootd@stash-origin", "xrootd@stash-cache")
53+
self.skip_bad_unless_running("xrootd@stash-origin", "xrootd@stash-cache", "xrootd@stash-origin-auth",
54+
"xrootd@stash-cache-auth")
5155

5256
def test_01_create_files(self):
5357
xrootd_user = pwd.getpwnam("xrootd")
5458
for name, contents in self.testfiles:
5559
files.write(os.path.join(getcfg("OriginRootdir"), getcfg("OriginExport").lstrip("/"), name),
5660
contents, backup=False, chmod=0o644,
5761
chown=(xrootd_user.pw_uid, xrootd_user.pw_gid))
62+
files.write(os.path.join(getcfg("OriginRootdir"), getcfg("OriginAuthExport").lstrip("/"), name),
63+
contents, backup=False, chmod=0o644,
64+
chown=(xrootd_user.pw_uid, xrootd_user.pw_gid))
5865

59-
def test_02_xroot_fetch_from_origin(self):
66+
def test_02_xrootd_fetch_from_origin(self):
6067
name, contents = self.testfiles[0]
6168
path = os.path.join(getcfg("OriginExport"), name)
6269
result, _, _ = \
@@ -100,3 +107,33 @@ def test_05_stashcp(self):
100107
result = tf.read()
101108
self.assertEqualVerbose(result, contents, "stashcp'ed file mismatch")
102109
self.assertCached(name, contents)
110+
111+
def test_06_xrootd_fetch_from_origin_auth(self):
112+
core.skip_ok_unless_installed('globus-proxy-utils', by_dependency=True)
113+
self.skip_bad_unless(core.state['proxy.valid'], 'requires a proxy cert')
114+
name, contents = self.testfiles[0]
115+
path = os.path.join(getcfg("OriginAuthExport"), name)
116+
dest_file = '/tmp/testfileFromOriginAuth'
117+
os.environ["XrdSecGSISRVNAMES"] = "*"
118+
result, _, _ = core.check_system(["xrdcp", "-d1", '-f',
119+
"root://localhost:%d/%s" % (getcfg("OriginAuthXrootPort"), path),
120+
dest_file],
121+
"Checking xrootd copy from authenticated origin", user=True)
122+
origin_file = os.path.join(getcfg("OriginRootdir"), getcfg("OriginAuthExport").lstrip("/"), name)
123+
chechskum_match = files.checksum_files_match(origin_file, dest_file)
124+
self.assert_(chechskum_match, 'Origin and download file have same contents')
125+
126+
def test_07_xrootd_fetch_from_auth_cache(self):
127+
core.skip_ok_unless_installed('globus-proxy-utils', by_dependency=True)
128+
self.skip_bad_unless(core.state['proxy.valid'], 'requires a proxy cert')
129+
name, contents = self.testfiles[2]
130+
path = os.path.join(getcfg("OriginAuthExport"), name)
131+
os.environ["XrdSecGSISRVNAMES"] = "*"
132+
dest_file = '/tmp/testfileXrootdFromAuthCache'
133+
result, _, _ = \
134+
core.check_system(["xrdcp", "-d1","-f",
135+
"root://%s:%d/%s" % (core.get_hostname(),getcfg("CacheHTTPSPort"), path),
136+
dest_file], "Checking xrootd copy from Authenticated cache", user=True)
137+
origin_file = os.path.join(getcfg("OriginRootdir"), getcfg("OriginAuthExport").lstrip("/"), name)
138+
chechskum_match = files.checksum_files_match(origin_file, dest_file)
139+
self.assert_(chechskum_match, 'Cache and download file have same contents')

0 commit comments

Comments
 (0)