Skip to content

Commit 620abf6

Browse files
vr009ligurio
authored andcommitted
tests: queue tests fix
Before this patch, queue tests failed due to impossibility to use _queue_taken, which was deprecated in tarantool/queue [1]. Switch to _queue_taken_2 fixed it. Create access and some other actions were denied for test user. Additional grants fixed this problem. The test `TestUtube_Put` was affected by replacing timeout in the call of `TakeTimeout()` with timeout of connection structure. For clarification of this effect see annotation for function `TakeTimeout()` [2]. That was fixed by making connection timeout longer than the timeout in the function call. The step in testing.yml was uncommented for enabling queue tests in CI. 1. https://github.com/tarantool/queue/tree/7d05b6db5b0d596db4281d53b57811e156234a0d#fields-of-the-_queue_consumers-space 2. https://github.com/tarantool/go-tarantool/blob/master/queue/queue.go#L35 Fixes #115
1 parent 37a7295 commit 620abf6

File tree

4 files changed

+38
-20
lines changed

4 files changed

+38
-20
lines changed

.github/workflows/reusable_testing.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,14 @@ jobs:
4545
go clean -testcache && go test -v
4646
kill $TNT_PID
4747
48-
# TODO(ylobankov): Uncomment this when tarantool/go-tarantool#115 is resolved.
49-
# - name: Run queue tests
50-
# working-directory: ./queue
51-
# run: |
52-
# mkdir snap xlog
53-
# tarantoolctl rocks install queue 1.1.0
54-
# TNT_PID=$(tarantool ./config.lua > tarantool.log 2>&1 & echo $!)
55-
# go clean -testcache && go test -v
56-
# kill $TNT_PID
48+
- name: Run queue tests
49+
working-directory: ./queue
50+
run: |
51+
mkdir snap xlog
52+
tarantoolctl rocks install queue 1.1.0
53+
TNT_PID=$(tarantool ./config.lua > tarantool.log 2>&1 & echo $!)
54+
go clean -testcache && go test -v
55+
kill $TNT_PID
5756
5857
- name: Run uuid tests
5958
working-directory: ./uuid

.github/workflows/testing.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,16 @@ jobs:
4646
go clean -testcache && go test -v
4747
kill $TNT_PID
4848
49-
# TODO(ylobankov): Uncomment this when tarantool/go-tarantool#115 is resolved.
50-
# - name: Run queue tests
51-
# working-directory: ./queue
52-
# run: |
53-
# mkdir snap xlog
54-
# tarantoolctl rocks install queue 1.1.0
55-
# TNT_PID=$(tarantool ./config.lua > tarantool.log 2>&1 & echo $!)
56-
# go clean -testcache && go test -v
57-
# kill $TNT_PID
49+
- name: Run queue tests
50+
working-directory: ./queue
51+
run: |
52+
rm -rf snap
53+
rm -rf xlog
54+
mkdir snap xlog
55+
tarantoolctl rocks install queue 1.1.0
56+
TNT_PID=$(tarantool ./config.lua > tarantool.log 2>&1 & echo $!)
57+
go clean -testcache && go test -v
58+
kill $TNT_PID
5859
5960
- name: Run uuid tests
6061
working-directory: ./uuid

queue/config.lua

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,30 @@ box.schema.func.create('queue.tube.test_queue:delete')
1818
box.schema.func.create('queue.tube.test_queue:release')
1919
box.schema.func.create('queue.tube.test_queue:bury')
2020
box.schema.func.create('queue.statistics')
21+
box.schema.user.grant('test', 'create', 'space')
22+
box.schema.user.grant('test', 'write', 'space', '_schema')
23+
box.schema.user.grant('test', 'write', 'space', '_space')
24+
box.schema.user.grant('test', 'read,write', 'space', '_space_sequence')
25+
box.schema.user.grant('test', 'write', 'space', '_index')
26+
box.schema.user.grant('test', 'read, write', 'space', '_queue_session_ids')
2127
box.schema.user.grant('test', 'execute', 'universe')
2228
box.schema.user.grant('test', 'read,write', 'space', '_queue')
2329
box.schema.user.grant('test', 'read,write', 'space', '_schema')
2430
box.schema.user.grant('test', 'read,write', 'space', '_space')
2531
box.schema.user.grant('test', 'read,write', 'space', '_index')
2632
box.schema.user.grant('test', 'read,write', 'space', '_queue_consumers')
2733
box.schema.user.grant('test', 'read,write', 'space', '_priv')
28-
box.schema.user.grant('test', 'read,write', 'space', '_queue_taken')
34+
box.schema.user.grant('test', 'read,write', 'space', '_queue_taken_2')
35+
if box.space._trigger ~= nil then
36+
box.schema.user.grant('test', 'read', 'space', '_trigger')
37+
end
38+
if box.space._fk_constraint ~= nil then
39+
box.schema.user.grant('test', 'read', 'space', '_fk_constraint')
40+
end
41+
if box.space._ck_constraint ~= nil then
42+
box.schema.user.grant('test', 'read', 'space', '_ck_constraint')
43+
end
44+
if box.space._func_index ~= nil then
45+
box.schema.user.grant('test', 'read', 'space', '_func_index')
46+
end
2947
end)

queue/queue_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313

1414
var server = "127.0.0.1:3013"
1515
var opts = Opts{
16-
Timeout: 500 * time.Millisecond,
16+
Timeout: 2500 * time.Millisecond,
1717
User: "test",
1818
Pass: "test",
1919
//Concurrency: 32,

0 commit comments

Comments
 (0)