Skip to content

Commit 9429f9c

Browse files
committed
test: fix connection failure test for ipv4 only env
An order in which getaddrinfo() returns addresses to try to connect may vary from system to system. In php:7.0-cli based docker container 127.0.0.1 address is tried first, then ::1. The attempt to connect the IPv4 address gives errno=111 (ECONNREFUSED, 'Connection refused') and it would be correctly matched by the test. An attempt to connect the IPv6 address gives errno=99 (EADDRNOTAVAIL, 'Cannot assign requested address'), which is reported in the exception message and considered as the failure by the test case. IPv4 is likely supported everywhere, so restrict the attempts to the IPv4 address.
1 parent ab5bb50 commit 9429f9c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

test/CreateTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function test_02_create_error_host() {
5353
* @expectedExceptionMessageRegExp /Connection refused|Network is unreachable/
5454
*/
5555
public function test_03_00_create_error_port() {
56-
(new Tarantool('localhost', 65500))->connect();
56+
(new Tarantool('127.0.0.1', 65500))->connect();
5757
}
5858

5959
/**

0 commit comments

Comments
 (0)