Skip to content

Commit a0f8caa

Browse files
committed
OSG 3.3 purge: drop VOMS-Admin tests
1 parent 1ad8568 commit a0f8caa

File tree

6 files changed

+32
-150
lines changed

6 files changed

+32
-150
lines changed

files/test_sequence

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ test_200_voms
1919
test_220_myproxy
2020
test_230_gratia
2121
test_240_tomcat
22-
test_250_voms_admin
2322
test_280_gsiopenssh
2423
test_290_slurm
2524
test_300_misc

osgtest/library/voms.py

Lines changed: 30 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -27,43 +27,25 @@ def _get_sqlloc():
2727
return voms_mysql_so_path
2828

2929

30-
def create_vo(vo, dbusername='voms_osgtest', dbpassword='secret', vomscert='/etc/grid-security/voms/vomscert.pem', vomskey='/etc/grid-security/voms/vomskey.pem', use_voms_admin=False):
31-
"""Create the given VO using either voms-admin or the voms_install_db script that comes with voms-server. A new
30+
def create_vo(vo, dbusername='voms_osgtest', dbpassword='secret', vomscert='/etc/grid-security/voms/vomscert.pem', vomskey='/etc/grid-security/voms/vomskey.pem'):
31+
"""Create the given VO using the voms_install_db script that comes with voms-server. A new
3232
database user with the given username/password is created with access to the VO database.
3333
"""
34-
if use_voms_admin:
35-
command = ('voms-admin-configure', 'install',
36-
'--vo', vo,
37-
'--dbtype', 'mysql', '--createdb', '--deploy-database',
38-
'--dbauser', 'root', '--dbapwd', '', '--dbport', '3306',
39-
'--dbusername', dbusername, '--dbpassword', dbpassword,
40-
'--port', '15151', '--sqlloc', _get_sqlloc(),
41-
'--mail-from', 'root@localhost', '--smtp-host', 'localhost',
42-
'--cert', vomscert,
43-
'--key', vomskey,
44-
'--read-access-for-authenticated-clients')
45-
46-
stdout, _, fail = core.check_system(command, 'Configure VOMS Admin')
47-
good_message = 'VO %s installation finished' % vo
48-
assert good_message in stdout, fail
49-
50-
else:
51-
52-
mysql.execute("CREATE USER '%(dbusername)s'@'localhost';" % locals())
53-
54-
command = ['/usr/share/voms/voms_install_db',
55-
'--voms-vo=' + vo,
56-
'--port=15151',
57-
'--db-type=mysql',
58-
'--db-admin=root',
59-
'--voms-name=' + dbusername,
60-
'--voms-pwd=' + dbpassword,
61-
'--sqlloc=' + _get_sqlloc(),
62-
'--vomscert=' + vomscert,
63-
'--vomskey=' + vomskey,
64-
]
65-
66-
core.check_system(command, 'Create VO')
34+
mysql.execute("CREATE USER '%(dbusername)s'@'localhost';" % locals())
35+
36+
command = ['/usr/share/voms/voms_install_db',
37+
'--voms-vo=' + vo,
38+
'--port=15151',
39+
'--db-type=mysql',
40+
'--db-admin=root',
41+
'--voms-name=' + dbusername,
42+
'--voms-pwd=' + dbpassword,
43+
'--sqlloc=' + _get_sqlloc(),
44+
'--vomscert=' + vomscert,
45+
'--vomskey=' + vomskey,
46+
]
47+
48+
core.check_system(command, 'Create VO')
6749

6850

6951
def advertise_lsc(vo, hostcert='/etc/grid-security/hostcert.pem'):
@@ -89,33 +71,25 @@ def advertise_vomses(vo, hostcert='/etc/grid-security/hostcert.pem'):
8971
files.write(vomses_path, contents, backup=False, chmod=0o644)
9072

9173

92-
def add_user(vo, usercert, use_voms_admin=False):
93-
"""Add the user identified by the given cert to the specified VO. May use voms-admin or direct MySQL statements.
74+
def add_user(vo, usercert):
75+
"""Add the user identified by the given cert to the specified VO. Uses direct MySQL statements instead of voms-admin.
9476
The CA cert that issued the user cert must already be in the database's 'ca' table - this happens automatically if
9577
the CA cert is in /etc/grid-security/certificates when the VOMS database is created.
9678
"""
9779
usercert_dn, usercert_issuer = cagen.certificate_info(usercert)
98-
if use_voms_admin:
99-
hostname = socket.getfqdn()
100-
101-
command = ('voms-admin', '--vo', core.config['voms.vo'], '--host', hostname, '--nousercert', 'create-user',
102-
usercert_dn, usercert_issuer, 'OSG Test User', 'root@localhost')
103-
core.check_system(command, 'Add VO user')
104-
105-
else:
106-
dbname = 'voms_' + vo
80+
dbname = 'voms_' + vo
10781

