From b203e7907fa4808966521da8e18d9796e28e9b9a Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Thu, 15 Jan 2015 14:02:19 +0000 Subject: Rename test-wrapper to run-tests. As that's what it does; and use it in Travis. --- .travis.yml | 9 +-------- bin/run-tests | 35 +++++++++++++++++++++++++++++++++++ bin/site-specific-install.sh | 2 +- bin/test-wrapper | 35 ----------------------------------- cpanfile | 2 +- perllib/FixMyStreet/TestAppProve.pm | 2 +- 6 files changed, 39 insertions(+), 46 deletions(-) create mode 100755 bin/run-tests delete mode 100755 bin/test-wrapper diff --git a/.travis.yml b/.travis.yml index 1e4b7611f..207f4a3c7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,16 +25,9 @@ before_install: install: - .travis/install before_script: - - psql -c 'create database fms;' -U postgres - - psql fms postgres < db/schema.sql - - psql fms postgres < db/alert_types.sql - - psql fms postgres < db/generate_secret.sql - - > - sed -r -e "s,(FMS_DB_USER:) 'fms',\\1 'postgres'," - conf/general.yml-example > conf/general.yml - ./bin/cron-wrapper ./bin/make_po FixMyStreet-EmptyHomes - ./bin/cron-wrapper ./bin/emptyhomes/make_welsh_po - commonlib/bin/gettext-makemo FixMyStreet -script: "bin/cron-wrapper perl /usr/bin/prove -rl t" +script: "bin/run-tests t" after_script: - .travis/after_script diff --git a/bin/run-tests b/bin/run-tests new file mode 100755 index 000000000..42315e2f2 --- /dev/null +++ b/bin/run-tests @@ -0,0 +1,35 @@ +#!/usr/bin/env perl +use strict; use warnings; + +BEGIN { + use FindBin; + require "$FindBin::Bin/../setenv.pl"; +} + +use FixMyStreet::TestAppProve; + +=head1 NAME + +bin/run-tests - spin up a clean database and configuration for tests + +=head1 USAGE + + bin/run-tests t/ # runs prove -r t/ (recursively, saving state) + bin/run-tests --state=failed # runs just failing tests + # delete .prove to reset + + bin/run-tests t/foo.t # runs with prove -v (single test) + +By default we use conf/general.yml-example as the template, and spin up a fresh +Postgres cluster and database. We can override this by doing: + + bin/run-tests --config=general.mycobrand.yml + bin/run-tests --db-config=general.yml # e.g. use your current DB settings + bin/run-tests --all-config=general.yml # e.g. use your current DB settings + +(NB: passing --state=save automagically is experimental, and will be removed if +it turns out to be annoying.) + +=cut + +FixMyStreet::TestAppProve->run(@ARGV); diff --git a/bin/site-specific-install.sh b/bin/site-specific-install.sh index 3d01be469..de75d45ae 100644 --- a/bin/site-specific-install.sh +++ b/bin/site-specific-install.sh @@ -66,4 +66,4 @@ fi echo Installation complete - you should now be able to view the site at: echo http://$HOST/ echo Or you can run the tests by switching to the "'$UNIX_USER'" user and -echo running: $REPOSITORY/bin/cron-wrapper prove -r t +echo running: $REPOSITORY/bin/run-tests t diff --git a/bin/test-wrapper b/bin/test-wrapper deleted file mode 100755 index 9cb1791a1..000000000 --- a/bin/test-wrapper +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env perl -use strict; use warnings; - -BEGIN { - use FindBin; - require "$FindBin::Bin/../setenv.pl"; -} - -use FixMyStreet::TestAppProve; - -=head1 NAME - -bin/test-wrapper - spin up a clean database and configuration for tests - -=head1 USAGE - - bin/test-wrapper t/ # runs prove -r t/ (recursively, saving state) - bin/test-wrapper --state=failed # runs just failing tests - # delete .prove to reset - - bin/test-wrapper t/foo.t # runs with prove -v (single test) - -By default we use conf/general.yml-example as the template, and spin up a fresh -Postgres cluster and database. We can override this by doing: - - bin/test-wrapper --config=general.mycobrand.yml - bin/test-wrapper --db-config=general.yml # e.g. use your current DB settings - bin/test-wrapper --all-config=general.yml # e.g. use your current DB settings - -(NB: passing --state=save automagically is experimental, and will be removed if -it turns out to be annoying.) - -=cut - -FixMyStreet::TestAppProve->run(@ARGV); diff --git a/cpanfile b/cpanfile index cda6cc131..e6cb1d83d 100644 --- a/cpanfile +++ b/cpanfile @@ -110,7 +110,7 @@ requires 'File::ChangeNotify'; requires 'Path::Tiny'; requires 'File::Find::Rule'; -feature 'test-wrapper', 'Spin up a test database and config to run tests' => sub { +feature 'run-tests', 'Spin up a test database and config to run tests' => sub { requires 'Test::PostgreSQL'; }; diff --git a/perllib/FixMyStreet/TestAppProve.pm b/perllib/FixMyStreet/TestAppProve.pm index 4d8cdaccb..75e9fe0a4 100644 --- a/perllib/FixMyStreet/TestAppProve.pm +++ b/perllib/FixMyStreet/TestAppProve.pm @@ -14,7 +14,7 @@ FixMyStreet::TestAppProve - spin up a clean database and configuration for tests =head1 USAGE -see bin/test-wrapper for usage +see bin/run-tests for usage =cut -- cgit v1.2.3