Skip to content

Commit d7695df

Browse files
authored
Merge pull request #177 from brianhlin/SOFTWARE-3520.osg-xrootd
Use osg-xrootd-standalone in our XRootD tests (SOFTWARE-3520)
2 parents 61a1bea + 1456f09 commit d7695df

File tree

5 files changed

+80
-56
lines changed

5 files changed

+80
-56
lines changed

osgtest/tests/test_150_xrootd.py

Lines changed: 57 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1-
import os
21
import pwd
32
import osgtest.library.core as core
43
import osgtest.library.files as files
54
import osgtest.library.service as service
65
import osgtest.library.osgunittest as osgunittest
76

87

9-
XROOTD_PORT = 1096 # chosen so it doesn't conflict w/ the stashcache instances
10-
118
XROOTD_CFG_TEXT = """\
129
cms.space min 2g 5g
1310
xrootd.seclib /usr/lib64/libXrdSec-4.so
@@ -20,7 +17,12 @@
2017
%s
2118
acc.authdb /etc/xrootd/auth_file
2219
ofs.authorize
23-
xrd.port %d
20+
"""
21+
22+
# XRootD configuration necessaryfor osg-xrootd-standalone
23+
META_XROOTD_CFG_TEXT = """\
24+
set rootdir = /
25+
set resourcename = OSG_TEST_XROOTD_STANDALONE
2426
"""
2527

2628
AUTHFILE_TEXT = """\
@@ -29,19 +31,39 @@
2931
u xrootd /tmp a
3032
"""
3133

34+
SYSCONFIG_TEXT = """\
35+
XROOTD_USER=xrootd
36+
XROOTD_GROUP=xrootd
37+
38+
XROOTD_DEFAULT_OPTIONS="-l /var/log/xrootd/xrootd.log -c /etc/xrootd/xrootd-standalone.cfg -k fifo"
39+
CMSD_DEFAULT_OPTIONS="-l /var/log/xrootd/cmsd.log -c /etc/xrootd/xrootd-standalone.cfg -k fifo"
40+
PURD_DEFAULT_OPTIONS="-l /var/log/xrootd/purged.log -c /etc/xrootd/xrootd-standalone.cfg -k fifo"
41+
XFRD_DEFAULT_OPTIONS="-l /var/log/xrootd/xfrd.log -c /etc/xrootd/xrootd-standalone.cfg -k fifo"
42+
43+
XROOTD_INSTANCES="default"
44+
CMSD_INSTANCES="default"
45+
PURD_INSTANCES="default"
46+
XFRD_INSTANCES="default"
47+
"""
48+
49+
3250
class TestStartXrootd(osgunittest.OSGTestCase):
3351

3452
def setUp(self):
3553
if core.rpm_is_installed("xcache"):
36-
self.skip_ok_if(core.PackageVersion("xcache") >= "1.0.2", "xcache 1.0.2+ configs conflict with xrootd tests")
54+
self.skip_ok_if(core.PackageVersion("xcache") >= "1.0.2",
55+
"xcache 1.0.2+ configs conflict with xrootd tests")
3756

38-
def test_01_start_xrootd(self):
57+
def test_01_configure_xrootd(self):
3958
core.config['xrootd.pid-file'] = '/var/run/xrootd/xrootd-default.pid'
4059
core.config['certs.xrootdcert'] = '/etc/grid-security/xrd/xrdcert.pem'
4160
core.config['certs.xrootdkey'] = '/etc/grid-security/xrd/xrdkey.pem'
42-
core.config['xrootd.config'] = '/etc/xrootd/xrootd-clustered.cfg'
43-
core.config['xrootd.config-extra'] = '/etc/xrootd/config.d/99-osg-test.cfg'
44-
core.config['xrootd.port'] = XROOTD_PORT
61+
if core.rpm_is_installed('osg-xrootd-standalone'):
62+
# rootdir and resourcename needs to be set early for the default osg-xrootd config
63+
core.config['xrootd.config'] = '/etc/xrootd/config.d/10-osg-test.cfg'
64+
else:
65+
core.config['xrootd.config'] = '/etc/xrootd/config.d/99-osg-test.cfg'
66+
core.config['xrootd.service-defaults'] = '/etc/sysconfig/xrootd'
4567
core.config['xrootd.multiuser'] = False
4668
core.state['xrootd.started-server'] = False
4769
core.state['xrootd.backups-exist'] = False
@@ -54,27 +76,28 @@ def test_01_start_xrootd(self):
5476
core.install_cert('certs.xrootdcert', 'certs.hostcert', 'xrootd', 0o644)
5577
core.install_cert('certs.xrootdkey', 'certs.hostkey', 'xrootd', 0o400)
5678

