-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
extract upstream down test to separate file
- Loading branch information
Showing
3 changed files
with
26 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
use strict; | ||
use warnings; | ||
use Net::EmptyPort qw(check_port empty_port); | ||
use Test::More; | ||
use t::Util; | ||
|
||
# should return 502 in case of upstream error | ||
subtest 'upstream-down' => sub { | ||
plan skip_all => 'curl not found' | ||
unless prog_exists('curl'); | ||
my $upstream_port = empty_port(); | ||
my $server = spawn_h2o(<< "EOT"); | ||
hosts: | ||
default: | ||
paths: | ||
/: | ||
proxy.reverse.url: http://127.0.0.1:$upstream_port | ||
EOT | ||
my $port = $server->{port}; | ||
my $res = `curl --silent --dump-header /dev/stderr http://127.0.0.1:$port/ 2>&1 > /dev/null`; | ||
like $res, qr{^HTTP/1\.1 502 }, "502 response on upstream error"; | ||
}; | ||
|
||
done_testing(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters