changeset 891:f4189a38c3a4

Tests: mark 'phantom event' alerts on Solaris as TODO (iff any).
author Sergey Kandaurov <pluknet@nginx.com>
date Fri, 01 Apr 2016 20:16:27 +0300
parents b06beed07bc8
children 0c64f87aa689
files lib/Test/Nginx.pm limit_conn.t mail_imap_ssl.t proxy_unfinished.t stream_access.t stream_proxy_ssl_verify.t stream_ssl.t stream_tcp_nodelay.t
diffstat 8 files changed, 8 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/lib/Test/Nginx.pm
+++ b/lib/Test/Nginx.pm
@@ -66,9 +66,14 @@ sub DESTROY {
 	if (Test::More->builder->expected_tests) {
 		local $Test::Nginx::TODO = 'alerts' unless $self->{_alerts};
 
-		my $alerts = $self->read_file('error.log');
-		$alerts = join "\n", $alerts =~ /.+\[alert\].+/gm;
-		Test::More::is($alerts, '', 'no alerts');
+		my @alerts = $self->read_file('error.log') =~ /.+\[alert\].+/gm;
+
+		if ($^O eq 'solaris') {
+			$Test::Nginx::TODO = 'alerts' if @alerts
+				&& ! grep { $_ !~ /phantom event/ } @alerts;
+		}
+
+		Test::More::is(join("\n", @alerts), '', 'no alerts');
 	}
 
 	if (Test::More->builder->expected_tests) {
--- a/limit_conn.t
+++ b/limit_conn.t
@@ -23,8 +23,6 @@ select STDOUT; $| = 1;
 
 my $t = Test::Nginx->new()->has(qw/http proxy limit_conn limit_req shmem/);
 
-$t->todo_alerts() if $^O eq 'solaris';
-
 $t->write_file_expand('nginx.conf', <<'EOF')->plan(8);
 
 %%TEST_GLOBALS%%
--- a/mail_imap_ssl.t
+++ b/mail_imap_ssl.t
@@ -37,8 +37,6 @@ my $t = Test::Nginx->new()
 	->has(qw/mail mail_ssl imap http rewrite/)->has_daemon('openssl')
 	->run_daemon(\&Test::Nginx::IMAP::imap_test_daemon)->plan(12);
 
-$t->todo_alerts() if $^O eq 'solaris';
-
 $t->write_file_expand('nginx.conf', <<'EOF');
 
 %%TEST_GLOBALS%%
--- a/proxy_unfinished.t
+++ b/proxy_unfinished.t
@@ -33,8 +33,6 @@ select STDOUT; $| = 1;
 
 my $t = Test::Nginx->new()->has(qw/http proxy cache sub shmem/)->plan(15);
 
-$t->todo_alerts() if $^O eq 'solaris';
-
 $t->write_file_expand('nginx.conf', <<'EOF');
 
 %%TEST_GLOBALS%%
--- a/stream_access.t
+++ b/stream_access.t
@@ -25,8 +25,6 @@ select STDOUT; $| = 1;
 
 my $t = Test::Nginx->new()->has(qw/stream stream_access ipv6/);
 
-$t->todo_alerts() if $^O eq 'solaris';
-
 $t->write_file_expand('nginx.conf', <<'EOF');
 
 %%TEST_GLOBALS%%
--- a/stream_proxy_ssl_verify.t
+++ b/stream_proxy_ssl_verify.t
@@ -24,8 +24,6 @@ select STDOUT; $| = 1;
 
 my $t = Test::Nginx->new()->has(qw/stream stream_ssl/)->has_daemon('openssl');
 
-$t->todo_alerts() if $^O eq 'solaris';
-
 $t->write_file_expand('nginx.conf', <<'EOF')->plan(6);
 
 %%TEST_GLOBALS%%
--- a/stream_ssl.t
+++ b/stream_ssl.t
@@ -35,8 +35,6 @@ plan(skip_all => 'Net::SSLeay not instal
 
 my $t = Test::Nginx->new()->has(qw/stream stream_ssl/)->has_daemon('openssl');
 
-$t->todo_alerts() if $^O eq 'solaris';
-
 $t->plan(7)->write_file_expand('nginx.conf', <<'EOF');
 
 %%TEST_GLOBALS%%
--- a/stream_tcp_nodelay.t
+++ b/stream_tcp_nodelay.t
@@ -28,8 +28,6 @@ select STDOUT; $| = 1;
 
 my $t = Test::Nginx->new()->has(qw/stream/);
 
-$t->todo_alerts() if $^O eq 'solaris';
-
 plan(skip_all => 'no tcp_nodelay') unless $t->has_version('1.9.4');
 
 $t->plan(2)->write_file_expand('nginx.conf', <<'EOF');