Mercurial > hg > nginx-tests
diff lib/Test/Nginx.pm @ 1609:f3ba4c74de31
Tests: added TEST_GLOBALS_STREAM variable support.
author | Andrei Belov <defan@nginx.com> |
---|---|
date | Thu, 12 Nov 2020 17:46:49 +0300 |
parents | a328109be893 |
children | 8659123d2d37 |
line wrap: on
line diff
--- a/lib/Test/Nginx.pm +++ b/lib/Test/Nginx.pm @@ -548,6 +548,7 @@ sub write_file_expand($$) { $content =~ s/%%TEST_GLOBALS%%/$self->test_globals()/gmse; $content =~ s/%%TEST_GLOBALS_HTTP%%/$self->test_globals_http()/gmse; + $content =~ s/%%TEST_GLOBALS_STREAM%%/$self->test_globals_stream()/gmse; $content =~ s/%%TESTDIR%%/$self->{_testdir}/gms; $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() { $self->{_test_globals_http} = $s; } +sub test_globals_stream() { + my ($self) = @_; + + return $self->{_test_globals_stream} + if defined $self->{_test_globals_stream}; + + my $s = ''; + + $s .= $ENV{TEST_NGINX_GLOBALS_STREAM} + if $ENV{TEST_NGINX_GLOBALS_STREAM}; + + $self->{_test_globals_stream} = $s; +} + ############################################################################### sub log_core {