File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -132,6 +132,25 @@ class ClientTest < TinyTds::TestCase
132
132
end
133
133
end
134
134
135
+ it 'raises TinyTds exception when tcp socket is down' do
136
+ skip if ENV [ 'CI' ] && ENV [ 'APPVEYOR_BUILD_FOLDER' ] # only CI using docker
137
+ begin
138
+ client = new_connection timeout : 2 , port : 1234
139
+ assert_client_works ( client )
140
+ action = lambda { client . execute ( "waitfor delay '00:00:01'" ) . do }
141
+
142
+ # Use toxiproxy to close the TCP socket immediately.
143
+ # We want TinyTds to fail to execute the statement and raise an error immediately.
144
+ Toxiproxy [ :sqlserver_test ] . down do
145
+ assert_raise_tinytds_error ( action ) do |e |
146
+ assert_match %r{failed to execute statement}i , e . message , 'ignore if non-english test run'
147
+ end
148
+ end
149
+ ensure
150
+ assert_new_connections_work
151
+ end
152
+ end
153
+
135
154
it 'raises TinyTds exception with tcp socket network failure' do
136
155
skip if ENV [ 'CI' ] && ENV [ 'APPVEYOR_BUILD_FOLDER' ] # only CI using docker
137
156
begin
You can’t perform that action at this time.
0 commit comments