Skip to content

Commit

Permalink
introduced a TEST_NGINX_MYSQL_HOST variable in the test suite. now we…
Browse files Browse the repository at this point in the history
… can test against a remote mysql directly (without a local tcp proxy).
  • Loading branch information
agentzh committed Nov 8, 2011
1 parent b584915 commit cc6265c
Show file tree
Hide file tree
Showing 12 changed files with 32 additions and 20 deletions.
3 changes: 2 additions & 1 deletion t/bugs.t
Expand Up @@ -9,10 +9,11 @@ repeat_each(2);
plan tests => repeat_each() * blocks() + 2;

$ENV{TEST_NGINX_MYSQL_PORT} ||= 3306;
$ENV{TEST_NGINX_MYSQL_HOST} ||= '127.0.0.1';

our $http_config = <<'_EOC_';
upstream foo {
drizzle_server 127.0.0.1:$TEST_NGINX_MYSQL_PORT protocol=mysql
drizzle_server $TEST_NGINX_MYSQL_HOST:$TEST_NGINX_MYSQL_PORT protocol=mysql
dbname=ngx_test user=ngx_test password=ngx_test;
}
_EOC_
Expand Down
3 changes: 2 additions & 1 deletion t/charset/000_init.t
Expand Up @@ -8,10 +8,11 @@ repeat_each(1);
plan tests => repeat_each() * blocks();

$ENV{TEST_NGINX_MYSQL_PORT} ||= 3306;
$ENV{TEST_NGINX_MYSQL_HOST} ||= '127.0.0.1';

our $http_config = <<'_EOC_';
upstream database {
drizzle_server 127.0.0.1:$TEST_NGINX_MYSQL_PORT protocol=mysql
drizzle_server $TEST_NGINX_MYSQL_HOST:$TEST_NGINX_MYSQL_PORT protocol=mysql
dbname=ngx_test user=ngx_test password=ngx_test
charset=utf8;
}
Expand Down
5 changes: 3 additions & 2 deletions t/charset/errors.t
Expand Up @@ -8,10 +8,11 @@ repeat_each(2);
plan tests => repeat_each() * blocks() + 4;

$ENV{TEST_NGINX_MYSQL_PORT} ||= 3306;
$ENV{TEST_NGINX_MYSQL_HOST} ||= '127.0.0.1';

our $http_config = <<'_EOC_';
upstream foo {
drizzle_server 127.0.0.1:$TEST_NGINX_MYSQL_PORT protocol=mysql
drizzle_server $TEST_NGINX_MYSQL_HOST:$TEST_NGINX_MYSQL_PORT protocol=mysql
dbname=ngx_test user=ngx_test password=ngx_test
charset=utf8;
}
Expand Down Expand Up @@ -166,7 +167,7 @@ little-endian systems only
--- http_config
upstream foo {
drizzle_server 127.0.0.1:$TEST_NGINX_MYSQL_PORT protocol=mysql
drizzle_server $TEST_NGINX_MYSQL_HOST:$TEST_NGINX_MYSQL_PORT protocol=mysql
dbname=ngx_test user=ngx_test password=ngx_test
charset=blah-blah;
}
Expand Down
5 changes: 3 additions & 2 deletions t/charset/keepalive.t
@@ -1,4 +1,4 @@
# vi:filetype=perl
# vi:filetype=

use lib 'lib';
use Test::Nginx::Socket;
Expand All @@ -8,10 +8,11 @@ repeat_each(2);
plan tests => repeat_each() * 2 * blocks() + 2 * repeat_each() * 6;

$ENV{TEST_NGINX_MYSQL_PORT} ||= 3306;
$ENV{TEST_NGINX_MYSQL_HOST} ||= '127.0.0.1';