57-
lcmaps_packages = ('lcmaps', 'lcmaps-db-templates', 'xrootd-lcmaps', 'vo-client', 'vo-client-lcmaps-voms')
58-
if all([core.rpm_is_installed(x) for x in lcmaps_packages]):
59-
core.log_message("Using xrootd-lcmaps authentication")
60-
sec_protocol = '-authzfun:libXrdLcmaps.so -authzfunparms:--loglevel,5'
61-
if core.PackageVersion('xrootd-lcmaps') >= '1.4.0':
62-
sec_protocol += ',--policy,authorize_only'
63-
else:
64-
core.log_message("Using XRootD mapfile authentication")
65-
sec_protocol = '-gridmap:/etc/grid-security/xrd/xrdmapfile'
66-
files.write("/etc/grid-security/xrd/xrdmapfile", "\"%s\" vdttest" % core.config['user.cert_subject'],
67-
owner="xrootd",
68-
chown=(user.pw_uid, user.pw_gid))
69-
70-
if core.PackageVersion('xrootd') < '1:4.9.0':
71-
files.append(core.config['xrootd.config'],
72-
XROOTD_CFG_TEXT % (sec_protocol, core.config['xrootd.port']),
73-
owner='xrootd', backup=True)
79+
if core.rpm_is_installed('osg-xrootd-standalone'):
80+
core.log_message("Using osg-xrootd configuration")
81+
xrootd_config = META_XROOTD_CFG_TEXT
7482
else:
75-
files.write(core.config['xrootd.config-extra'],
76-
XROOTD_CFG_TEXT % (sec_protocol, core.config['xrootd.port']),
77-
owner='xrootd', backup=True, chmod=0o644)
83+
lcmaps_packages = ('lcmaps', 'lcmaps-db-templates', 'xrootd-lcmaps', 'vo-client', 'vo-client-lcmaps-voms')
84+
if all([core.rpm_is_installed(x) for x in lcmaps_packages]):
85+
core.log_message("Using xrootd-lcmaps authentication")
86+
sec_protocol = '-authzfun:libXrdLcmaps.so -authzfunparms:loglevel=5,policy=authorize_only'
87+
else:
88+
core.log_message("Using XRootD mapfile authentication")
89+
sec_protocol = '-gridmap:/etc/grid-security/xrd/xrdmapfile'
90+
files.write("/etc/grid-security/xrd/xrdmapfile", "\"%s\" vdttest" % core.config['user.cert_subject'],
91+
owner="xrootd",
92+
chown=(user.pw_uid, user.pw_gid))
93+
xrootd_config = XROOTD_CFG_TEXT % sec_protocol
94+
95+
files.write(core.config['xrootd.config'], xrootd_config, owner='xrootd', backup=True, chmod=0o644)
96+
97+
if core.el_release() < 7:
98+
files.write(core.config['xrootd.service-defaults'], SYSCONFIG_TEXT,
99+
owner="xrootd", chown=(user.pw_uid, user.pw_gid), chmod=0o644)
100+
78101
authfile = '/etc/xrootd/auth_file'
79102
files.write(authfile, AUTHFILE_TEXT, owner="xrootd", chown=(user.pw_uid, user.pw_gid))
80103

@@ -83,28 +106,22 @@ def test_01_start_xrootd(self):
83106
def test_02_configure_hdfs(self):
84107
core.skip_ok_unless_installed('xrootd-hdfs')
85108
hdfs_config = "ofs.osslib /usr/lib64/libXrdHdfs.so"
86-
if core.PackageVersion('xrootd') < '1:4.9.0':
87-
files.append(core.config['xrootd.config'], hdfs_config, backup=False)
88-
else:
89-
files.append(core.config['xrootd.config-extra'], hdfs_config, backup=False)
109+
files.append(core.config['xrootd.config'], hdfs_config, backup=False)
90110

