Skip to content

Commit 30c8f7b

Browse files
committed
Tests: added TEST_GLOBALS_STREAM variable support.
1 parent b31580c commit 30c8f7b

File tree

71 files changed

+157
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+157
-0
lines changed

README

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,8 @@ TEST_NGINX_GLOBALS_HTTP
4848

4949
Sets additional directives in http context.
5050

51+
TEST_NGINX_GLOBALS_STREAM
52+
53+
Sets additional directives in stream context.
54+
5155
Happy testing!

lib/Test/Nginx.pm

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,7 @@ sub write_file_expand($$) {
548548

549549
$content =~ s/%%TEST_GLOBALS%%/$self->test_globals()/gmse;
550550
$content =~ s/%%TEST_GLOBALS_HTTP%%/$self->test_globals_http()/gmse;
551+
$content =~ s/%%TEST_GLOBALS_STREAM%%/$self->test_globals_stream()/gmse;
551552
$content =~ s/%%TESTDIR%%/$self->{_testdir}/gms;
552553

553554
$content =~ s/127\.0\.0\.1:(8\d\d\d)/'127.0.0.1:' . port($1)/gmse;
@@ -689,6 +690,20 @@ sub test_globals_http() {
689690
$self->{_test_globals_http} = $s;
690691
}
691692

693+
sub test_globals_stream() {
694+
my ($self) = @_;
695+
696+
return $self->{_test_globals_stream}
697+
if defined $self->{_test_globals_stream};
698+
699+
my $s = '';
700+
701+
$s .= $ENV{TEST_NGINX_GLOBALS_STREAM}
702+
if $ENV{TEST_NGINX_GLOBALS_STREAM};
703+
704+
$self->{_test_globals_stream} = $s;
705+
}
706+
692707
###############################################################################
693708

694709
sub log_core {

proxy_protocol_ipv6.t

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ http {
5353
}
5454
5555
stream {
56+
%%TEST_GLOBALS_STREAM%%
57+
5658
server {
5759
listen 127.0.0.1:8080;
5860
proxy_pass [::1]:%%PORT_8080%%;

stream_access.t

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ events {
3535
}
3636
3737
stream {
38+
%%TEST_GLOBALS_STREAM%%
39+
3840
server {
3941
listen 127.0.0.1:8082;
4042
proxy_pass [::1]:%%PORT_8080%%;

stream_access_log.t

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ events {
3737
}
3838
3939
stream {
40+
%%TEST_GLOBALS_STREAM%%
41+
4042
log_format test $server_addr;
4143
log_format vars $connection:$nginx_version:$hostname:$pid;
4244
log_format addr $binary_remote_addr:$remote_addr:$remote_port:

stream_access_log_escape.t

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ events {
3333
}
3434
3535
stream {
36+
%%TEST_GLOBALS_STREAM%%
37+
3638
map $pid $a {
3739
default '" \ "';
3840
}

stream_access_log_none.t

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ events {
3333
}
3434
3535
stream {
36+
%%TEST_GLOBALS_STREAM%%
37+
3638
map $pid $a {
3739
default '" \ "';
3840
}

stream_error_log.t

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ events {
4444
}
4545
4646
stream {
47+
%%TEST_GLOBALS_STREAM%%
48+
4749
upstream u {
4850
server 127.0.0.1:%%PORT_8983_UDP%% down;
4951
}

stream_geo.t

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ events {
3737
}
3838
3939
stream {
40+
%%TEST_GLOBALS_STREAM%%
41+
4042
geo $geo {
4143
127.0.0.0/8 loopback;
4244
192.0.2.0/24 test;

stream_geo_binary.t

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ events {
3737
}
3838
3939
stream {
40+
%%TEST_GLOBALS_STREAM%%
41+
4042
geo $geo_base_create {
4143
ranges;
4244
include base.conf;

0 commit comments

Comments
 (0)