108-
# Find the index in the "ca" table ("cid") for the OSG Test CA that gets created by voms_install_db.
109-
output, _, _, = mysql.check_execute(r'''SELECT cid FROM ca WHERE ca='%(usercert_issuer)s';''' % locals(),
110-
'Get ID of user cert issuer from database', dbname)
111-
output = output.strip()
112-
assert output, "User cert issuer not found in database"
113-
ca = int(output)
82+
# Find the index in the "ca" table ("cid") for the OSG Test CA that gets created by voms_install_db.
83+
output, _, _, = mysql.check_execute(r'''SELECT cid FROM ca WHERE ca='%(usercert_issuer)s';''' % locals(),
84+
'Get ID of user cert issuer from database', dbname)
85+
output = output.strip()
86+
assert output, "User cert issuer not found in database"
87+
ca = int(output)
11488

115-
mysql.check_execute(r'''
116-
INSERT INTO `usr` VALUES (1,'%(usercert_dn)s',%(ca)d,NULL,'root@localhost',NULL);
117-
INSERT INTO `m` VALUES (1,1,1,NULL,NULL);''' % locals(),
118-
'Add VO user', dbname)
89+
mysql.check_execute(r'''
90+
INSERT INTO `usr` VALUES (1,'%(usercert_dn)s',%(ca)d,NULL,'root@localhost',NULL);
91+
INSERT INTO `m` VALUES (1,1,1,NULL,NULL);''' % locals(),
92+
'Add VO user', dbname)
11993

12094

12195
def destroy_lsc(vo):
@@ -148,12 +122,6 @@ def is_installed():
148122
if not core.dependency_is_installed(dep):
149123
return False
150124

151-
# TODO: drop this check when 3.3 is completely EOL
152-
if core.el_release() >= 7:
153-
if core.PackageVersion('voms-server') < '2.0.12-3.2':
154-
core.log_message("voms-server installed but too old (missing SOFTWARE-2357 fix)")
155-
return False
156-
157125
return True
158126

159127

osgtest/tests/test_200_voms.py

Lines changed: 1 addition & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,12 @@
44
import osgtest.library.core as core
55
import osgtest.library.files as files
66
import osgtest.library.service as service
7-
import osgtest.library.tomcat as tomcat
87
import osgtest.library.voms as voms
98
import osgtest.library.osgunittest as osgunittest
109

1110
class TestStartVOMS(osgunittest.OSGTestCase):
1211

1312
def test_01_config_certs(self):
14-
core.config['certs.httpcert'] = '/etc/grid-security/http/httpcert.pem'
15-
core.config['certs.httpkey'] = '/etc/grid-security/http/httpkey.pem'
1613
core.config['certs.vomscert'] = '/etc/grid-security/voms/vomscert.pem'
1714
core.config['certs.vomskey'] = '/etc/grid-security/voms/vomskey.pem'
1815

@@ -26,23 +23,9 @@ def test_02_install_voms_certs(self):
2623
core.install_cert('certs.vomscert', 'certs.hostcert', 'voms', 0o644)
2724
core.install_cert('certs.vomskey', 'certs.hostkey', 'voms', 0o400)
2825

29-
def test_03_install_http_certs(self):
30-
core.skip_ok_unless_installed('voms-admin-server')
31-
httpcert = core.config['certs.httpcert']
32-
httpkey = core.config['certs.httpkey']
33-
self.skip_ok_if(core.check_file_and_perms(httpcert, 'tomcat', 0o644) and
34-
core.check_file_and_perms(httpkey, 'tomcat', 0o400),
35-
'HTTP cert exists and has proper permissions')
36-
core.install_cert('certs.httpcert', 'certs.hostcert', 'tomcat', 0o644)
37-
core.install_cert('certs.httpkey', 'certs.hostkey', 'tomcat', 0o400)
38-
3926
def test_04_config_voms(self):
4027
core.config['voms.vo'] = 'osgtestvo'
4128
core.config['voms.lock-file'] = '/var/lock/subsys/voms.osgtestvo'
42-
core.config['voms.vo-webapp'] = os.path.join(
43-
tomcat.datadir(), "conf/Catalina/localhost/voms#osgtestvo.xml")
44-
core.config['voms.webapp-log'] = os.path.join(
45-
tomcat.logdir(), 'voms-admin-osgtestvo.log')
4629
# The DB created by voms-admin would have the user 'admin-osgtestvo',
4730
# but the voms_install_db script provided by voms-server does not
4831
# like usernames with '-' in them.
@@ -51,41 +34,11 @@ def test_04_config_voms(self):
5134
def test_05_create_vo(self):
5235
voms.skip_ok_unless_installed()
5336

