diff options
author | Russ Allbery <rra@stanford.edu> | 2013-03-29 13:56:45 -0700 |
---|---|---|
committer | Russ Allbery <rra@stanford.edu> | 2013-03-29 13:58:09 -0700 |
commit | 3ca875d70c2f7415675ebcceef261c1224f03db0 (patch) | |
tree | 689113be7e8ed5f1fd7e1bd144dff32a0ed5284f | |
parent | bb41f28d6edc33a9b5b3943eda403cadea33e8ae (diff) |
Make t/admin.t test robust against missing sqlite3 binary
If we can't find the sqlite3 binary, just skip the upgrade test.
Reviewed-on: https://gerrit.stanford.edu/994
Reviewed-by: Russ Allbery <rra@stanford.edu>
Tested-by: Russ Allbery <rra@stanford.edu>
(cherry picked from commit 15fea5552df18667b39fce620488ed6c48bd7329)
Change-Id: I26cd8148d58368767f39d135afe4c721652b0740
-rw-r--r-- | README | 11 | ||||
-rwxr-xr-x | perl/t/admin.t | 41 |
2 files changed, 29 insertions, 23 deletions
@@ -117,11 +117,12 @@ REQUIREMENTS should be skipped, but not all the permutations have been checked. The full test suite also requires the Test::Pod Perl module (available from CPAN), that remctld be installed and available on the user's path or in - /usr/local/sbin or /usr/sbin, that test cases can run services on and - connect to port 14373 on 127.0.0.1, and that kinit and either kvno or - kgetcred (which come with Kerberos) be installed and available on the - user's path. The full test suite also requires a local keytab and some - additional configuration. + /usr/local/sbin or /usr/sbin, that sqlite3 be installed and available on + the user's path, that test cases can run services on and connect to port + 14373 on 127.0.0.1, and that kinit and either kvno or kgetcred (which + come with Kerberos) be installed and available on the user's path. The + full test suite also requires a local keytab and some additional + configuration. To bootstrap from a Git checkout, or if you change the Automake files and need to regenerate Makefile.in, you will need Automake 1.11 or diff --git a/perl/t/admin.t b/perl/t/admin.t index bf6ebce..740c79e 100755 --- a/perl/t/admin.t +++ b/perl/t/admin.t @@ -3,7 +3,7 @@ # Tests for wallet administrative interface. # # Written by Russ Allbery <rra@stanford.edu> -# Copyright 2008, 2009, 2010, 2011 +# Copyright 2008, 2009, 2010, 2011, 2013 # The Board of Trustees of the Leland Stanford Junior University # # See LICENSE for licensing terms. @@ -63,24 +63,29 @@ is ($admin->reinitialize ('admin@EXAMPLE.COM'), 1, ' and re-initialization succeeds'); $Wallet::Schema::VERSION = '0.08'; -# 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 ('/usr/bin/sqlite3', 'wallet-db', - '.read sql/Wallet-Schema-0.07-SQLite.sql'); -is ($status, 0, 'Reinstalling database from non-versioned version succeds'); +# Test an upgrade. Reinitialize to an older version, then test upgrade to the +# current version. +SKIP: { + my @path = (split (':', $ENV{PATH})); + my ($sqlite) = grep { -x $_ } map { "$_/sqlite3" } @path; + skip 'sqlite3 not found', 5 unless $sqlite; -# Test an upgrade. Reinitialize to an older version, then test upgrade to -# the current version. -my $retval = $admin->upgrade; -is ($retval, 1, ' and performing an upgrade 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'); + # 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'); + my $retval = $admin->upgrade; + is ($retval, 1, ' and performing an upgrade 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'); +} # Clean up. is ($admin->destroy, 1, 'Destruction succeeds'); |