Skip to content

Commit 0b9e7b4

Browse files
author
efajardo
committed
Adding the TPC tests to the test sequences
1 parent 43dd9a6 commit 0b9e7b4

File tree

7 files changed

+54
-39
lines changed

7 files changed

+54
-39
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ env:
55
# - OS_TYPE=centos OS_VERSION=6 PACKAGES=osg-gridftp,rsv,lcmaps,lcmaps-db-templates,vo-client-lcmaps-voms,rsv,llrun
66
# - OS_TYPE=centos OS_VERSION=7 PACKAGES=osg-ce-condor,rsv,vo-client-lcmaps-voms,llrun,singularity-runtime,osg-oasis
77
# - OS_TYPE=centos OS_VERSION=7 PACKAGES=osg-gridftp,rsv,lcmaps,lcmaps-db-templates,vo-client-lcmaps-voms,rsv,llrun,singularity-runtime,osg-oasis
8-
- OS_TYPE=centos OS_VERSION=7 PACKAGES=xrootd,xrootd-client,xrootd-multiuser,xrootd-scitokens,globus-proxy-utils
8+
- OS_TYPE=centos OS_VERSION=7 PACKAGES=xrootd,xrootd-client,xrootd-multiuser,xrootd-scitokens,globus-proxy-utils,lcmaps,lcmaps-db-templates,xrootd-lcmaps,vo-client,vo-client-lcmaps-voms
99

1010
services:
1111
- docker

files/test_sequence

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ test_130_gridftp
1010
test_140_lcmaps
1111
test_150_xrootd
1212
test_155_stashcache
13+
test_158_xrootd_tpc
1314
test_160_rsv
1415
test_170_pbs
1516
test_180_cvmfs
@@ -53,6 +54,7 @@ test_800_gratia
5354
test_820_cvmfs
5455
test_830_rsv
5556
test_835_stashcache
57+
test_838_xrootd_tpc
5658
test_840_xrootd
5759
test_850_lcmaps
5860
test_860_gridftp

osgtest/library/files.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def append(path, contents, force=False, owner=None, backup=True):
176176
return
177177

178178
new_contents = old_contents + [contents]
179-
write(path, new_contents, backup=False)
179+
write(path, new_contents, owner, backup=False)
180180

181181

182182
def restore(path, owner):

osgtest/library/service.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import time
33

44
import osgtest.library.core as core
5+
from osgtest.library import files
56

67
STATUS_RUNNING = 0 # LSB: program is running or service is OK
78
STATUS_STOPPED = 3 # LSB: program is not running according to LSB init standards
@@ -35,13 +36,13 @@ def start(service_name):
3536
core.check_system(command, 'Start ' + service_name + ' service')
3637
core.state[service_name + '.started-service'] = True
3738

38-
def check_start(service_name, timeout=10):
39+
def check_start(service_name, timeout=10, logToCheck = None):
3940
"""
4041
Start a service, 'service_name' via init script or systemd and ensure that
4142
it starts running within a 'timeout' second window (default=10s)
4243
"""
4344
start(service_name)
44-
assert is_running(service_name, timeout=10), "%s is not running" % service_name
45+
assert is_running(service_name, timeout=10, logToCheck = logToCheck), "%s is not running" % service_name
4546

4647
def stop(service_name):
4748
"""
@@ -89,7 +90,7 @@ def status(service_name):
8990
status_rc, _, _ = core.system(command)
9091
return status_rc
9192

92-
def check_status(service_name, expected_status, timeout=10):
93+
def check_status(service_name, expected_status, timeout=10, logToCheck = None):
9394
"""
9495
Return True if the exit code of the 'service_name' status check is
9596
expected_status before 'timeout' seconds. Otherwise, False.
@@ -101,15 +102,20 @@ def check_status(service_name, expected_status, timeout=10):
101102
time.sleep(1)
102103
timer += 1
103104

105+
if status_rc != expected_status and logToCheck!= None:
106+
LogFileContents = files.read(logToCheck)
107+
core.log_message("Last lines of log: %s" % logToCheck)
108+
for line in LogFileContents[-9:]:
109+
core.log_message(line)
104110
return status_rc == expected_status
105111

