changeset 293:719285b89d7e

Tests: upstream.t minor fixes.
author Maxim Dounin <mdounin@mdounin.ru>
date Sat, 08 Jun 2013 02:38:50 +0400
parents 2da774b0fc7d
children 71e275487aeb
files upstream.t
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/upstream.t
+++ b/upstream.t
@@ -64,6 +64,9 @@ EOF
 $t->run_daemon(\&http_daemon, 8082);
 $t->run();
 
+$t->waitforsocket('127.0.0.1:8081');
+$t->waitforsocket('127.0.0.1:8082');
+
 ###############################################################################
 
 is(many('/', 30), '8081: 15, 8082: 15', 'balanced');
@@ -94,7 +97,7 @@ sub many {
 	my ($uri, $count, %opts) = @_;
 	my %ports;
 
-	for (1 .. 30) {
+	for (1 .. $count) {
 		if (http_get($uri) =~ /X-Port: (\d+)/) {
 			$ports{$1} = 0 unless defined $ports{$1};
 			$ports{$1}++;
@@ -121,6 +124,8 @@ sub http_daemon {
 	)
 		or die "Can't create listening socket: $!\n";
 
+	local $SIG{PIPE} = 'IGNORE';
+
 	while (my $client = $server->accept()) {
 		$client->autoflush(1);