10
10
11
11
from .lib .tarantool_server import TarantoolServer
12
12
from .lib .skip import skip_or_run_error_extra_info_test
13
+ from .utils import assert_admin_success
13
14
14
15
15
16
class TestSuiteRequest (unittest .TestCase ):
@@ -22,29 +23,35 @@ def setUpClass(cls):
22
23
cls .srv .start ()
23
24
cls .con = tarantool .Connection (cls .srv .host , cls .srv .args ['primary' ])
24
25
cls .adm = cls .srv .admin
25
- cls .space_created = cls .adm ("box.schema.create_space('space_1')" )
26
- cls .adm ("""
27
- box.space['space_1']:create_index('primary', {
28
- type = 'tree',
29
- parts = {1, 'num'},
30
- unique = true})
31
- """ .replace ('\n ' , ' ' ))
32
- cls .adm ("""
33
- box.space['space_1']:create_index('secondary', {
34
- type = 'tree',
35
- parts = {2, 'num', 3, 'str'},
36
- unique = false})
37
- """ .replace ('\n ' , ' ' ))
38
- cls .space_created = cls .adm ("box.schema.create_space('space_2')" )
39
- cls .adm ("""
40
- box.space['space_2']:create_index('primary', {
41
- type = 'hash',
42
- parts = {1, 'num'},
43
- unique = true})
44
- """ .replace ('\n ' , ' ' ))
45
- cls .adm ("json = require('json')" )
46
- cls .adm ("fiber = require('fiber')" )
47
- cls .adm ("uuid = require('uuid')" )
26
+ cls .space_created = cls .adm ("box.schema.create_space('space_1', {if_not_exists = true})" )
27
+ resp = cls .adm ("""
28
+ box.space['space_1']:create_index('primary', {
29
+ type = 'tree',
30
+ parts = {1, 'num'},
31
+ unique = true,
32
+ if_not_exists = true})
33
+
34
+ box.space['space_1']:create_index('secondary', {
35
+ type = 'tree',
36
+ parts = {2, 'num', 3, 'str'},
37
+ unique = false,
38
+ if_not_exists = true})
39
+
40
+ box.schema.create_space('space_2', {if_not_exists = true})
41
+
42
+ box.space['space_2']:create_index('primary', {
43
+ type = 'hash',
44
+ parts = {1, 'num'},
45
+ unique = true,
46
+ if_not_exists = true})
47
+
48
+ json = require('json')
49
+ fiber = require('fiber')
50
+ uuid = require('uuid')
51
+
52
+ return true
53
+ """ )
54
+ assert_admin_success (resp )
48
55
49
56
if not sys .platform .startswith ("win" ):
50
57
cls .sock_srv = TarantoolServer (create_unix_socket = True )
@@ -60,10 +67,11 @@ def setUp(self):
60
67
61
68
def test_00_00_authenticate (self ):
62
69
self .assertIsNone (self .srv .admin ("""
63
- box.schema.user.create('test', { password = 'test' })
70
+ box.schema.user.create('test', { password = 'test', if_not_exists = true })
64
71
""" ))
65
72
self .assertIsNone (self .srv .admin ("""
66
- box.schema.user.grant('test', 'execute,read,write', 'universe')
73
+ box.schema.user.grant('test', 'execute,read,write', 'universe',
74
+ nil, {if_not_exists = true})
67
75
""" ))
68
76
self .assertEqual (self .con .authenticate ('test' , 'test' )._data , None )
69
77
@@ -311,7 +319,7 @@ def test_11_select_all_hash(self):
311
319
space .select ((), iterator = tarantool .const .ITERATOR_EQ )
312
320
313
321
def test_12_update_fields (self ):
314
- self .srv .admin (
322
+ resp = self .srv .admin (
315
323
"""
316
324
do
317
325
local sp = box.schema.create_space('sp', {
@@ -325,7 +333,9 @@ def test_12_update_fields(self):
325
333
parts = {1, 'unsigned'}
326
334
})
327
335
end
336
+ return true
328
337
""" )
338
+ assert_admin_success (resp )
329
339
self .con .insert ('sp' , [2 , 'help' , 4 ])
330
340
self .assertSequenceEqual (
331
341
self .con .update ('sp' , (2 ,), [('+' , 'thi' , 3 )]),
0 commit comments