91111
def test_03_configure_multiuser(self):
92-
core.skip_ok_unless_installed('xrootd-multiuser','globus-proxy-utils', by_dependency=True)
112+
core.skip_ok_unless_installed('xrootd-multiuser', 'globus-proxy-utils', by_dependency=True)
93113
xrootd_multiuser_conf = "xrootd.fslib libXrdMultiuser.so default"
94-
if core.PackageVersion('xrootd') < '1:4.9.0':
95-
files.append(core.config['xrootd.config'], xrootd_multiuser_conf, owner='xrootd', backup=False)
96-
else:
97-
files.append(core.config['xrootd.config-extra'], xrootd_multiuser_conf, owner='xrootd', backup=False)
114+
files.append(core.config['xrootd.config'], xrootd_multiuser_conf, owner='xrootd', backup=False)
98115
core.config['xrootd.multiuser'] = True
99116

100117
def test_04_start_xrootd(self):
101118
core.skip_ok_unless_installed('xrootd', by_dependency=True)
102119
if core.el_release() < 7:
103120
core.config['xrootd_service'] = "xrootd"
104121
elif core.config['xrootd.multiuser']:
105-
core.config['xrootd_service'] = "xrootd-privileged@clustered"
122+
core.config['xrootd_service'] = "xrootd-privileged@standalone"
106123
else:
107-
core.config['xrootd_service'] = "xrootd@clustered"
124+
core.config['xrootd_service'] = "xrootd@standalone"
108125

109126
service.check_start(core.config['xrootd_service'])
110127
core.state['xrootd.started-server'] = True

osgtest/tests/test_450_xrootd.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ class TestXrootd(osgunittest.OSGTestCase):
1616

1717
def setUp(self):
1818
if core.rpm_is_installed("xcache"):
19-
self.skip_ok_if(core.PackageVersion("xcache") >= "1.0.2", "xcache 1.0.2+ configs conflict with xrootd tests")
19+
self.skip_ok_if(core.PackageVersion("xcache") >= "1.0.2",
20+
"xcache 1.0.2+ configs conflict with xrootd tests")
2021

2122
def test_01_xrdcp_local_to_server(self):
2223
core.state['xrootd.copied-to-server'] = False
@@ -29,7 +30,7 @@ def test_01_xrdcp_local_to_server(self):
2930
os.chown(temp_dir, user[2], user[3])
3031
hostname = socket.getfqdn()
3132
os.chmod(temp_dir, 0o777)
32-
xrootd_url = 'root://%s:%d/%s/copied_file.txt' % (hostname, core.config['xrootd.port'], temp_dir)
33+
xrootd_url = 'root://%s/%s/copied_file.txt' % (hostname, temp_dir)
3334
command = ('xrdcp', '--debug', '3', TestXrootd.__data_path, xrootd_url)
3435

3536
status, stdout, stderr = core.system(command, user=True)
@@ -43,11 +44,12 @@ def test_01_xrdcp_local_to_server(self):
4344
self.assert_(file_copied, 'Copied file missing')
4445

4546
def test_02_xrootd_multiuser(self):
46-
core.skip_ok_unless_installed('xrootd', 'xrootd-client', 'globus-proxy-utils', 'xrootd-multiuser', by_dependency=True)
47+
core.skip_ok_unless_installed('xrootd', 'xrootd-client', 'globus-proxy-utils', 'xrootd-multiuser',
48+
by_dependency=True)
4749
self.skip_bad_unless(core.config['xrootd.multiuser'], 'Xrootd not configured for multiuser')
4850
self.skip_bad_unless(core.state['xrootd.copied-to-server'], 'File to check ownership does not exist')
4951
file_path = os.path.join(core.config['xrootd.tmp-dir'], 'copied_file.txt')
50-
self.assertEqual(core.check_file_ownership(file_path, core.options.username), True)
52+
self.assertEqual(core.check_file_ownership(file_path, core.options.username), True)
5153

