Skip to content

Commit 47e23e5

Browse files
committed
test: add integration tests
test-run supports three types of tests: - tarantool - Test-Suite for Functional Testing - app - Another functional Test-Suite - unittest - Unit-Testing Test Suite Patch adds tests for two of supported test types: - test-app for type 'app' - test-tarantool for type 'tarantool' How-to run: $ make test_integration - test-tarantool/panic_on_broken_lsn.test.lua [1] 1. tarantool/tarantool-qa#96
1 parent 74cfbbe commit 47e23e5

27 files changed

+1426
-1
lines changed

.luacheckrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,6 @@ include_files = {
2626

2727
exclude_files = {
2828
"lib/tarantool-python",
29+
"test/test-tarantool/manage_cluster.test.lua",
30+
"test/test-tarantool/setopt_delimeter.test.lua",
2931
}

Makefile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
1+
TEST_RUN_EXTRA_PARAMS?=
2+
UNIT_TEST_DIR=test/test-unit
3+
14
default:
25
false
36

4-
.PHONY: lint flake8 luacheck
57
lint: flake8 luacheck
68

79
flake8:
810
python -m flake8 *.py lib/*.py
911

1012
luacheck:
1113
luacheck --config .luacheckrc .
14+
15+
build_unit_tests:
16+
make -C $(UNIT_TEST_DIR)
17+
18+
test_integration: build_unit_tests
19+
test/test-run.py --builddir=build/ --var=build/test/var --force $(TEST_RUN_EXTRA_PARAMS)
20+
21+
.PHONY: lint flake8 luacheck test

test/.tarantoolctl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
-- Options for test-run tarantoolctl
2+
local workdir = os.getenv('TEST_WORKDIR')
3+
default_cfg = {
4+
pid_file = workdir,
5+
wal_dir = workdir,
6+
snap_dir = workdir,
7+
vinyl_dir = workdir,
8+
logger = workdir,
9+
background = false,
10+
}
11+
12+
instance_dir = workdir
13+
14+
-- vim: set ft=lua :

test/test-app/cfg.test.lua

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env tarantool
2+
3+
-- Test is an example of TAP test
4+
5+
local tap = require('tap')
6+
local test = tap.test('cfg')
7+
test:plan(4)
8+
9+
box.cfg{listen = box.NULL}
10+
test:is(nil, box.info.listen, 'no cfg.listen - no info.listen')
11+
12+
box.cfg{listen = '127.0.0.1:0'}
13+
test:ok(box.info.listen:match('127.0.0.1'), 'real IP in info.listen')
14+
test:ok(not box.info.listen:match(':0'), 'real port in info.listen')
15+
16+
box.cfg{listen = box.NULL}
17+
test:is(nil, box.info.listen, 'cfg.listen reset drops info.listen')
18+
19+
test:check()
20+
os.exit(0)

test/test-app/suite.ini

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[default]
2+
core = app
3+
description = application tests
4+
is_parallel = True
5+
pretest_clean = True
6+
use_unix_sockets_iproto = True

test/test-run.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../test-run.py

test/test-tarantool/box.lua

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env tarantool
2+
local os = require('os')
3+
4+
box.cfg{
5+
listen = os.getenv("LISTEN"),
6+
memtx_memory = 107374182,
7+
pid_file = "tarantool.pid",
8+
force_recovery = true,
9+
wal_max_size = 500
10+
}
11+
12+
require('console').listen(os.getenv('ADMIN'))

0 commit comments

Comments
 (0)