@@ -22,6 +22,14 @@ def create_server():
2222 return srv
2323
2424
25+ def create_mock_server ():
26+ srv = TarantoolServer ()
27+ srv .script = 'test/suites/crud_mock_server.lua'
28+ srv .start ()
29+
30+ return srv
31+
32+
2533@unittest .skipIf (sys .platform .startswith ("win" ),
2634 "Crud tests on windows platform are not supported: "
2735 "complexity of the vshard replicaset configuration" )
@@ -33,14 +41,19 @@ def setUpClass(cls):
3341 print ('-' * 70 , file = sys .stderr )
3442 # Create server and extract helpful fields for tests.
3543 cls .srv = create_server ()
44+ cls .mock_srv = create_mock_server ()
3645 cls .host = cls .srv .host
3746 cls .port = cls .srv .args ['primary' ]
47+ cls .mock_host = cls .mock_srv .host
48+ cls .mock_port = cls .mock_srv .args ['primary' ]
3849
3950 def setUp (self ):
4051 time .sleep (1 )
4152 # Open connections to instance.
4253 self .conn = tarantool .Connection (host = self .host , port = self .port ,
4354 user = 'guest' , password = '' , fetch_schema = False )
55+ self .mock_conn = tarantool .Connection (host = self .mock_host , port = self .mock_port ,
56+ user = 'guest' , password = '' , fetch_schema = False )
4457 self .conn_mesh = tarantool .MeshConnection (host = self .host , port = self .port ,
4558 user = 'guest' , password = '' , fetch_schema = False )
4659 self .conn_pool = tarantool .ConnectionPool ([{'host' : self .host , 'port' : self .port }],
@@ -736,9 +749,15 @@ def test_crud_module_via_pool_connection(self):
736749 # Exception try testing.
737750 self ._exception_operation_with_crud (testing_function , case , mode = tarantool .Mode .RW )
738751
752+ def test_error_rethrow (self ):
753+ self .assertRaisesRegex (
754+ DatabaseError , "Unexpected connection error" ,
755+ lambda : self .mock_conn .crud_replace ('tester' , [2 , 100 , 'Alice' ], {'timeout' : 10 }))
756+
739757 def tearDown (self ):
740758 # Close connections to instance.
741759 self .conn .close ()
760+ self .mock_conn .close ()
742761 self .conn_mesh .close ()
743762 self .conn_pool .close ()
744763
@@ -747,3 +766,5 @@ def tearDownClass(cls):
747766 # Stop instance.
748767 cls .srv .stop ()
749768 cls .srv .clean ()
769+ cls .mock_srv .stop ()
770+ cls .mock_srv .clean ()
0 commit comments