aboutsummaryrefslogtreecommitdiff
path: root/perl
diff options
context:
space:
mode:
authorRuss Allbery <eagle@eyrie.org>2014-07-11 17:50:56 -0700
committerRuss Allbery <rra@stanford.edu>2014-07-11 19:02:42 -0700
commit323fee4ea9cadeccaead12460c4fa91c1707aefc (patch)
tree6f1c9dc9c34ccc02a2459fe3eb53ee7af5b1938d /perl
parent75ca1315d8390f31e1df13fd763b0d494e9c9eef (diff)
Adjust Wallet::Admin test for new schema version
We now have a 0.09 schema, so test upgrading from 0.07 to 0.09 in two steps. Change-Id: I0e7af4371ba78aa69a9b7be59239f10c86e1fade Reviewed-on: https://gerrit.stanford.edu/1519 Reviewed-by: Russ Allbery <rra@stanford.edu> Tested-by: Russ Allbery <rra@stanford.edu>
Diffstat (limited to 'perl')
-rwxr-xr-xperl/t/admin.t22
1 files changed, 17 insertions, 5 deletions
diff --git a/perl/t/admin.t b/perl/t/admin.t
index 1f3ccba..1bcb85e 100755
--- a/perl/t/admin.t
+++ b/perl/t/admin.t
@@ -3,12 +3,12 @@
# Tests for wallet administrative interface.
#
# Written by Russ Allbery <eagle@eyrie.org>
-# Copyright 2008, 2009, 2010, 2011, 2013
+# Copyright 2008, 2009, 2010, 2011, 2013, 2014
# The Board of Trustees of the Leland Stanford Junior University
#
# See LICENSE for licensing terms.
-use Test::More tests => 24;
+use Test::More tests => 26;
use Wallet::Admin;
use Wallet::Report;
@@ -61,7 +61,6 @@ is ($server->acl_add ('ADMIN', 'base', 'foo'), 1,
$Wallet::Schema::VERSION = '0.07';
is ($admin->reinitialize ('admin@EXAMPLE.COM'), 1,
' and re-initialization succeeds');
-$Wallet::Schema::VERSION = '0.08';
# Test an upgrade. Reinitialize to an older version, then test upgrade to the
# current version.
@@ -73,18 +72,31 @@ SKIP: {
# Delete all tables and then redump them straight from the SQL file to
# avoid getting the version table.
unlink 'wallet-db';
- $admin = eval { Wallet::Admin->new };
my $status = system ('sqlite3', 'wallet-db',
'.read sql/Wallet-Schema-0.07-SQLite.sql');
is ($status, 0, 'Reinstalling database from non-versioned SQL succeds');
+
+ # Upgrade to 0.08.
+ $Wallet::Schema::VERSION = '0.08';
+ $admin = eval { Wallet::Admin->new };
my $retval = $admin->upgrade;
- is ($retval, 1, ' and performing an upgrade succeeds');
+ is ($retval, 1, ' and performing an upgrade to 0.08 succeeds');
my $sql = "select version from dbix_class_schema_versions order by"
. " version DESC";
$version = $admin->dbh->selectall_arrayref ($sql);
is (@$version, 2, ' and versions table has correct number of rows');
is (@{ $version->[0] }, 1, ' and correct number of columns');
is ($version->[0][0], '0.08', ' and the schema version is correct');
+
+ # Upgrade to 0.09.
+ $Wallet::Schema::VERSION = '0.09';
+ $admin = eval { Wallet::Admin->new };
+ $retval = $admin->upgrade;
+ is ($retval, 1, ' and performing an upgrade to 0.09 succeeds');
+ $sql = "select version from dbix_class_schema_versions order by"
+ . " version DESC";
+ $version = $admin->dbh->selectall_arrayref ($sql);
+ is ($version->[0][0], '0.09', ' and the schema version is correct');
}
# Clean up.