diff --git a/tests/nginx-tests/tengine-tests/dynamic_resolve.t b/tests/nginx-tests/tengine-tests/dynamic_resolve.t index 262b3000a1..41057694d0 100644 --- a/tests/nginx-tests/tengine-tests/dynamic_resolve.t +++ b/tests/nginx-tests/tengine-tests/dynamic_resolve.t @@ -16,7 +16,6 @@ BEGIN { use FindBin; chdir($FindBin::Bin); } use lib 'lib'; use Test::Nginx; -eval { require Net::DNS::Nameserver; }; plan(skip_all => 'Net::DNS::Nameserver not installed') if $@; ############################################################################### @@ -148,7 +147,7 @@ kill $^O eq 'MSWin32' ? 9 : 'TERM', $dns_pid; wait; # wait for dns cache to expire -sleep(2); +sleep(3); unlike(http_get('/stale'), qr/127\.0\.0\.2/, 'stale http server should be www.taobao.com:8081, using initial result'); @@ -251,6 +250,8 @@ sub reply_handler { } sub dns_server_daemon { + eval { require Net::DNS::Nameserver; }; + my $ns = new Net::DNS::Nameserver( LocalAddr => '127.0.0.1', LocalPort => 53530, @@ -258,7 +259,7 @@ sub dns_server_daemon { Verbose => 0 ) or die "couldn't create nameserver object\n"; - $ns->main_loop; + $ns->start_server(1); } ############################################################################### diff --git a/tests/nginx-tests/tengine-tests/vnswrr4dynamic_ups.t b/tests/nginx-tests/tengine-tests/vnswrr4dynamic_ups.t index d0e17b1a06..4769ea5f86 100644 --- a/tests/nginx-tests/tengine-tests/vnswrr4dynamic_ups.t +++ b/tests/nginx-tests/tengine-tests/vnswrr4dynamic_ups.t @@ -15,7 +15,6 @@ BEGIN { use FindBin; chdir($FindBin::Bin); } use lib 'lib'; use Test::Nginx; -eval { require Net::DNS::Nameserver; }; plan(skip_all => 'Net::DNS::Nameserver not installed') if $@; ############################################################################### @@ -153,7 +152,7 @@ kill $^O eq 'MSWin32' ? 9 : 'TERM', $dns_pid; wait; # wait for dns cache to expire -sleep(2); +sleep(3); unlike(http_get('/stale'), qr/127\.0\.0\.2/, 'stale http server should be www.taobao.com:8081, using initial result'); @@ -248,6 +247,8 @@ sub reply_handler { } sub dns_server_daemon { + eval { require Net::DNS::Nameserver; }; + my $ns = new Net::DNS::Nameserver( LocalAddr => '127.0.0.1', LocalPort => 53530, @@ -255,7 +256,7 @@ sub dns_server_daemon { Verbose => 0 ) or die "couldn't create nameserver object\n"; - $ns->main_loop; + $ns->start_server(1); } ###############################################################################