From a25e0a528a038aa58fdfe88e2a8603b67a978e6c Mon Sep 17 00:00:00 2001 From: Colin Newell Date: Fri, 5 May 2017 19:07:10 +0100 Subject: [PATCH 1/4] Add option to run MySQL tests against another host --- t/004_runtime_mysql.t | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/t/004_runtime_mysql.t b/t/004_runtime_mysql.t index c1e9fe1..0d3ca12 100644 --- a/t/004_runtime_mysql.t +++ b/t/004_runtime_mysql.t @@ -22,10 +22,10 @@ BEGIN { ## Setup %db_config = ( - user => 'perl_tester', - password => '', - database => 'test_altsql', - host => 'localhost', + user => $ENV{MYSQL_TEST_USER} || 'perl_tester', + password => $ENV{MYSQL_TEST_PASSWORD} || '', + database => $ENV{MYSQL_TEST_DB} || 'test_altsql', + host => $ENV{MYSQL_TEST_HOST} || 'localhost', sql_files => [ $FindBin::Bin . '/sql/sakila-schema.sql', $FindBin::Bin . '/sql/sakila-data.sql', From 281e2e850656f8273a3ebe3d393373299971a1f9 Mon Sep 17 00:00:00 2001 From: Colin Newell Date: Sat, 20 May 2017 18:04:09 +0100 Subject: [PATCH 2/4] Allow mysql binary location to be specified too --- t/004_runtime_mysql.t | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/004_runtime_mysql.t b/t/004_runtime_mysql.t index 0d3ca12..da933d1 100644 --- a/t/004_runtime_mysql.t +++ b/t/004_runtime_mysql.t @@ -30,7 +30,7 @@ BEGIN { $FindBin::Bin . '/sql/sakila-schema.sql', $FindBin::Bin . '/sql/sakila-data.sql', ], - mysql_client => '/opt/local/bin/mysql5', + mysql_client => $ENV{MYSQL_TEST_CLIENT} || '/opt/local/bin/mysql5', ); my $app = App::AltSQL->new( From 1c3613771057e8cdf8860497358fd3909f5f214a Mon Sep 17 00:00:00 2001 From: Colin Newell Date: Sat, 20 May 2017 22:00:58 +0100 Subject: [PATCH 3/4] Added note to add documentation --- t/004_runtime_mysql.t | 1 + 1 file changed, 1 insertion(+) diff --git a/t/004_runtime_mysql.t b/t/004_runtime_mysql.t index da933d1..88b4ef6 100644 --- a/t/004_runtime_mysql.t +++ b/t/004_runtime_mysql.t @@ -11,6 +11,7 @@ use My::Common; if (! $ENV{MYSQL_TESTS}) { ok 1, "Skipping tests as \$ENV{MYSQL_TESTS} is not set; this is for developer regression testing"; + # FIXME: mention MYSQL_TEST_CLIENT, MYSQL_TEST_HOST, MYSQL_TEST_DB, MYSQL_TEST_USER and MYSQL_TEST_PASSWORD done_testing; exit; } From 1d165eeb23cd4ab7b883ffe0e0837743dd9ab38e Mon Sep 17 00:00:00 2001 From: Colin Newell Date: Wed, 24 May 2017 20:57:26 +0100 Subject: [PATCH 4/4] Make it more obvious that the mysql tests skip. Also document the new environment variables. --- t/004_runtime_mysql.t | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/t/004_runtime_mysql.t b/t/004_runtime_mysql.t index 88b4ef6..5eb4b73 100644 --- a/t/004_runtime_mysql.t +++ b/t/004_runtime_mysql.t @@ -9,11 +9,18 @@ use lib "$FindBin::Bin/lib/"; use My::ModifierResub; use My::Common; -if (! $ENV{MYSQL_TESTS}) { - ok 1, "Skipping tests as \$ENV{MYSQL_TESTS} is not set; this is for developer regression testing"; - # FIXME: mention MYSQL_TEST_CLIENT, MYSQL_TEST_HOST, MYSQL_TEST_DB, MYSQL_TEST_USER and MYSQL_TEST_PASSWORD - done_testing; - exit; +BEGIN +{ + if (! $ENV{MYSQL_TESTS}) { + note 'To configure the database server used to test against'; + note 'set these environment variables, MYSQL_TEST_CLIENT, MYSQL_TEST_HOST,'; + note 'MYSQL_TEST_DB, MYSQL_TEST_USER and MYSQL_TEST_PASSWORD'; + note ''; + note 'For example,'; + note 'MYSQL_TEST_CLIENT=`which mysql` MYSQL_TEST_HOST=mysql MYSQL_TEST_DB=test MYSQL_TEST_USER=dev MYSQL_TEST_PASSWORD=devpass MYSQL_TESTS=1 prove -l t'; + note ''; + plan skip_all => "Skipping tests as \$ENV{MYSQL_TESTS} is not set; this is for developer regression testing"; + } } BEGIN {