comparison 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
comparison
equal deleted inserted replaced
1608:2f00ed2e0d1a 1609:f3ba4c74de31
546 sub write_file_expand($$) { 546 sub write_file_expand($$) {
547 my ($self, $name, $content) = @_; 547 my ($self, $name, $content) = @_;
548 548
549 $content =~ s/%%TEST_GLOBALS%%/$self->test_globals()/gmse; 549 $content =~ s/%%TEST_GLOBALS%%/$self->test_globals()/gmse;
550 $content =~ s/%%TEST_GLOBALS_HTTP%%/$self->test_globals_http()/gmse; 550 $content =~ s/%%TEST_GLOBALS_HTTP%%/$self->test_globals_http()/gmse;
551 $content =~ s/%%TEST_GLOBALS_STREAM%%/$self->test_globals_stream()/gmse;
551 $content =~ s/%%TESTDIR%%/$self->{_testdir}/gms; 552 $content =~ s/%%TESTDIR%%/$self->{_testdir}/gms;
552 553
553 $content =~ s/127\.0\.0\.1:(8\d\d\d)/'127.0.0.1:' . port($1)/gmse; 554 $content =~ s/127\.0\.0\.1:(8\d\d\d)/'127.0.0.1:' . port($1)/gmse;
554 555
555 $content =~ s/%%PORT_(\d+)%%/port($1)/gmse; 556 $content =~ s/%%PORT_(\d+)%%/port($1)/gmse;
687 if $ENV{TEST_NGINX_GLOBALS_HTTP}; 688 if $ENV{TEST_NGINX_GLOBALS_HTTP};
688 689
689 $self->{_test_globals_http} = $s; 690 $self->{_test_globals_http} = $s;
690 } 691 }
691 692
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
692 ############################################################################### 707 ###############################################################################
693 708
694 sub log_core { 709 sub log_core {
695 return unless $ENV{TEST_NGINX_VERBOSE}; 710 return unless $ENV{TEST_NGINX_VERBOSE};
696 my ($prefix, $msg) = @_; 711 my ($prefix, $msg) = @_;