@@ -13,7 +13,8 @@ local netbox = require('net.box')
1313local tnt = require (' t.tnt' )
1414
1515tnt .cfg {
16- listen = uri .format ({ host = test_host , service = test_port })
16+ listen = (' %s:%s' ):format (test_host , test_port )
17+ -- listen = uri.format({ host = test_host, service = test_port })
1718}
1819
1920local qc = require (' queue.compat' )
@@ -86,23 +87,42 @@ test:test('check for call grants', function(test)
8687 test :is (a [1 ], 0 , ' we aren\' t getting any error' )
8788 box .session .su (' admin' )
8889
90+ local nb_connect = netbox .connect
91+ if nb_connect == nil then
92+ nb_connect = netbox .new
93+ end
94+ local con = nb_connect (
95+ (' %s:%s@%s:%s' ):format (test_user , test_pass , test_host , test_port )
96+ )
97+ --[[
8998 local con = netbox.connect(uri.format({
9099 login = test_user, password = test_pass,
91100 host = test_host, service = test_port,
92101 }, true))
102+ ]] --
93103
94- local stat , er = pcall (con .call , con , tube , ' queue.tube.test:take' )
104+ local stat , err = pcall (con .call , con , ' queue.tube.test:take' )
95105 test :is (stat , false , ' we\' re getting error' )
96106
97107 -- granting call
98108 tube :grant (' test' , { call = true })
99109
110+ local qc_arg_unpack = function (arg )
111+ if qc .check_version ({1 , 7 }) then
112+ return arg
113+ end
114+ return arg and arg [1 ]
115+ end
116+
100117 local a = con :call (' queue.tube.test:take' )
101- test :is (a [1 ], 0 , ' we aren\' t getting any error' )
118+ test :is (qc_arg_unpack ( a [1 ]) , 0 , ' we aren\' t getting any error' )
102119 local b = con :call (' queue.tube.test:take' , qc .pack_args (0.1 ))
103- test :isnil (b , ' we aren\' t getting any error' )
104- local c = con :call (' queue.tube.test:ack' , qc .pack_args (a [1 ]))
105- test :is (a [1 ], 0 , ' we aren\' t getting any error' )
120+ test :isnil (
121+ qc_arg_unpack (qc_arg_unpack (b )),
122+ ' we aren\' t getting any error'
123+ )
124+ local c = con :call (' queue.tube.test:ack' , qc .pack_args (qc_arg_unpack (a [1 ])))
125+ test :is (qc_arg_unpack (a [1 ]), 0 , ' we aren\' t getting any error' )
106126
107127 -- check grants again
108128 tube :grant (' test' , { call = true })
0 commit comments