summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2015-08-31 13:32:13 -0700
committerMark Wells <mark@freeside.biz>2015-08-31 13:32:13 -0700
commite949bed143088a77ba89a56ff2a25609a1050159 (patch)
tree3fbb2d15053d3da66ab7d9a8adb242633275de35
parent18b3f884eb44c9d0dea2cedc82c5788f7031e162 (diff)
change test utils to run from the source tree, #37340
-rw-r--r--FS-Test/Makefile.PL34
-rwxr-xr-xFS-Test/bin/freeside-test-fetch8
-rwxr-xr-x[-rw-r--r--]FS-Test/bin/freeside-test-run14
-rwxr-xr-xFS-Test/bin/freeside-test-start7
-rwxr-xr-xFS-Test/bin/freeside-test-stop3
-rw-r--r--FS-Test/lib/FS/Test.pm11
-rw-r--r--FS-Test/share/ui_tests4
7 files changed, 30 insertions, 51 deletions
diff --git a/FS-Test/Makefile.PL b/FS-Test/Makefile.PL
deleted file mode 100644
index cea088a..0000000
--- a/FS-Test/Makefile.PL
+++ /dev/null
@@ -1,34 +0,0 @@
-use 5.006;
-use strict;
-use warnings FATAL => 'all';
-use ExtUtils::MakeMaker;
-use File::ShareDir::Install;
-
-install_share dist => 'share';
-
-WriteMakefile(
- NAME => 'FS::Test',
- AUTHOR => q{Mark Wells <mark@freeside.biz>},
- VERSION_FROM => 'lib/FS/Test.pm',
- ABSTRACT => 'Freeside test suite',
- LICENSE => 'agpl_3',
- PL_FILES => {},
- EXE_FILES => [ glob 'bin/*' ],
- MIN_PERL_VERSION => 5.006,
- CONFIGURE_REQUIRES => {
- 'ExtUtils::MakeMaker' => 0,
- 'File::ShareDir::Install' => 0,
- },
- BUILD_REQUIRES => {
- 'Test::More' => 0,
- },
- PREREQ_PM => {
- 'WWW::Mechanize' => 0,
- },
- dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
- clean => { FILES => 'FS-Test-*' },
-);
-
-package MY;
-use File::ShareDir::Install qw(postamble);
-
diff --git a/FS-Test/bin/freeside-test-fetch b/FS-Test/bin/freeside-test-fetch
index ccc8528..9530057 100755
--- a/FS-Test/bin/freeside-test-fetch
+++ b/FS-Test/bin/freeside-test-fetch
@@ -1,8 +1,14 @@
#!/usr/bin/perl
use strict;
-use FS::Test;
use Getopt::Std;
+use File::Spec;
+
+my @dirs = File::Spec->splitdir(File::Spec->rel2abs(__FILE__));
+splice @dirs, -2; # bin/freeside-test-run
+push @INC, File::Spec->catdir( @dirs, 'lib' );
+eval "use FS::Test;";
+die $@ if $@;
my %opt;
diff --git a/FS-Test/bin/freeside-test-run b/FS-Test/bin/freeside-test-run
index add1e9b..853bdc9 100644..100755
--- a/FS-Test/bin/freeside-test-run
+++ b/FS-Test/bin/freeside-test-run
@@ -2,18 +2,20 @@
set -ae
-tempdir=$( mktemp -d freeside-test.XXXX )
-sharedir=$(perl -MFS::Test -e "print FS::Test::share_dir()")
+tempdir=$( mktemp -d --tmpdir freeside-test.XXXX )
+# get the parent directory of bin/(this script)
+testroot=$( dirname ${BASH_SOURCE[0]} )
+testroot=$( cd $testroot; cd ..; pwd )
echo "Starting test mode."
-freeside-test-start
+$testroot/bin/freeside-test-start
echo "Saving results to $tempdir."
-freeside-test-fetch -d $tempdir
+$testroot/bin/freeside-test-fetch -d $tempdir
echo "Exiting test mode."
-freeside-test-stop || true
+$testroot/bin/freeside-test-stop || true
diffname=freeside-test.`date +%Y%m%d`.diff
echo "Writing diff to $diffname."
-diff -urb "$sharedir/output" "$tempdir" > $diffname
+diff -urb "$testroot/share/output" "$tempdir" > $diffname
diffstat -C $diffname
diff --git a/FS-Test/bin/freeside-test-start b/FS-Test/bin/freeside-test-start
index 4f12e32..ed8e131 100755
--- a/FS-Test/bin/freeside-test-start
+++ b/FS-Test/bin/freeside-test-start
@@ -4,12 +4,15 @@ VERSION='5.0.1'
set -ae
+# get the parent directory of bin/(this script)
+testroot=$( dirname ${BASH_SOURCE[0]} )
+testroot=$( cd $testroot; cd ..; pwd )
+
echo "Stopping services."
sudo service freeside stop
sudo service apache2 stop
newname=freeside_`date +%Y%m%d`
-sharedir=$(perl -MFS::Test -e "print FS::Test::share_dir()")
# get company_name from existing DB, strip whitespace
# (if there is no existing DB, continue anyway)
@@ -34,7 +37,7 @@ fi
if [ $createdb = YES ]; then
echo "Creating new database from stock schema."
createdb --owner=freeside freeside
- sudo -u freeside psql freeside -q -f $sharedir/test.sql > /dev/null
+ sudo -u freeside psql freeside -q -f $testroot/share/test.sql > /dev/null
fi
newtime=$(sudo -u freeside \
diff --git a/FS-Test/bin/freeside-test-stop b/FS-Test/bin/freeside-test-stop
index 7c67f54..6ec505a 100755
--- a/FS-Test/bin/freeside-test-stop
+++ b/FS-Test/bin/freeside-test-stop
@@ -24,9 +24,6 @@ oldname=$( psql -tl | \
if [ -n "$oldname" ]; then
echo "Renaming $oldname to freeside."
psql postgres -c "ALTER DATABASE $oldname RENAME TO freeside"
- echo "Restarting services."
- sudo service apache2 restart
- sudo service freeside restart
fi
echo "Done."
diff --git a/FS-Test/lib/FS/Test.pm b/FS-Test/lib/FS/Test.pm
index aedf502..bc97977 100644
--- a/FS-Test/lib/FS/Test.pm
+++ b/FS-Test/lib/FS/Test.pm
@@ -4,14 +4,15 @@ use 5.006;
use strict;
use warnings FATAL => 'all';
-use File::ShareDir 'dist_dir';
+#use File::ShareDir 'dist_dir';
use WWW::Mechanize;
use File::chdir;
use URI;
use File::Slurp qw(write_file);
use Class::Accessor 'antlers';
+use File::Spec;
-our $VERSION = '0.01';
+our $VERSION = '0.02';
=head1 NAME
@@ -29,7 +30,11 @@ database image, the test plan, and probably other stuff.
=cut
sub share_dir {
- dist_dir('FS-Test')
+# dist_dir('FS-Test')
+# we no longer install this anywhere
+ my @dirs = File::Spec->splitdir(File::Spec->rel2abs(__FILE__));
+ splice @dirs, -3; # lib/FS/Test.pm
+ File::Spec->catdir( @dirs, 'share' );
}
=item new OPTIONS
diff --git a/FS-Test/share/ui_tests b/FS-Test/share/ui_tests
index 8292ae5..2370a1d 100644
--- a/FS-Test/share/ui_tests
+++ b/FS-Test/share/ui_tests
@@ -1,7 +1,7 @@
# reports menu items
search/cust_main.cgi?browse=last
-search/cust_bill.html?OPEN90_date
-search/cust_bill.html?date
+search/cust_bill.html?keywords=OPEN90_date:order_by=invnum
+search/cust_bill.html?keywords=date:order_by=invnum
search/cust_bill.html?magic=_date&agentnum=1&beginning=&ending=10%2F01%2F2015&charged_lt=&charged_gt=200.00&owed_lt=&owed_gt=&open=1
search/cust_bill_pkg.cgi?agentnum=1&status=&cust_classnum=&beginning=01%2F01%2F2016&ending=01%2F31%2F2016
search/cust_pay.html?magic=_date&unapplied=0&beginning=01%2F01%2F2016&agentnum=1&order_by=paynum