Skip to content

Commit 2e74e8b

Browse files
authored
Merge pull request #154 from efajardo/sw3359
SOFTWARE-3359 (The multiuser tests needs globus proxy utils and the first test to work)
2 parents b08754d + 453ef34 commit 2e74e8b

File tree

3 files changed

+17
-19
lines changed

3 files changed

+17
-19
lines changed

osgtest/tests/test_150_xrootd.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def test_01_start_xrootd(self):
3737
core.config['certs.xrootdkey'] = '/etc/grid-security/xrd/xrdkey.pem'
3838
core.config['xrootd.config'] = '/etc/xrootd/xrootd-clustered.cfg'
3939
core.config['xrootd.port'] = XROOTD_PORT
40-
core.config['xrootd.multiuser'] = "OFF"
40+
core.config['xrootd.multiuser'] = False
4141
core.state['xrootd.started-server'] = False
4242
core.state['xrootd.backups-exist'] = False
4343

@@ -76,16 +76,16 @@ def test_02_configure_hdfs(self):
7676
files.append(core.config['xrootd.config'], hdfs_config, backup=False)
7777

7878
def test_03_configure_multiuser(self):
79-
core.skip_ok_unless_installed('xrootd-multiuser')
80-
core.config['xrootd.multiuser'] = "ON"
79+
core.skip_ok_unless_installed('xrootd-multiuser','globus-proxy-utils', by_dependency=True)
8180
xrootd_multiuser_conf = "xrootd.fslib libXrdMultiuser.so default"
8281
files.append(core.config['xrootd.config'], xrootd_multiuser_conf, owner='xrootd', backup=False)
82+
core.config['xrootd.multiuser'] = True
8383

8484
def test_04_start_xrootd(self):
8585
core.skip_ok_unless_installed('xrootd', by_dependency=True)
8686
if core.el_release() < 7:
8787
core.config['xrootd_service'] = "xrootd"
88-
elif core.config['xrootd.multiuser'] == "ON":
88+
elif core.config['xrootd.multiuser']:
8989
core.config['xrootd_service'] = "xrootd-privileged@clustered"
9090
else:
9191
core.config['xrootd_service'] = "xrootd@clustered"

osgtest/tests/test_450_xrootd.py

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ class TestXrootd(osgunittest.OSGTestCase):
1515
__fuse_path = '/mnt/xrootd_fuse_test'
1616

1717
def test_01_xrdcp_local_to_server(self):
18+
core.state['xrootd.copied-to-server'] = False
1819
core.skip_ok_unless_installed('xrootd', 'xrootd-client', by_dependency=True)
1920
core.skip_ok_unless_installed('globus-proxy-utils')
2021
self.skip_bad_unless(core.state['xrootd.started-server'] is True, 'Server not running')
22+
temp_dir = tempfile.mkdtemp()
23+
core.config['xrootd.tmp-dir'] = temp_dir
24+
user = pwd.getpwnam(core.options.username)
25+
os.chown(temp_dir, user[2], user[3])
2126
hostname = socket.getfqdn()
22-
temp_dir = "/tmp/vdttest"
23-
if not os.path.exists(temp_dir):
24-
os.mkdir(temp_dir)
25-
user = pwd.getpwnam(core.options.username)
26-
os.chown(temp_dir, user[2], user[3])
2727
os.chmod(temp_dir, 0o777)
2828
xrootd_url = 'root://%s:%d/%s/copied_file.txt' % (hostname, core.config['xrootd.port'], temp_dir)
2929
command = ('xrdcp', '--debug', '3', TestXrootd.__data_path, xrootd_url)
@@ -33,19 +33,17 @@ def test_01_xrdcp_local_to_server(self):
3333
fail = core.diagnose('xrdcp copy, local to URL',
3434
command, status, stdout, stderr)
3535
file_copied = os.path.exists(os.path.join(temp_dir, 'copied_file.txt'))
36-
if core.config['xrootd.multiuser'] != "ON":
37-
shutil.rmtree(temp_dir)
36+
if file_copied:
37+
core.state['xrootd.copied-to-server'] = True
3838
self.assertEqual(status, 0, fail)
3939
self.assert_(file_copied, 'Copied file missing')
4040

4141
def test_02_xrootd_multiuser(self):
42-
core.skip_ok_unless_installed('xrootd', 'xrootd-client', 'xrootd-multiuser', by_dependency=True)
43-
temp_dir = "/tmp/vdttest"
44-
if core.config['xrootd.multiuser'] == "ON":
45-
file_path = os.path.join(temp_dir, 'copied_file.txt')
46-
result_perm = core.check_file_ownership(file_path, core.options.username)
47-
shutil.rmtree(temp_dir)
48-
self.assertEqual(result_perm, True)
42+
core.skip_ok_unless_installed('xrootd', 'xrootd-client', 'globus-proxy-utils', 'xrootd-multiuser', by_dependency=True)
43+
self.skip_bad_unless(core.config['xrootd.multiuser'], 'Xrootd not configured for multiuser')
44+
self.skip_bad_unless(core.state['xrootd.copied-to-server'], 'File to check ownership does not exist')
45+
file_path = os.path.join(core.config['xrootd.tmp-dir'], 'copied_file.txt')
46+
self.assertEqual(core.check_file_ownership(file_path, core.options.username), True)
4947

5048
def test_03_xrdcp_server_to_local(self):
5149
core.skip_ok_unless_installed('xrootd', 'xrootd-client', by_dependency=True)

osgtest/tests/test_840_xrootd.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def test_01_stop_xrootd(self):
1111
files.restore('/etc/xrootd/auth_file', "xrootd")
1212
if not core.rpm_is_installed('xrootd-lcmaps'):
1313
files.restore('/etc/grid-security/xrd/xrdmapfile', "xrootd")
14-
1514
core.skip_ok_unless_installed('xrootd', by_dependency=True)
1615
self.skip_ok_if(core.state['xrootd.started-server'], 'did not start server')
1716
service.check_stop(core.config['xrootd_service'])
17+
files.remove(core.config['xrootd.tmp-dir'], force=True)

0 commit comments

Comments
 (0)