Mercurial > hg > nginx-tests
comparison stream_variables.t @ 1600:b61e820caa83
Tests: using Sys::Hostname to get hostname in a portable way.
The hostname utility is not defined by POSIX and not available
by default on some modern Linux distro's (Arch, Fedora).
Reported by Geert Hendrickx.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Mon, 12 Oct 2020 18:13:07 +0100 |
parents | 766bcbb632ee |
children | f3ba4c74de31 |
comparison
equal
deleted
inserted
replaced
1599:4e0644119341 | 1600:b61e820caa83 |
---|---|
9 | 9 |
10 use warnings; | 10 use warnings; |
11 use strict; | 11 use strict; |
12 | 12 |
13 use Test::More; | 13 use Test::More; |
14 | |
15 use Sys::Hostname; | |
14 | 16 |
15 BEGIN { use FindBin; chdir($FindBin::Bin); } | 17 BEGIN { use FindBin; chdir($FindBin::Bin); } |
16 | 18 |
17 use lib 'lib'; | 19 use lib 'lib'; |
18 use Test::Nginx; | 20 use Test::Nginx; |
78 | 80 |
79 $t->try_run('no inet6 support')->plan(8); | 81 $t->try_run('no inet6 support')->plan(8); |
80 | 82 |
81 ############################################################################### | 83 ############################################################################### |
82 | 84 |
83 chomp(my $hostname = lc `hostname`); | 85 my $hostname = lc hostname(); |
84 like(stream('127.0.0.1:' . port(8080))->read(), | 86 like(stream('127.0.0.1:' . port(8080))->read(), |
85 qr/^\d+:[\d.]+:$hostname:\d+:0$/, 'vars'); | 87 qr/^\d+:[\d.]+:$hostname:\d+:0$/, 'vars'); |
86 | 88 |
87 my $dport = port(8081); | 89 my $dport = port(8081); |
88 my $s = stream("127.0.0.1:$dport"); | 90 my $s = stream("127.0.0.1:$dport"); |