@@ -135,31 +135,6 @@ def interrupt_thread(exc=nil)
135135 end
136136 end
137137
138- it "connects without port and then retrieves the default port" do
139- gate = Helpers ::TcpGateSwitcher . new (
140- external_host : 'localhost' ,
141- external_port : ENV [ 'PGPORT' ] . to_i ,
142- internal_host : "127.0.0.1" ,
143- internal_port : PG ::DEF_PGPORT ,
144- debug : ENV [ 'PG_DEBUG' ] =='1' )
145-
146- PG . connect ( host : "localhost" ,
147- port : "" ,
148- dbname : "test" ) do |conn |
149- expect ( conn . port ) . to eq ( PG ::DEF_PGPORT )
150- end
151-
152- PG . connect ( hostaddr : "127.0.0.1" ,
153- port : nil ,
154- dbname : "test" ) do |conn |
155- expect ( conn . port ) . to eq ( PG ::DEF_PGPORT )
156- end
157-
158- gate . finish
159- rescue Errno ::EADDRINUSE , Errno ::EACCES => err
160- skip err . to_s
161- end
162-
163138 it "doesn't duplicate hosts in conn.reset" , :without_transaction , :ipv6 , :postgresql_12 do
164139 set_etc_hosts "::1" , "rubypg_test2 rubypg_test_ipv6"
165140 set_etc_hosts "127.0.0.1" , "rubypg_test2 rubypg_test_ipv4"
@@ -181,64 +156,4 @@ def interrupt_thread(exc=nil)
181156 expect ( conn . hostaddr ) . to eq ( "::1" )
182157 expect ( conn . port ) . to eq ( @port )
183158 end
184-
185- context "in nonblocking mode" do
186- after :each do
187- @conn . setnonblocking ( false )
188- end
189-
190- it "rejects to send lots of COPY data" do
191- unless RUBY_PLATFORM =~ /i386-mingw|x86_64-darwin|x86_64-linux$/
192- skip "this spec depends on out-of-memory condition in put_copy_data, which is not reliable on all platforms"
193- end
194-
195- run_with_gate ( 200 ) do |conn , gate |
196- conn . setnonblocking ( true )
197-
198- res = nil
199- conn . exec <<-EOSQL
200- CREATE TEMP TABLE copytable (col1 TEXT);
201- EOSQL
202-
203- conn . exec ( "COPY copytable FROM STDOUT CSV" )
204-
205- gate . stop
206-
207- data = "x" * 1000 * 1000
208- data << "\n "
209- 20000 . times do |idx |
210- res = conn . put_copy_data ( data )
211- break if res == false
212- end
213- expect ( res ) . to be_falsey
214-
215- gate . start
216- conn . cancel
217- conn . discard_results
218- end
219- end
220-
221- it "needs to flush data after send_query" do
222- run_with_gate ( 200 ) do |conn , gate |
223- conn . setnonblocking ( true )
224-
225- gate . stop
226- data = "x" * 1000 * 1000 * 30
227- res = conn . send_query_params ( "SELECT LENGTH($1)" , [ data ] )
228- expect ( res ) . to be_nil
229-
230- res = conn . flush
231- expect ( res ) . to be_falsey
232-
233- gate . start
234- until conn . flush
235- IO . select ( nil , [ conn . socket_io ] , [ conn . socket_io ] , 10 )
236- end
237- expect ( conn . flush ) . to be_truthy
238-
239- res = conn . get_last_result
240- expect ( res . values ) . to eq ( [ [ data . length . to_s ] ] )
241- end
242- end
243- end
244159end
0 commit comments