1
1
#! /usr/bin/env tarantool
2
2
local test = require (' tap' ).test ()
3
- test :plan (3 )
3
+ test :plan (9 )
4
4
5
5
local test_user = ' test'
6
6
local test_pass = ' 1234'
@@ -21,6 +21,68 @@ local engine = os.getenv('ENGINE') or 'memtx'
21
21
22
22
local qc = require (' queue.compat' )
23
23
24
+ local test_drivers_grant_cases = {
25
+ {
26
+ name = ' fifo' ,
27
+ queue_type = ' fifo' ,
28
+ },
29
+ {
30
+ name = ' fifottl' ,
31
+ queue_type = ' fifottl' ,
32
+ },
33
+ {
34
+ name = ' utube_default' ,
35
+ queue_type = ' utube' ,
36
+ storage_mode = ' default' ,
37
+ },
38
+ {
39
+ name = ' utube_ready_buffer' ,
40
+ queue_type = ' utube' ,
41
+ storage_mode = ' ready_buffer' ,
42
+ },
43
+ {
44
+ name = ' utubettl_default' ,
45
+ queue_type = ' utubettl' ,
46
+ storage_mode = ' default' ,
47
+ },
48
+ {
49
+ name = ' utubettl_ready_buffer' ,
50
+ queue_type = ' utubettl' ,
51
+ storage_mode = ' ready_buffer' ,
52
+ },
53
+ }
54
+
55
+ for _ , tc in pairs (test_drivers_grant_cases ) do
56
+ test :test (' test dirvers grant ' .. tc .name , function (test )
57
+ local queue = require (' queue' )
58
+ box .schema .user .create (test_user , { password = test_pass })
59
+
60
+ test :plan (2 )
61
+
62
+ local tube_opts = { engine = engine }
63
+ if tc .storage_mode ~= nil and tc .storage_mode ~= ' default' then
64
+ tube_opts .storage_mode = tc .storage_mode
65
+ tube_opts .engine = ' memtx'
66
+ end
67
+ local tube = queue .create_tube (' test' , tc .queue_type , tube_opts )
68
+ tube :put (' help' )
69
+
70
+ tube :grant (test_user )
71
+
72
+ box .session .su (test_user )
73
+ local a = tube :take ()
74
+ test :is (a [1 ], 0 , ' we aren\' t getting any error' )
75
+
76
+ local c = tube :ack (a [1 ])
77
+ test :is (c [1 ], 0 , ' we aren\' t getting any error' )
78
+
79
+ box .session .su (' admin' )
80
+
81
+ box .schema .user .drop (test_user )
82
+ tube :drop ()
83
+ end )
84
+ end
85
+
24
86
test :test (' check for space grants' , function (test )
25
87
-- prepare for tests
26
88
local queue = require (' queue' )
0 commit comments