Skip to content

Commit b6d7d1b

Browse files
committed
test: skip master-replica tests if popen is not supported
Since version 2.4.1, Tarantool has the popen built-in module that supports execution of external programs. popen() uses in tests for creating replica instance. Part of #120
1 parent b332471 commit b6d7d1b

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

t/200-master-replica.t

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env tarantool
22

33
local fio = require('fio')
4+
local log = require('log')
45
local tnt = require('t.tnt')
56
local test = require('tap').test('')
67
local uuid = require('uuid')
@@ -11,6 +12,12 @@ local session = require('queue.abstract.queue_session')
1112
local queue_state = require('queue.abstract.queue_state')
1213
rawset(_G, 'queue', require('queue'))
1314

15+
local qc = require('queue.compat')
16+
if not qc.check_version({2, 4, 1}) then
17+
log.info('Tests skipped, tarantool version < 2.4.1')
18+
return
19+
end
20+
1421
-- Replica connection handler
1522
local conn = {}
1623

t/tnt/init.lua

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ local log = require('log')
33
local yaml = require('yaml')
44
local errno = require('errno')
55
local fiber = require('fiber')
6-
local popen = require('popen')
76
local netbox = require('net.box')
87

98
local dir = os.getenv('QUEUE_TMP')
@@ -55,6 +54,13 @@ end
5554

5655
-- Creates master and replica setup for queue states switching tests.
5756
local function tnt_cluster_prepare(cfg_args)
57+
-- Since version 2.4.1, Tarantool has the popen built-in module
58+
-- that supports execution of external programs.
59+
if not qc.check_version({2, 4, 1}) then
60+
error('this test requires tarantool >= 2.4.1')
61+
return false
62+
end
63+
5864
-- Prepare master.
5965
cfg_args = cfg_args or {}
6066
local files = fio.glob(fio.pathjoin(dir, '*'))
@@ -111,7 +117,7 @@ local function tnt_cluster_prepare(cfg_args)
111117
'}'
112118
}
113119

114-
replica = popen.new(cmd_replica, {
120+
replica = require('popen').new(cmd_replica, {
115121
stdin = 'devnull',
116122
stdout = 'devnull',
117123
stderr = 'devnull',

0 commit comments

Comments
 (0)