Skip to content

Commit fba7f34

Browse files
committed
Handle localhost.localdomain difference in test
it depends on /etc/hosts
1 parent 3e3db53 commit fba7f34

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

t/server/controller/login/openid.t

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ with qw(
2020
my $openid_server = Test::OpenID::Server->new;
2121
my $url = $openid_server->started_ok('start server');
2222

23+
sub fix_localhost_uri {
24+
my $uri = shift;
25+
26+
# The dev vm make it localhost, but on travis it becomes `.localdomain`.
27+
$uri =~ s{^(\w+://localhost)\.localdomain([:/])}{$1$2};
28+
$uri;
29+
}
30+
2331
test authorization => sub {
2432
my $self = shift;
2533

@@ -34,7 +42,7 @@ test authorization => sub {
3442
ok( $self->request( GET '/login/openid?' . $uri_params->query ),
3543
'login with test URL' );
3644

37-
like $self->redirect_uri,
45+
like fix_localhost_uri( $self->redirect_uri ),
3846
qr{\Q$url\E/openid.server}, 'get correct OpenID server url';
3947

4048
$self->follow_redirect;

0 commit comments

Comments
 (0)