@@ -15,15 +15,15 @@ class TestXrootd(osgunittest.OSGTestCase):
15
15
__fuse_path = '/mnt/xrootd_fuse_test'
16
16
17
17
def test_01_xrdcp_local_to_server (self ):
18
+ core .state ['xrootd.copied-to-server' ] = False
18
19
core .skip_ok_unless_installed ('xrootd' , 'xrootd-client' , by_dependency = True )
19
20
core .skip_ok_unless_installed ('globus-proxy-utils' )
20
21
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 ])
21
26
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 ])
27
27
os .chmod (temp_dir , 0o777 )
28
28
xrootd_url = 'root://%s:%d/%s/copied_file.txt' % (hostname , core .config ['xrootd.port' ], temp_dir )
29
29
command = ('xrdcp' , '--debug' , '3' , TestXrootd .__data_path , xrootd_url )
@@ -33,19 +33,17 @@ def test_01_xrdcp_local_to_server(self):
33
33
fail = core .diagnose ('xrdcp copy, local to URL' ,
34
34
command , status , stdout , stderr )
35
35
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
38
38
self .assertEqual (status , 0 , fail )
39
39
self .assert_ (file_copied , 'Copied file missing' )
40
40
41
41
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 )
49
47
50
48
def test_03_xrdcp_server_to_local (self ):
51
49
core .skip_ok_unless_installed ('xrootd' , 'xrootd-client' , by_dependency = True )
0 commit comments