our $http_config = <<'_EOC_';
upstream backend {
drizzle_server 127.0.0.1:$TEST_NGINX_MYSQL_PORT protocol=mysql
drizzle_server $TEST_NGINX_MYSQL_HOST:$TEST_NGINX_MYSQL_PORT protocol=mysql
dbname=ngx_test user=ngx_test password=ngx_test
charset=utf8;
drizzle_keepalive max=10 overflow=ignore mode=single;
Expand Down
5 changes: 3 additions & 2 deletions t/charset/methods.t
@@ -1,4 +1,4 @@
# vi:filetype=perl
# vi:filetype=

use lib 'lib';
use Test::Nginx::Socket;
Expand All @@ -8,10 +8,11 @@ repeat_each(2);
plan tests => repeat_each() * (blocks() * 3 - 2 * 2);

$ENV{TEST_NGINX_MYSQL_PORT} ||= 3306;
$ENV{TEST_NGINX_MYSQL_HOST} ||= '127.0.0.1';

our $http_config = <<'_EOC_';
upstream database {
drizzle_server 127.0.0.1:$TEST_NGINX_MYSQL_PORT protocol=mysql
drizzle_server $TEST_NGINX_MYSQL_HOST:$TEST_NGINX_MYSQL_PORT protocol=mysql
dbname=ngx_test user=ngx_test password=ngx_test
charset=utf8;
}
Expand Down
5 changes: 3 additions & 2 deletions t/charset/sanity.t
@@ -1,4 +1,4 @@
# vi:filetype=perl
# vi:filetype=

use lib 'lib';
use Test::Nginx::Socket;
Expand All @@ -9,10 +9,11 @@ repeat_each(2);
plan tests => repeat_each() * 2 * blocks() + 2 * repeat_each() * 6;

$ENV{TEST_NGINX_MYSQL_PORT} ||= 3306;
$ENV{TEST_NGINX_MYSQL_HOST} ||= '127.0.0.1';

our $http_config = <<'_EOC_';
upstream backend {
drizzle_server 127.0.0.1:$TEST_NGINX_MYSQL_PORT protocol=mysql
drizzle_server $TEST_NGINX_MYSQL_HOST:$TEST_NGINX_MYSQL_PORT protocol=mysql
dbname=ngx_test user=ngx_test password=ngx_test
charset=utf8;
#drizzle_keepalive max=10 overflow=ignore mode=single;
Expand Down
3 changes: 2 additions & 1 deletion t/errors.t
Expand Up @@ -8,10 +8,11 @@ repeat_each(2);
plan tests => repeat_each() * blocks() + 2;

$ENV{TEST_NGINX_MYSQL_PORT} ||= 3306;
$ENV{TEST_NGINX_MYSQL_HOST} ||= '127.0.0.1';

our $http_config = <<'_EOC_';
upstream foo {
drizzle_server 127.0.0.1:$TEST_NGINX_MYSQL_PORT protocol=mysql
drizzle_server $TEST_NGINX_MYSQL_HOST:$TEST_NGINX_MYSQL_PORT protocol=mysql
dbname=ngx_test user=ngx_test password=ngx_test;
}
_EOC_
Expand Down
3 changes: 2 additions & 1 deletion t/keepalive.t
Expand Up @@ -8,10 +8,11 @@ repeat_each(2);
plan tests => repeat_each() * 2 * blocks() + 2 * repeat_each() * 6;

$ENV{TEST_NGINX_MYSQL_PORT} ||= 3306;
$ENV{TEST_NGINX_MYSQL_HOST} ||= '127.0.0.1';

our $http_config = <<'_EOC_';
upstream backend {
drizzle_server 127.0.0.1:$TEST_NGINX_MYSQL_PORT protocol=mysql
drizzle_server $TEST_NGINX_MYSQL_HOST:$TEST_NGINX_MYSQL_PORT protocol=mysql
dbname=ngx_test user=ngx_test password=ngx_test;
drizzle_keepalive max=10 overflow=ignore mode=single;
}
Expand Down
5 changes: 3 additions & 2 deletions t/methods.t
@@ -1,4 +1,4 @@
# vi:filetype=perl
# vi:filetype=

use lib 'lib';
use Test::Nginx::Socket;
Expand All @@ -8,10 +8,11 @@ repeat_each(2);
plan tests => repeat_each() * 26;

$ENV{TEST_NGINX_MYSQL_PORT} ||= 3306;
$ENV{TEST_NGINX_MYSQL_HOST} ||= '127.0.0.1';

our $http_config = <<'_EOC_';
upstream database {
drizzle_server 127.0.0.1:$TEST_NGINX_MYSQL_PORT protocol=mysql
drizzle_server $TEST_NGINX_MYSQL_HOST:$TEST_NGINX_MYSQL_PORT protocol=mysql
dbname=ngx_test user=ngx_test password=ngx_test;
}
_EOC_
Expand Down
3 changes: 2 additions & 1 deletion t/sanity.t
Expand Up @@ -8,10 +8,11 @@ repeat_each(2);
plan tests => repeat_each() * 2 * blocks() + 2 * repeat_each() * 6;

$ENV{TEST_NGINX_MYSQL_PORT} ||= 3306;
$ENV{TEST_NGINX_MYSQL_HOST} ||= '127.0.0.1';

our $http_config = <<'_EOC_';
upstream backend {
drizzle_server 127.0.0.1:$TEST_NGINX_MYSQL_PORT protocol=mysql
drizzle_server $TEST_NGINX_MYSQL_HOST:$TEST_NGINX_MYSQL_PORT protocol=mysql
dbname=ngx_test user=ngx_test password=ngx_test;
#drizzle_keepalive max=10 overflow=ignore mode=single;
}
Expand Down
9 changes: 5 additions & 4 deletions t/status.t
Expand Up @@ -8,17 +8,18 @@ use Test::Nginx::Socket;
plan tests => repeat_each() * 2 * blocks();

$ENV{TEST_NGINX_MYSQL_PORT} ||= 3306;
$ENV{TEST_NGINX_MYSQL_HOST} ||= '127.0.0.1';

#master_on();

our $http_config = <<'_EOC_';
upstream backend {
drizzle_server 127.0.0.1:$TEST_NGINX_MYSQL_PORT protocol=mysql
drizzle_server $TEST_NGINX_MYSQL_HOST:$TEST_NGINX_MYSQL_PORT protocol=mysql
dbname=ngx_test user=ngx_test password=ngx_test;
drizzle_keepalive max=10 overflow=reject mode=single;
}
upstream backend2 {
drizzle_server 127.0.0.1:$TEST_NGINX_MYSQL_PORT protocol=mysql
drizzle_server $TEST_NGINX_MYSQL_HOST:$TEST_NGINX_MYSQL_PORT protocol=mysql
dbname=ngx_test user=ngx_test password=ngx_test;
#drizzle_keepalive max=10 overflow=ignore mode=single;
}
Expand All @@ -29,12 +30,12 @@ _EOC_

our $http_config2 = <<'_EOC_';
upstream backend {
drizzle_server 127.0.0.1:$TEST_NGINX_MYSQL_PORT protocol=mysql
drizzle_server $TEST_NGINX_MYSQL_HOST:$TEST_NGINX_MYSQL_PORT protocol=mysql
dbname=ngx_test user=ngx_test password=ngx_test;
drizzle_keepalive max=10 overflow=reject mode=single;
}
upstream backend2 {
drizzle_server 127.0.0.1:$TEST_NGINX_MYSQL_PORT protocol=mysql
drizzle_server $TEST_NGINX_MYSQL_HOST:$TEST_NGINX_MYSQL_PORT protocol=mysql
dbname=ngx_test user=ngx_test password=ngx_test;
drizzle_keepalive max=5 overflow=ignore mode=multi;
}
Expand Down
3 changes: 2 additions & 1 deletion t/timeout.t
Expand Up @@ -18,6 +18,7 @@ worker_connections(128);
#log_level('error');

$ENV{TEST_NGINX_MYSQL_PORT} ||= 3306;
$ENV{TEST_NGINX_MYSQL_HOST} ||= '127.0.0.1';

no_diff();

Expand Down Expand Up @@ -131,7 +132,7 @@ X-Mysql-Tid:
=== TEST 6: serv_config send query timeout (sleep select)
--- http_config
upstream backend {
drizzle_server 127.0.0.1:$TEST_NGINX_MYSQL_PORT protocol=mysql
drizzle_server $TEST_NGINX_MYSQL_HOST:$TEST_NGINX_MYSQL_PORT protocol=mysql
dbname=ngx_test user=ngx_test password=ngx_test;
}
Expand Down

0 comments on commit cc6265c

Please sign in to comment.