From 2184fbcc46fb4d72c5f50e0fd4d62233f947a082 Mon Sep 17 00:00:00 2001 From: drawing Date: Wed, 6 Nov 2024 15:38:46 +0800 Subject: [PATCH] fix nameserver testcase --- tests/nginx-tests/tengine-tests/dynamic_resolve.t | 5 +++-- tests/nginx-tests/tengine-tests/vnswrr4dynamic_ups.t | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/nginx-tests/tengine-tests/dynamic_resolve.t b/tests/nginx-tests/tengine-tests/dynamic_resolve.t index 262b3000a1..dc13463fde 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 $@; ############################################################################### @@ -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; } ############################################################################### diff --git a/tests/nginx-tests/tengine-tests/vnswrr4dynamic_ups.t b/tests/nginx-tests/tengine-tests/vnswrr4dynamic_ups.t index d0e17b1a06..37db8894b5 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 $@; ############################################################################### @@ -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; } ###############################################################################