| |
@@ -10,6 +10,7 @@
|
| |
import sys
|
| |
import signal
|
| |
import subprocess
|
| |
+ from ipsilon.providers.openid.store import CURRENT_OPENID_SCHEMA_VERSION
|
| |
import ipsilon.util.data
|
| |
|
| |
idp_g = {'TEMPLATES': '${TESTDIR}/templates/install',
|
| |
@@ -92,11 +93,16 @@
|
| |
self.use_readonly_adminconfig(name)
|
| |
|
| |
if old_version > 0:
|
| |
- for database in ['adminconfig',
|
| |
+ if old_version <= ipsilon.util.data.CURRENT_SCHEMA_VERSION:
|
| |
+ databases = ['adminconfig',
|
| |
'openid',
|
| |
'saml2.sessions.db',
|
| |
'transactions',
|
| |
- 'userprefs']:
|
| |
+ 'userprefs']
|
| |
+ else:
|
| |
+ databases = ['openid']
|
| |
+
|
| |
+ for database in databases:
|
| |
db_in = os.path.join(db_indir, '%s.sqlite.dump' % database)
|
| |
db_out = os.path.join(db_outdir, '%s.sqlite' % database)
|
| |
os.unlink(db_out)
|
| |
@@ -143,6 +149,15 @@
|
| |
raise Exception('Database upgrade did not introduce ' +
|
| |
'authz_config table')
|
| |
|
| |
+ elif old_version > ipsilon.util.data.CURRENT_SCHEMA_VERSION:
|
| |
+ # Database specific schema changes
|
| |
+ if old_version == 3:
|
| |
+ # OpenID version 4 added the nonce table
|
| |
+ output = self.dump_db(db_outdir, with_readonly)
|
| |
+ if b'TABLE nonce' not in output:
|
| |
+ raise Exception('OpenID database upgrade did not ' +
|
| |
+ 'introduce nonce table')
|
| |
+
|
| |
# Start the httpd server
|
| |
http_server = self.start_http_server(conf, env)
|
| |
|
| |
@@ -180,6 +195,17 @@
|
| |
overall_exit_code = 1
|
| |
overall_results.extend(results)
|
| |
|
| |
+ for version in range(ipsilon.util.data.CURRENT_SCHEMA_VERSION,
|
| |
+ CURRENT_OPENID_SCHEMA_VERSION)
|
| |
+ for with_readonly in [True, False]:
|
| |
+ exit_code, results = self.test_upgrade_from(env,
|
| |
+ version,
|
| |
+ with_readonly)
|
| |
+
|
| |
+ if exit_code != 0:
|
| |
+ overall_exit_code = 1
|
| |
+ overall_results.extend(results)
|
| |
+
|
| |
return overall_exit_code, overall_results
|
| |
|
| |
|
| |
OpenIDStore registers the nonce table for automatic cleanup, but it's
never created. Even though the table isn't required, a SQL error is
logged every time automatic cleanup is triggered if it doesn't exist.
Fixes: #240
Signed-off-by: Dan Nicholson nicholson@endlessm.com