changeset 356:7a472e46772c

Tests: added http resolver test for CNAME + A combined answer.
author Sergey Kandaurov <pluknet@nginx.com>
date Thu, 21 Nov 2013 15:20:10 +0400
parents 14eba1ad0880
children e0c00e695cb5
files http_resolver.t
diffstat 1 files changed, 13 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/http_resolver.t
+++ b/http_resolver.t
@@ -101,7 +101,7 @@ plan(skip_all => 'no inet6 support') if 
 $t->waitforsocket('127.0.0.1:8081');
 $t->waitforsocket('127.0.0.1:8082');
 
-$t->plan(27);
+$t->plan(28);
 
 ###############################################################################
 
@@ -121,6 +121,11 @@ like(http_host_header('cname.example.net
 like(http_host_header('cname.example.net', '/cached'), qr/200 OK/,
 	'CNAME cached');
 
+# CNAME + A combined answer
+# demonstrates the name in answer section different from what is asked
+
+like(http_host_header('cname_a.example.net', '/'), qr/200 OK/, 'CNAME + A');
+
 # CNAME refers to non-existing A
 
 like(http_host_header('cname2.example.net', '/'), qr/502 Bad/, 'CNAME bad');
@@ -169,7 +174,6 @@ sleep 2;
 
 # expired ttl causes nginx to query the next (bad) ns
 
-skip:
 like(http_host_header('ttl.example.net', '/two'), qr/502 Bad/, 'ttl expired');
 
 # zero ttl prohibits response caching
@@ -269,6 +273,13 @@ sub reply_handler {
 		($type, $rdata) = ('CNAME', 'alias.example.net');
 		push @ans, Net::DNS::RR->new("$name $ttl $class $type $rdata");
 
+	} elsif ($name eq 'cname_a.example.net') {
+		($type, $rdata) = ('CNAME', 'alias.example.net');
+		push @ans, Net::DNS::RR->new("$name $ttl $class $type $rdata");
+
+		($name, $type, $rdata) = ('alias.example.net', 'A', '127.0.0.1');
+		push @ans, Net::DNS::RR->new("$name $ttl $class $type $rdata");
+
 	} elsif ($name eq 'cname2.example.net') {
 		# points to non-existing A
 		($type, $rdata) = ('CNAME', 'nx.example.net');