106-
def is_running(service_name, timeout=1):
112+
def is_running(service_name, timeout=1, logToCheck = None):
107113
"""
108114
Return True if 'service_name' is determined to be running via init script or
109115
systemd, according to LSB init standards, before 'timeout'
110116
seconds. Otherwise, False.
111117
"""
112-
return check_status(service_name, STATUS_RUNNING, timeout)
118+
return check_status(service_name, STATUS_RUNNING, timeout, logToCheck)
113119

114120
def is_stopped(service_name, timeout=1):
115121
"""

osgtest/tests/test_158_xrootd_tpc.py

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -27,44 +27,38 @@
2727
http.cadir /etc/grid-security/certificates
2828
http.cert /etc/grid-security/xrd/xrdcert.pem
2929
http.key /etc/grid-security/xrd/xrdkey.pem
30-
http.secxtractor /usr/lib64/libXrdLcmaps.so
3130
http.listingdeny yes
3231
http.desthttps yes
33-
32+
http.trace all debug
3433
# Enable third-party-copy
3534
http.exthandler xrdtpc libXrdHttpTPC.so
3635
# Pass the bearer token to the Xrootd authorization framework.
3736
http.header2cgi Authorization authz
3837
3938
# Enable Macaroons
4039
ofs.authlib libXrdMacaroons.so libXrdAccSciTokens.so
41-
42-
fi
43-
44-
if named xrd-TPC-1
40+
xrd.port %d
4541
xrd.protocol http:%d /usr/lib64/libXrdHttp-4.so
4642
fi
43+
http.exthandler xrdmacaroons libXrdMacaroons.so
44+
macaroons.secretkey /etc/xrootd/macaroon-secret
45+
all.sitename VDTTESTSITE
4746
48-
if named xrd-TPC-2
49-
xrd.protocol http:%d /usr/lib64/libXrdHttp-4.so
50-
fi
51-
end
5247
"""
5348

5449
class TestStartXrootdTPC(osgunittest.OSGTestCase):
5550
@core.elrelease(7,8)
56-
def test_01_start_xrootd(self):
57-
core.config['certs.xrootdcert'] = '/etc/grid-security/xrd/xrdcert.pem'
58-
core.config['certs.xrootdkey'] = '/etc/grid-security/xrd/xrdkey.pem'
59-
core.config['xrootd.tpc.config'] = '/etc/xrootd/xrootd-third-party-copy.cfg'
51+
def test_01_configure_xrootd(self):
52+
core.config['xrootd.tpc.config-1'] = '/etc/xrootd/xrootd-third-party-copy-1.cfg'
53+
core.config['xrootd.tpc.config-2'] = '/etc/xrootd/xrootd-third-party-copy-2.cfg'
6054
core.config['xrootd.tpc.http-port1'] = HTTP_PORT1
6155
core.config['xrootd.tpc.http-port2'] = HTTP_PORT2
6256
core.state['xrootd.started-http-server-1'] = False
6357
core.state['xrootd.started-http-server-2'] = False
6458
core.state['xrootd.tpc.backups-exist'] = False
6559

6660
self.skip_ok_unless(core.options.adduser, 'user not created')
67-
core.skip_ok_unless_installed('xrootd', by_dependency=True)
61+
core.skip_ok_unless_installed('xrootd', 'xrootd-scitokens', by_dependency=True)
6862

6963
user = pwd.getpwnam("xrootd")
7064
core.skip_ok_unless_installed('globus-proxy-utils')
@@ -73,23 +67,33 @@ def test_01_start_xrootd(self):
7367
if all([core.rpm_is_installed(x) for x in lcmaps_packages]):
7468
core.log_message("Using xrootd-lcmaps authentication")
7569
sec_protocol = '-authzfun:libXrdLcmaps.so -authzfunparms:--loglevel,5'
76-
if core.PackageVersion('xrootd-lcmaps') >= '1.4.0':
77-
sec_protocol += ',--policy,authorize_only'
70+
#XROOTD_CFG_TEXT += "http.secxtractor /usr/lib64/libXrdLcmaps.so/n"
71+
sec_protocol += ',--policy,authorize_only'
7872
else:
7973
core.log_message("Using XRootD mapfile authentication")
8074
sec_protocol = '-gridmap:/etc/grid-security/xrd/xrdmapfile'
8175

