1010
1111from .lib .tarantool_server import TarantoolServer
1212from .lib .skip import skip_or_run_error_extra_info_test
13+ from .utils import assert_admin_success
1314
1415
1516class TestSuiteRequest (unittest .TestCase ):
@@ -22,29 +23,35 @@ def setUpClass(cls):
2223 cls .srv .start ()
2324 cls .con = tarantool .Connection (cls .srv .host , cls .srv .args ['primary' ])
2425 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 )
4855
4956 if not sys .platform .startswith ("win" ):
5057 cls .sock_srv = TarantoolServer (create_unix_socket = True )
@@ -60,10 +67,11 @@ def setUp(self):
6067
6168 def test_00_00_authenticate (self ):
6269 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 })
6471 """ ))
6572 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})
6775 """ ))
6876 self .assertEqual (self .con .authenticate ('test' , 'test' )._data , None )
6977
@@ -311,7 +319,7 @@ def test_11_select_all_hash(self):
311319 space .select ((), iterator = tarantool .const .ITERATOR_EQ )
312320
313321 def test_12_update_fields (self ):
314- self .srv .admin (
322+ resp = self .srv .admin (
315323 """
316324 do
317325 local sp = box.schema.create_space('sp', {
@@ -325,7 +333,9 @@ def test_12_update_fields(self):
325333 parts = {1, 'unsigned'}
326334 })
327335 end
336+ return true
328337 """ )
338+ assert_admin_success (resp )
329339 self .con .insert ('sp' , [2 , 'help' , 4 ])
330340 self .assertSequenceEqual (
331341 self .con .update ('sp' , (2 ,), [('+' , 'thi' , 3 )]),
0 commit comments