Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix nameserver testcase #1966

Merged
merged 1 commit into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions tests/nginx-tests/tengine-tests/dynamic_resolve.t
Original file line number Diff line number Diff line change
Expand Up @@ -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 $@;

###############################################################################
Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -251,14 +250,16 @@ 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,
ReplyHandler => \&reply_handler,
Verbose => 0
) or die "couldn't create nameserver object\n";

$ns->main_loop;
$ns->start_server(1);
}

###############################################################################
7 changes: 4 additions & 3 deletions tests/nginx-tests/tengine-tests/vnswrr4dynamic_ups.t
Original file line number Diff line number Diff line change
Expand Up @@ -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 $@;

###############################################################################
Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -248,14 +247,16 @@ 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,
ReplyHandler => \&reply_handler,
Verbose => 0
) or die "couldn't create nameserver object\n";

$ns->main_loop;
$ns->start_server(1);
}

###############################################################################
Loading