Skip to content

Commit 8980a54

Browse files
committed
test: add check on unsupported ssl
1 parent 377163b commit 8980a54

File tree

5 files changed

+36
-1
lines changed

5 files changed

+36
-1
lines changed

.github/workflows/test.yml

Lines changed: 11 additions & 1 deletion
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:
1617
- tarantool: '2.11'
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,9 +37,14 @@ 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

44+
- name: Install static Tarantool
45+
if: matrix.static-build == true
46+
run: tt install tarantool ${{ matrix.tarantool }}
47+
3848
- name: Cache rocks
3949
uses: actions/cache@v3
4050
id: cache-rocks

test/helpers.lua

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

151+
local has_ssl, _ = pcall(require('ffi').load, 'ssl')
152+
153+
helpers.skip_if_ssl_not_enabled = function()
154+
luatest.skip_if(not has_ssl, 'tarantool does not supports ssl')
155+
end
156+
157+
helpers.skip_if_ssl_enabled = function()
158+
luatest.skip_if(has_ssl, 'tarantool supports ssl')
159+
end
160+
151161
return helpers

test/integration/http_tls_enabled_test.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ local server_test_cases = {
4646

4747
for name, tc in pairs(server_test_cases) do
4848
g.before_test(name, function()
49+
helpers.skip_if_ssl_not_enabled()
4950
g.httpd = helpers.cfgserv(tc.ssl_opts)
5051
end)
5152

@@ -216,6 +217,7 @@ local client_test_cases = {
216217

217218
for name, tc in pairs(client_test_cases) do
218219
g.before_test(name, function()
220+
helpers.skip_if_ssl_not_enabled()
219221
g.httpd = helpers.cfgserv(tc.ssl_opts)
220222
g.httpd:start()
221223
end)

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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ g.before_each(function(cg)
9595

9696
local cfg = config
9797
if cg.params.use_tls then
98+
helpers.skip_if_ssl_not_enabled()
9899
cfg = tls_config
99100
end
100101

0 commit comments

Comments
 (0)