Skip to content

Commit 388ccf5

Browse files
committed
Fixup for multi-request packet and tests
1 parent 5c9396f commit 388ccf5

File tree

4 files changed

+20
-14
lines changed

4 files changed

+20
-14
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,11 @@ It's ok you can do whatever you need. I add log options for some technical infor
299299

300300
## Changelog
301301

302+
### 3.0.7
303+
304+
Fix in header decoding to support latest Tarantool versions.
305+
Update to tests to support latest Tarantool versions.
306+
302307
### 3.0.6
303308

304309
Remove let for support old nodejs version

lib/parser.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ var decoder = new Decoder();
88
exports._processResponse = function(buffer, offset){
99
offset=offset||0;
1010
decoder.buffer = buffer;
11-
var size = decoder.fetch();
11+
decoder.offset = offset;
1212
var header = decoder.fetch();
1313
var schemaId = header[tarantoolConstants.KeysCode.schema_version];
14-
var reqId = header[tarantoolConstants.KeysCode.code];
14+
var reqId = header[tarantoolConstants.KeysCode.sync];
15+
var code = header[tarantoolConstants.KeysCode.code];
1516
var obj = decoder.fetch();
1617
if (this.schemaId)
1718
{
@@ -35,7 +36,7 @@ exports._processResponse = function(buffer, offset){
3536
}
3637
}
3738
var dfd = task[2];
38-
var success = reqId == 0 ? true : false;
39+
var success = code == 0 ? true : false;
3940
if (success)
4041
dfd.resolve(_returnBool(task[0], obj));
4142
else

test/app.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ describe('multihost', function () {
230230
conn.eval('return box.cfg')
231231
.then(function(res){
232232
t++;
233-
expect(res[0].listen).to.eql('33014');
233+
expect(res[0].listen.toString()).to.eql('33014');
234234
exec('docker kill reserve', function(error, stdout, stderr){
235235
if(error){
236236
done(error);
@@ -246,7 +246,7 @@ describe('multihost', function () {
246246
conn.eval('return box.cfg')
247247
.then(function(res){
248248
t++;
249-
expect(res[0].listen).to.eql('33015');
249+
expect(res[0].listen.toString()).to.eql('33015');
250250
exec('docker kill reserve_2', function(error, stdout, stderr){
251251
if(error){
252252
done(error);
@@ -261,7 +261,7 @@ describe('multihost', function () {
261261
conn.eval('return box.cfg')
262262
.then(function(res){
263263
t++;
264-
expect(res[0].listen).to.eql('33013');
264+
expect(res[0].listen.toString()).to.eql('33013');
265265
done();
266266
})
267267
.catch(function(e){
@@ -355,7 +355,7 @@ describe('instant connection', function(){
355355
conn = new TarantoolConnection({port: 33013, username: 'userloser', password: 'test'});
356356
conn.eval('return func_foo()')
357357
.catch(function (err) {
358-
expect(err.message).to.match(/User 'userloser' is not found/);
358+
expect(err.message).to.include("not found");
359359
conn.disconnect();
360360
done();
361361
});
@@ -743,4 +743,4 @@ describe('connection test with custom msgpack implementation', function(){
743743
});
744744
});
745745
describe('slider buffer', function(){
746-
})
746+
})

test/box.lua

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ if not box.space.test then
2121
local test = box.schema.space.create('test')
2222
test:create_index('primary', {type = 'TREE', unique = true, parts = {1, 'NUM'}})
2323
test:create_index('secondary', {type = 'TREE', unique = false, parts = {2, 'NUM', 3, 'STR'}})
24-
box.schema.user.grant('test', 'read,write,execute', 'space', 'test')
24+
box.schema.user.grant('test', 'read,write', 'space', 'test')
2525
end
2626

2727
function test_delete(num)
@@ -47,7 +47,7 @@ end
4747
if not box.space.batched then
4848
local batched = box.schema.space.create('batched')
4949
batched:create_index('primary', {type = 'TREE', unique = true, parts = {1, 'NUM'}})
50-
box.schema.user.grant('test', 'read,write,execute', 'space', 'batched')
50+
box.schema.user.grant('test', 'read,write', 'space', 'batched')
5151
end
5252

5353
function batch (data)
@@ -65,14 +65,14 @@ end
6565
if not box.space.toaddmore then
6666
local toaddmore = box.schema.space.create('toaddmore')
6767
toaddmore:create_index('primary', {type = 'TREE', unique = true, parts = {1, 'STR'}})
68-
box.schema.user.grant('test', 'read,write,execute', 'space', 'toaddmore')
69-
box.schema.user.grant('test', 'read,write,execute', 'space', '_index')
68+
box.schema.user.grant('test', 'read,write', 'space', 'toaddmore')
69+
box.schema.user.grant('test', 'read,write', 'space', '_index')
7070
end
7171

7272
if not box.space.upstest then
7373
local s = box.schema.space.create('upstest')
7474
s:create_index('primary', {type = 'TREE', unique = true, parts = {1, 'NUM'}})
75-
box.schema.user.grant('test', 'read,write,execute', 'space', 'upstest')
75+
box.schema.user.grant('test', 'read,write', 'space', 'upstest')
7676
end
7777

7878
function clearaddmore()
@@ -115,4 +115,4 @@ end
115115

116116
function func_arg(arg)
117117
return arg
118-
end
118+
end

0 commit comments

Comments
 (0)