Skip to content

Commit 71303dd

Browse files
committed
test: add check on unsupported ssl
Closes #202
1 parent b4ad81d commit 71303dd

File tree

6 files changed

+44
-2
lines changed

6 files changed

+44
-2
lines changed

.github/workflows/test.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,14 @@ jobs:
1212
matrix:
1313
tarantool: ['1.10', '2.10', '2.11', '3.1', '3.2']
1414
coveralls: [false]
15+
static-build: [false]
1516
include:
16-
- tarantool: '2.11'
17+
- tarantool: '3.5'
1718
coveralls: true
19+
static-build: false
20+
- tarantool: '3.5'
21+
coveralls: false
22+
static-build: true
1823
runs-on: [ubuntu-22.04]
1924
steps:
2025
- uses: actions/checkout@master
@@ -32,7 +37,8 @@ jobs:
3237
env:
3338
DEBIAN_FRONTEND: noninteractive
3439

35-
- name: Install Tarantool
40+
- name: Install dynamic Tarantool
41+
if: matrix.static-build == false
3642
run: tt install tarantool ${{ matrix.tarantool }} --dynamic
3743

3844
- name: Cache rocks

test/helpers.lua

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,4 +148,17 @@ helpers.tcp_connection_exists = function(host, port)
148148
return ok
149149
end
150150

151+
local ffi = require('ffi')
152+
local has_tls_method = pcall(function()
153+
return ffi.C.TLS_server_method() ~= nil
154+
end)
155+
156+
helpers.skip_if_ssl_not_enabled = function()
157+
luatest.skip_if(not has_tls_method, 'tarantool does not support ssl')
158+
end
159+
160+
helpers.skip_if_ssl_enabled = function()
161+
luatest.skip_if(has_tls_method, 'tarantool supports ssl')
162+
end
163+
151164
return helpers

test/integration/http_tls_enabled_test.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ local g = t.group('ssl')
99

1010
local ssl_data_dir = fio.pathjoin(helpers.get_testdir_path(), "ssl_data")
1111

12+
g.before_all(function()
13+
helpers.skip_if_ssl_not_enabled()
14+
end)
15+
1216
local server_test_cases = {
1317
test_key_password_missing = {
1418
ssl_opts = {

test/integration/http_tls_enabled_validate_test.lua

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,22 @@ local test_cases = {
111111
},
112112
expected_err_msg = '"unknown" option not exists. Available options: "on", "off", "optional"'
113113
},
114+
ssl_socket_not_supported = {
115+
check_ssl = true,
116+
opts = {
117+
ssl_cert_file = fio.pathjoin(ssl_data_dir, 'server.crt'),
118+
ssl_key_file = fio.pathjoin(ssl_data_dir, 'server.key'),
119+
},
120+
expected_err_msg = 'ssl socket is not supported',
121+
}
114122
}
115123

116124
for name, case in pairs(test_cases) do
117125
g['test_ssl_option_' .. name] = function()
126+
helpers.skip_if_ssl_not_enabled()
127+
if case.check_ssl == true then
128+
helpers.skip_if_ssl_enabled()
129+
end
118130
t.assert_error_msg_contains(case.expected_err_msg, function()
119131
http_server.new('host', 8080, case.opts)
120132
end)

test/integration/httpd_role_test.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ tls_config.groups['group-001'].replicasets['replicaset-001'].roles_cfg['roles.ht
8888
tls_config.groups['group-001'].replicasets['replicaset-001'].roles_cfg['roles.httpd'].default
8989
.ssl_password_file = fio.pathjoin(ssl_data_dir, 'passwords')
9090

91+
g.before_all(function()
92+
helpers.skip_if_ssl_not_enabled()
93+
end)
94+
9195
g.before_each(function(cg)
9296
helpers.skip_if_not_tarantool3()
9397

test/unit/httpd_role_test.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,9 @@ for name, case in pairs(validation_cases) do
254254
)
255255

256256
g[test_name] = function()
257+
if name:find('ssl_') ~= nil and case.err == nil then
258+
helpers.skip_if_ssl_not_enabled()
259+
end
257260
local ok, res = pcall(httpd_role.validate, case.cfg)
258261

259262
if case.err ~= nil then

0 commit comments

Comments
 (0)