summaryrefslogtreecommitdiffstats
path: root/src/tests/t_kdb.py
diff options
context:
space:
mode:
authorGreg Hudson <ghudson@mit.edu>2012-12-16 16:55:29 -0500
committerGreg Hudson <ghudson@mit.edu>2012-12-20 11:45:20 -0500
commit966547dfeb011800d4b78b8e5d494813bc80559c (patch)
tree4226bd168056336c965a4aa77c845093ef723da3 /src/tests/t_kdb.py
parent76c27cf7e3161e0f20f8935d82ae0f2feb77b01a (diff)
downloadkrb5-966547dfeb011800d4b78b8e5d494813bc80559c.tar.gz
krb5-966547dfeb011800d4b78b8e5d494813bc80559c.tar.xz
krb5-966547dfeb011800d4b78b8e5d494813bc80559c.zip
Simplify k5test.py environments
The initial k5test.py design, copied from the dejagnu suite, is to create config files and environments for four expected roles: client, server, master, and slave. This approach exaggerates the complexity of the common case, where the configurations don't need to vary, and limits us to having just one slave for kprop/iprop tests. Instead, create just one configuration by default, and add a special_env() method which sets up a differently configured environment for the few test cases which need one. The run_as_*() methods are collapsed into just run(), which accepts an optional argument for the environment returned by special_env().
Diffstat (limited to 'src/tests/t_kdb.py')
-rw-r--r--src/tests/t_kdb.py36
1 files changed, 17 insertions, 19 deletions
diff --git a/src/tests/t_kdb.py b/src/tests/t_kdb.py
index 2f0d6fd90e..3c664f0ef4 100644
--- a/src/tests/t_kdb.py
+++ b/src/tests/t_kdb.py
@@ -13,7 +13,7 @@ def which(progname):
# Run kdbtest against the BDB module.
realm = K5Realm(create_kdb=False)
-realm.run_as_master(['./kdbtest'])
+realm.run(['./kdbtest'])
# Set up an OpenLDAP test server if we can.
@@ -87,24 +87,22 @@ output('*** Started slapd (pid %d, output in %s)\n' % (slapd_pid, slapd_out))
time.sleep(1)
# Run kdbtest against the LDAP module.
-kdc_conf = {'all': {
- 'realms': {'$realm': {'database_module': 'ldap'}},
- 'dbmodules': {'ldap': {
- 'db_library': 'kldap',
- 'ldap_kerberos_container_dn': top_dn,
- 'ldap_kdc_dn': admin_dn,
- 'ldap_kadmind_dn': admin_dn,
- 'ldap_service_password_file': ldap_pwfile,
- 'ldap_servers': ldap_uri}}}}
-realm = K5Realm(create_kdb=False, kdc_conf=kdc_conf)
+conf = {'realms': {'$realm': {'database_module': 'ldap'}},
+ 'dbmodules': {'ldap': {'db_library': 'kldap',
+ 'ldap_kerberos_container_dn': top_dn,
+ 'ldap_kdc_dn': admin_dn,
+ 'ldap_kadmind_dn': admin_dn,
+ 'ldap_service_password_file': ldap_pwfile,
+ 'ldap_servers': ldap_uri}}}
+realm = K5Realm(create_kdb=False, kdc_conf=conf)
input = admin_pw + '\n' + admin_pw + '\n'
-realm.run_as_master([kdb5_ldap_util, 'stashsrvpw', admin_dn], input=input)
-realm.run_as_master(['./kdbtest'])
+realm.run([kdb5_ldap_util, 'stashsrvpw', admin_dn], input=input)
+realm.run(['./kdbtest'])
# Run a kdb5_ldap_util command using the test server's admin DN and password.
def kldaputil(args, **kw):
- return realm.run_as_master([kdb5_ldap_util, '-D', admin_dn, '-w',
- admin_pw] + args, **kw)
+ return realm.run([kdb5_ldap_util, '-D', admin_dn, '-w', admin_pw] + args,
+ **kw)
# kdbtest can't currently clean up after itself since the LDAP module
# doesn't support krb5_db_destroy. So clean up after it with
@@ -243,17 +241,17 @@ realm.addprinc(realm.user_princ, password('user'))
realm.addprinc(realm.host_princ)
realm.extract_keytab(realm.host_princ, realm.keytab)
realm.kinit(realm.user_princ, password('user'))
-realm.run_as_client([kvno, realm.host_princ])
+realm.run([kvno, realm.host_princ])
realm.klist(realm.user_princ, realm.host_princ)
realm.stop()
# Briefly test dump and load.
dumpfile = os.path.join(realm.testdir, 'dump')
-realm.run_as_master([kdb5_util, 'dump', dumpfile])
-out = realm.run_as_master([kdb5_util, 'load', dumpfile], expected_code=1)
+realm.run([kdb5_util, 'dump', dumpfile])
+out = realm.run([kdb5_util, 'load', dumpfile], expected_code=1)
if 'plugin requires -update argument' not in out:
fail('Unexpected error from kdb5_util load without -update')
-realm.run_as_master([kdb5_util, 'load', '-update', dumpfile])
+realm.run([kdb5_util, 'load', '-update', dumpfile])
# Destroy the realm.
kldaputil(['destroy', '-f'])