5254
def test_03_xrdcp_server_to_local(self):
5355
core.skip_ok_unless_installed('xrootd', 'xrootd-client', by_dependency=True)
@@ -62,7 +64,7 @@ def test_03_xrdcp_server_to_local(self):
6264
f = open(temp_source_dir + "/copied_file.txt", "w")
6365
f.write("This is some test data for an xrootd test.")
6466
f.close()
65-
xrootd_url = 'root://%s:%d/%s/copied_file.txt' % (hostname, core.config['xrootd.port'], temp_source_dir)
67+
xrootd_url = 'root://%s/%s/copied_file.txt' % (hostname, temp_source_dir)
6668
local_path = temp_target_dir + '/copied_file.txt'
6769
command = ('xrdcp', '--debug', '3', xrootd_url, local_path)
6870

@@ -86,12 +88,12 @@ def test_04_xrootd_fuse(self):
8688
os.mkdir(TestXrootd.__fuse_path)
8789
hostname = socket.getfqdn()
8890

89-
#For some reason, sub process hangs on fuse processes, use os.system
90-
os.system("mount -t fuse -o rdr=root://localhost:%d//tmp,uid=xrootd xrootdfs %s" %
91-
(core.config['xrootd.port'], TestXrootd.__fuse_path))
91+
# For some reason, sub process hangs on fuse processes, use os.system
92+
os.system("mount -t fuse -o rdr=root://localhost//tmp,uid=xrootd xrootdfs %s" %
93+
TestXrootd.__fuse_path)
9294

9395
# Copy a file in and see if it made it into the fuse mount
94-
xrootd_url = 'root://%s:%d/%s/copied_file.txt' % (hostname, core.config['xrootd.port'], "/tmp")
96+
xrootd_url = 'root://%s/%s/copied_file.txt' % (hostname, "/tmp")
9597
core.system(['xrdcp', '--debug', '3', TestXrootd.__data_path, xrootd_url], user=True)
9698

9799
self.assert_(os.path.isfile("/tmp/copied_file.txt"), "Test file not uploaded to FUSE mount")

osgtest/tests/test_840_xrootd.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,21 @@
33
import osgtest.library.service as service
44
import osgtest.library.osgunittest as osgunittest
55

6+
67
class TestStopXrootd(osgunittest.OSGTestCase):
78
def setUp(self):
89
if core.rpm_is_installed("xcache"):
9-
self.skip_ok_if(core.PackageVersion("xcache") >= "1.0.2", "xcache 1.0.2+ configs conflict with xrootd tests")
10+
self.skip_ok_if(core.PackageVersion("xcache") >= "1.0.2",
11+
"xcache 1.0.2+ configs conflict with xrootd tests")
1012

1113
def test_01_stop_xrootd(self):
1214
if core.state['xrootd.backups-exist']:
13-
if core.PackageVersion('xrootd') < '1:4.9.0':
14-
files.restore(core.config['xrootd.config'], "xrootd")
15-
else:
16-
files.restore(core.config['xrootd.config-extra'], "xrootd")
15+
files.restore(core.config['xrootd.config'], "xrootd")
1716
files.restore('/etc/xrootd/auth_file', "xrootd")
1817
if not core.rpm_is_installed('xrootd-lcmaps'):
1918
files.restore('/etc/grid-security/xrd/xrdmapfile', "xrootd")
19+
if core.el_release() < 7:
20+
files.restore(core.config['xrootd.service-defaults'], "xrootd")
2021
core.skip_ok_unless_installed('xrootd', by_dependency=True)
2122
self.skip_ok_if(core.state['xrootd.started-server'], 'did not start server')
2223
service.check_stop(core.config['xrootd_service'])
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
osg-xrootd-standalone
2+
xrootd-client
3+
globus-proxy-utils

travis-ci/test_inside_docker.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#!/bin/sh -xe
22

3+
extra_repos='--extra-repo=osg-minefield'
4+
35
if [[ "$OSG_RELEASE" == "3.5" ]]; then
46
devops_repo='--enablerepo=devops-itb'
5-
extra_repos='--extra-repo=osg-development'
67
else
78
devops_repo=''
8-
extra_repos=''
99
fi
1010

1111
ls -l /home
@@ -76,5 +76,6 @@ osg-test --verbose \
7676
--dump-output \
7777
--hostcert \
7878
--no-cleanup \
79+
--manual-run \
7980
${extra_repos} \
8081
${install_str}

0 commit comments

Comments
 (0)