Skip to content

Commit b1cad8f

Browse files
themilchenkosergos
authored andcommitted
tests: refactor tls cases
1 parent cd1e383 commit b1cad8f

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

test/integration/httpd_role_test.lua

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,20 +135,27 @@ g.test_httpd_role_usage = function(cg)
135135
end
136136

137137
g.test_stop_server_after_remove = function(cg)
138-
local resp = http_client:get('http://localhost:13001/ping')
138+
local protocol = cg.params.use_tls and 'https' or 'http'
139+
140+
t.assert(helpers.tcp_connection_exists('localhost', 13000))
141+
local resp = http_client:get(protocol .. '://localhost:13000/ping', {
142+
ca_file = cg.params.use_tls and fio.pathjoin(ssl_data_dir, 'ca.crt'),
143+
})
139144
t.assert_equals(resp.status, 200, 'response not 200')
140145
t.assert_equals(resp.body, 'pong')
141146

142147
local cfg = table.deepcopy(config)
143-
cfg.groups['group-001'].replicasets['replicaset-001'].roles_cfg['roles.httpd'].additional = nil
148+
cfg.groups['group-001'].replicasets['replicaset-001'].roles_cfg['roles.httpd'].default = nil
144149
treegen.write_file(cg.server.chdir, 'config.yaml', yaml.encode(cfg))
145150
local _, err = cg.server:eval("require('config'):reload()")
146151
t.assert_not(err)
147152

148-
t.assert_not(helpers.tcp_connection_exists('localhost', 13001))
153+
t.assert_not(helpers.tcp_connection_exists('localhost', 13000))
149154
end
150155

151156
g.test_change_server_addr_on_the_run = function(cg)
157+
t.skip_if(cg.params.use_tls, 'no certs for testing addr')
158+
152159
local resp = http_client:get('http://0.0.0.0:13001/ping')
153160
t.assert_equals(resp.status, 200, 'response not 200')
154161
t.assert_equals(resp.body, 'pong')
@@ -166,7 +173,11 @@ g.test_change_server_addr_on_the_run = function(cg)
166173
end
167174

168175
g.test_keep_existing_server_routes_on_config_reload = function(cg)
169-
local resp = http_client:get('http://0.0.0.0:13001/ping_once')
176+
local protocol = cg.params.use_tls and 'https' or 'http'
177+
178+
local resp = http_client:get(protocol .. '://localhost:13000/ping_once', {
179+
ca_file = cg.params.use_tls and fio.pathjoin(ssl_data_dir, 'ca.crt'),
180+
})
170181
t.assert_equals(resp.status, 200, 'response not 200')
171182
t.assert_equals(resp.body, 'pong once')
172183

@@ -176,7 +187,10 @@ g.test_keep_existing_server_routes_on_config_reload = function(cg)
176187
local _, err = cg.server:eval("require('config'):reload()")
177188
t.assert_not(err)
178189

179-
resp = http_client:get('http://0.0.0.0:13001/ping_once')
190+
t.assert(helpers.tcp_connection_exists('localhost', 13000))
191+
resp = http_client:get(protocol .. '://localhost:13000/ping_once', {
192+
ca_file = cg.params.use_tls and fio.pathjoin(ssl_data_dir, 'ca.crt'),
193+
})
180194
t.assert_equals(resp.status, 200, 'response not 200')
181195
t.assert_equals(resp.body, 'pong once')
182196
end

0 commit comments

Comments
 (0)