82-
files.append(core.config['xrootd.tpc.config'],
83-
XROOTD_CFG_TEXT % (sec_protocol, core.config['xrootd.port']),
84-
owner='xrootd', backup=True)
76+
files.write(core.config['xrootd.tpc.config-1'],
77+
XROOTD_CFG_TEXT % (sec_protocol, core.config['xrootd.tpc.http-port1'], core.config['xrootd.tpc.http-port1']),
78+
owner='xrootd', backup=True, chown=(user.pw_uid, user.pw_gid))
79+
files.write(core.config['xrootd.tpc.config-2'],
80+
XROOTD_CFG_TEXT % (sec_protocol, core.config['xrootd.tpc.http-port2'], core.config['xrootd.tpc.http-port1']),
81+
owner='xrootd', backup=True, chown=(user.pw_uid, user.pw_gid))
8582
core.state['xrootd.tpc.backups-exist'] = True
83+
84+
def test_02_create_secret_key(self):
85+
core.skip_ok_unless_installed('xrootd', 'xrootd-scitokens', by_dependency=True)
86+
core.config['xrootd.tpc.macaroon-secret'] = '/etc/xrootd/macaroon-secret'
87+
core.check_system(["openssl", "rand", "-base64", "-out",
88+
core.config['xrootd.tpc.macaroon-secret'], "64"], "Creating simmetric key")
8689

87-
def test_02_start_xrootd(self):
90+
91+
def test_03_start_xrootd(self):
8892
core.skip_ok_unless_installed('xrootd', 'xrootd-scitokens', by_dependency=True)
89-
core.config['xrootd_tpc_service_1'] = "xrd-TPC-1@third-party-copy"
90-
core.config['xrootd_tpc_service_2'] = "xrd-TPC-2@third-party-copy"
91-
service.check_start(core.config['xrootd_tpc_service_1'])
92-
service.check_start(core.config['xrootd_tpc_service_2'])
93-
94-
core.state['xrootd_tpc_service_1'] = True
95-
core.state['xrootd_tpc_service_2'] = True
93+
core.config['xrootd_tpc_service_1'] = "xrootd@third-party-copy-1"
94+
core.config['xrootd_tpc_service_2'] = "xrootd@third-party-copy-2"
95+
service.check_start(core.config['xrootd_tpc_service_1'], logToCheck = '/var/log/xrootd/third-party-copy-1/xrootd.log')
96+
service.check_start(core.config['xrootd_tpc_service_2'], logToCheck = '/var/log/xrootd/third-party-copy-2/xrootd.log')
97+
core.state['xrootd.started-http-server-1'] = True
98+
core.state['xrootd.started-http-server-2'] = True
99+

osgtest/tests/test_848_xrootd_tpc.py renamed to osgtest/tests/test_838_xrootd_tpc.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@ class TestStopXrootdTPC(osgunittest.OSGTestCase):
77
@core.elrelease(7,8)
88
def test_01_stop_xrootd(self):
99
if core.state['xrootd.tpc.backups-exist']:
10-
files.restore(core.config['xrootd.tpc.config'], "xrootd")
10+
files.restore(core.config['xrootd.tpc.config-1'], "xrootd")
11+
files.restore(core.config['xrootd.tpc.config-2'], "xrootd")
1112

12-
core.skip_ok_unless_installed('xrootd', by_dependency=True)
13-
self.skip_ok_if(core.state['xrootd_tpc_service'], 'did not start server')
13+
core.skip_ok_unless_installed('xrootd', 'xrootd-scitokens', by_dependency=True)
14+
self.skip_ok_if(not core.state['xrootd.started-http-server-1'] and
15+
not core.state['xrootd.started-http-server-2'],
16+
'did not start any of the http servers')
1417
service.check_stop(core.config['xrootd_tpc_service_1'])
1518
service.check_stop(core.config['xrootd_tpc_service_2'])
1619

travis-ci/test_inside_docker.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,4 @@ export _condor_CONDOR_CE_TRACE_ATTEMPTS=60
5757
# Ok, do actual testing
5858
INSTALL_STR="--install ${PACKAGES//,/ --install }"
5959
echo "------------ OSG Test --------------"
60-
osg-test -vad --hostcert --no-cleanup ${INSTALL_STR}
60+
osg-test --extra-repo osg-testing -vad --hostcert --no-cleanup ${INSTALL_STR}

0 commit comments

Comments
 (0)