Skip to content

Commit e22e68a

Browse files
committed
test: fix HTTP address reload check
Connecting to 0.0.0.0 is environment-dependent. On Linux it may reach a listener on 127.0.0.1, so the test can fail even when the server is recreated with the expected address. This patch verifies the host and port kept by roles.httpd after reload. The existing HTTP request checks that the recreated server is running. Closes #228
1 parent 9b73cab commit e22e68a

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

test/integration/httpd_role_test.lua

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,16 @@ g.test_change_server_addr_on_the_run = function(cg)
170170
local _, err = cg.server:eval("require('config'):reload()")
171171
t.assert_not(err)
172172

173-
t.assert_not(helpers.tcp_connection_exists('0.0.0.0', 13001))
173+
t.assert_equals(cg.server:eval([[
174+
local httpd = require('roles.httpd').get_server('additional')
175+
return {
176+
host = httpd.host,
177+
port = httpd.port,
178+
}
179+
]]), {
180+
host = 'localhost',
181+
port = 13001,
182+
})
174183
resp = http_client:get('http://localhost:13001/ping')
175184
t.assert_equals(resp.status, 200, 'response not 200')
176185
t.assert_equals(resp.body, 'pong')

0 commit comments

Comments
 (0)