54-
use_voms_admin = core.rpm_is_installed('voms-admin-server')
5537
voms.create_vo(vo=core.config['voms.vo'],
5638
dbusername=core.config['voms.dbusername'],
5739
dbpassword='secret',
5840
vomscert=core.config['certs.vomscert'],
59-
vomskey=core.config['certs.vomskey'],
60-
use_voms_admin=use_voms_admin)
61-
62-
def test_06_add_local_admin(self):
63-
core.skip_ok_unless_installed('voms-admin-server', 'voms-mysql-plugin')
64-
host_dn, host_issuer = \
65-
cagen.certificate_info(core.config['certs.hostcert'])
66-
command = ('voms-db-deploy.py', 'add-admin',
67-
'--vo', core.config['voms.vo'],
68-
'--dn', host_dn, '--ca', host_issuer)
69-
core.check_system(command, 'Add VO admin')
70-
71-
def test_07_config_va_properties(self):
72-
core.skip_ok_unless_installed('voms-admin-server')
73-
74-
path = os.path.join('/etc/voms-admin', core.config['voms.vo'],
75-
'voms.service.properties')
76-
contents = files.read(path)
77-
78-
had_csrf_line = False
79-
for line in contents:
80-
if 'voms.csrf.log_only' in line:
81-
line = 'voms.csrf.log_only = true\n'
82-
had_csrf_line = True
83-
elif line[-1] != '\n':
84-
line = line + '\n'
85-
if not had_csrf_line:
86-
contents += 'voms.csrf.log_only = true\n'
87-
88-
files.write(path, contents, backup=False)
41+
vomskey=core.config['certs.vomskey'])
8942

9043
def test_08_advertise(self):
9144
voms.skip_ok_unless_installed()
@@ -111,11 +64,3 @@ def test_09_start_voms(self):
11164
service.check_start(core.config['voms_service'])
11265

11366
core.state['voms.started-server'] = True
114-
115-
def test_10_install_vo_webapp(self):
116-
core.state['voms.installed-vo-webapp'] = False
117-
core.skip_ok_unless_installed('voms-admin-server')
118-
self.skip_ok_if(os.path.exists(core.config['voms.vo-webapp']), 'apparently installed')
119-
120-
service.check_start('voms-admin')
121-
core.state['voms.installed-vo-webapp'] = True

osgtest/tests/test_250_voms_admin.py

Lines changed: 0 additions & 14 deletions
This file was deleted.

osgtest/tests/test_407_voms.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,7 @@ def test_01_add_user(self):
2424
pwd_entry = pwd.getpwnam(core.options.username)
2525
cert_path = os.path.join(pwd_entry.pw_dir, '.globus', 'usercert.pem')
2626

27-
use_voms_admin = False
28-
if core.rpm_is_installed('voms-admin-server') and core.rpm_is_installed('voms-admin-client'):
29-
self.skip_bad_unless(core.state['tomcat.started'])
30-
use_voms_admin = True
31-
32-
voms.add_user(core.config['voms.vo'], cert_path, use_voms_admin)
27+
voms.add_user(core.config['voms.vo'], cert_path)
3328

3429
core.state['voms.added-user'] = True
3530

osgtest/tests/test_780_voms.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,6 @@ def test_02_restore_vomses(self):
2525
def test_03_remove_vo(self):
2626
voms.skip_ok_unless_installed()
2727

28-
if core.rpm_is_installed('voms-admin-server'):
29-
# Ask VOMS Admin to remove VO
30-
command = ('voms-admin-configure', 'remove',
31-
'--vo', core.config['voms.vo'],
32-
'--undeploy-database')
33-
stdout, _, fail = core.check_system(command, 'Remove VO')
34-
self.assert_('Database undeployed correctly!' in stdout, fail)
35-
self.assert_(' succesfully removed.' in stdout, fail)
36-
3728
# Really remove database -- the voms-admin-configure command above does
3829
# not actually destroy the mysql database.
3930
voms.destroy_db(core.config['voms.vo'], core.config['voms.dbusername'])
@@ -45,6 +36,4 @@ def test_04_remove_certs(self):
4536
# Do the keys first, so that the directories will be empty for the certs.
4637
core.remove_cert('certs.vomskey')
4738
core.remove_cert('certs.vomscert')
48-
core.remove_cert('certs.httpkey')
49-
core.remove_cert('certs.httpcert')
5039
core.state['voms.removed-certs'] = True

0 commit comments

Comments
 (0)